Skip to content

Commit

Permalink
Rename to kpdemo
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmcnew committed Oct 16, 2020
1 parent dcee668 commit 1cabe5a
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/build

/statik
pbdemo
kpdemo

# misc
.DS_Store
Expand Down
57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pbdemo
# kpdemo

A tool to visualize and demo [kpack](https://github.com/pivotal/kpack).

Expand All @@ -12,42 +12,42 @@ A tool to visualize and demo [kpack](https://github.com/pivotal/kpack).

## Get Started

1. Download the newest [release](https://github.com/matthewmcnew/pbdemo/releases)
2. Run `pbdemo serve` to get a visualization of the images inside of a kpack cluster.
1. Download the newest [release](https://github.com/matthewmcnew/kpdemo/releases)
2. Run `kpdemo serve` to get a visualization of the images inside of a kpack cluster.

### Demos

1. Start the local server for the build service visualization web UI
1. Start the local server for the kpack visualization web UI

```bash
pbdemo serve
kpdemo serve
```

> This should start up a local Build Service visualization web server that you access in the browser.
> This should start up a local kpack visualization web server that you access in the browser.

1. Populate Build Service with sample image configurations.
1. Populate kpack with sample image configurations.

The `pbdemo populate` command will relocate builder and run images to a configured registry to enable build service demos.
In addition, the command will "seed" an specified number of sample build service image configurations.
The `kpdemo populate` command will relocate builder and run images to a configured registry to enable kpack demos.
In addition, the command will "seed" a specified number of sample kpack image configurations.

Running `pbdemo populate` will look something like this:
Running `kpdemo populate` will look something like this:
```bash
pbdemo populate --registry gcr.io/my-project-name --count 20
kpdemo populate --registry gcr.io/my-project-name --count 20
```

- `registry`: The registry to install build service images & for build service to build new images into. You need local write access to this registry.
- `registry`: The registry to install kpack images & for kpack to build new images into. You need local write access to this registry.

- `count`: The number of initial build service image configurations to create.
- `count`: The number of initial kpack image configurations to create.

- (Optional) `cache-size`: The Cache Size for each image's build cache. Example: `--cache-size 100Mi` Default: '500Mi'
> Warning: The registry configured in pbdemo populate must be publicly readable by kpack.
> Warning: The registry configured in kpdemo populate must be publicly readable by kpack.
1. Navigate to the Web UI in your browser to see build service build all the images created in step #3.
1. Navigate to the Web UI in your browser to see kpack build all the images created in step #3.
## Demo: Stack Update
1. Navigate to the build service web UI and mark the current stack (run image) as 'vulnerable'.
1. Navigate to the kpack web UI and mark the current stack (run image) as 'vulnerable'.
- Copy the truncated stack digest from from one of the existing images in the visualization.
- Click on Setup in the top right corner.
Expand All @@ -57,17 +57,17 @@ A tool to visualize and demo [kpack](https://github.com/pivotal/kpack).
1. Push an updated stack (Run Image)
The `pbdemo update-stack` will push an updated image to the registry build service is monitoring.
The `kpdemo update-stack` will push an updated image to the registry kpack is monitoring.
```
pbdemo update-stack
kpdemo update-stack
```
1. Navigate to the Web UI in your browser to watch build service `rebase` all the images that used the previous stack (run image).
1. Navigate to the Web UI in your browser to watch kpack `rebase` all the images that used the previous stack (run image).
## Demo: Buildpack update
1. Navigate to the build service web UI and mark a buildpack id & version as 'vulnerable'.
1. Navigate to the kpack web UI and mark a buildpack id & version as 'vulnerable'.
- Copy the current backpack ID & Version for from one of the existing images in the visualization.
- Click on Setup in the top right corner.
Expand All @@ -77,31 +77,30 @@ A tool to visualize and demo [kpack](https://github.com/pivotal/kpack).
1. Push an Updated Backpack
The `pbdemo update-buildpacks --buildpack <buildpack>` will create a new buildpack and add it to the kpack buildpack store. Kpack will rebuild "out-of-date" images with the new buildpack.
The `kpdemo update-buildpacks --buildpack <buildpack>` will create a new buildpack and add it to the kpack buildpack store. Kpack will rebuild "out-of-date" images with the new buildpack.
```
pbdemo update-buildpacks --buildpack <buildpack.id>
kpdemo update-buildpacks --buildpack <buildpack.id>
```
Note:
1. Navigate to the Web UI in your browser to watch build service `rebuild` all the images that used the previous buildpack.
1. Navigate to the Web UI in your browser to watch kpack `rebuild` all the images that used the previous buildpack.
## Image logs
You can view the build logs of any image in any namespace `pbdemo <image-logs>`.
You can view the build logs of any image in any namespace `kpdemo <image-logs>`.
```
pbdemo logs <image-name>
kpdemo logs <image-name>
```
## Cleanup
1. Remove all images created by `pbdemo` with `cleanup`
1. Remove all images created by `kpdemo` with `cleanup`
```
pbdemo cleanup
kpdemo cleanup
```
Note: this will reset your kpack builder,stack, and store resources to their previous state before using pbdemo.
Note: this will reset your kpack builder,stack, and store resources to their previous state before using kpdemo.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ popd

statik -src=ui/build

go build -o pbdemo cmd/pbdemo/main.go
go build -o kpdemo cmd/kpdemo/main.go
4 changes: 2 additions & 2 deletions buildpacks/update_buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/matthewmcnew/pbdemo/defaults"
"github.com/matthewmcnew/pbdemo/k8s"
"github.com/matthewmcnew/kpdemo/defaults"
"github.com/matthewmcnew/kpdemo/k8s"
)

func UpdateBuildpack(id string) error {
Expand Down
157 changes: 0 additions & 157 deletions cmd/pbdemo/main.go

This file was deleted.

2 changes: 1 addition & 1 deletion defaults/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ const (
StackName = "default"
StoreName = "default"
Namespace = "demo-project"
OldSpecAnnotation = "pbdemo/old-spec"
OldSpecAnnotation = "kpdemo/old-spec"
)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/matthewmcnew/pbdemo
module github.com/matthewmcnew/kpdemo

go 1.13

Expand Down
2 changes: 1 addition & 1 deletion logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/matthewmcnew/pbdemo/k8s"
"github.com/matthewmcnew/kpdemo/k8s"
)

func Logs(name string) error {
Expand Down
4 changes: 2 additions & 2 deletions populate/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/matthewmcnew/pbdemo/defaults"
"github.com/matthewmcnew/pbdemo/k8s"
"github.com/matthewmcnew/kpdemo/defaults"
"github.com/matthewmcnew/kpdemo/k8s"
)

func Cleanup() error {
Expand Down
8 changes: 4 additions & 4 deletions populate/populate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/matthewmcnew/pbdemo/defaults"
"github.com/matthewmcnew/pbdemo/k8s"
"github.com/matthewmcnew/kpdemo/defaults"
"github.com/matthewmcnew/kpdemo/k8s"
)

func Populate(count int32, order v1alpha1.Order, imageTag, cacheSize string) error {
Expand Down Expand Up @@ -55,7 +55,7 @@ func Populate(count int32, order v1alpha1.Order, imageTag, cacheSize string) err

secret, err := k8sclient.CoreV1().Secrets(defaults.Namespace).Create(&v1.Secret{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "pbdemo-dockersecret-",
GenerateName: "kpdemo-dockersecret-",
Annotations: map[string]string{
"kpack.io/docker": c.registry,
},
Expand All @@ -72,7 +72,7 @@ func Populate(count int32, order v1alpha1.Order, imageTag, cacheSize string) err

serviceAccount, err := k8sclient.CoreV1().ServiceAccounts(defaults.Namespace).Create(&v1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "pbdemo-serviceaccount-",
GenerateName: "kpdemo-serviceaccount-",
},
Secrets: []v1.ObjectReference{
{
Expand Down
8 changes: 4 additions & 4 deletions populate/relocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/matthewmcnew/pbdemo/defaults"
"github.com/matthewmcnew/pbdemo/k8s"
"github.com/matthewmcnew/kpdemo/defaults"
"github.com/matthewmcnew/kpdemo/k8s"
)

const (
Expand Down Expand Up @@ -67,13 +67,13 @@ func Relocate(imageTag string) (Relocated, error) {
}

if !verifyRegistryPublic(k8sClient, runImage) {
fmt.Printf("\n%s: Image: %s is not public. \n pbdemo populate will not work if %s is not public or readable by kpack and the nodes on the cluster\n Continuing anyway...\n\n",
fmt.Printf("\n%s: Image: %s is not public. \n kpdemo populate will not work if %s is not public or readable by kpack and the nodes on the cluster\n Continuing anyway...\n\n",
color.RedString("WARNING"),
imageTag,
imageTag)
}

builderRef, err := name.ParseReference("gcr.io/paketo-buildpacks/builder:base")
builderRef, err := name.ParseReference("paketobuildpacks/builder:base")
if err != nil {
return Relocated{}, err
}
Expand Down
Loading

0 comments on commit 1cabe5a

Please sign in to comment.