diff --git a/.gitignore b/.gitignore index 305bc64..dabf594 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ /build /statik -pbdemo +kpdemo # misc .DS_Store diff --git a/README.md b/README.md index fd2b262..6136311 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# pbdemo +# kpdemo A tool to visualize and demo [kpack](https://github.com/pivotal/kpack). @@ -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. @@ -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. @@ -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 ` 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 ` 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 + kpdemo update-buildpacks --buildpack ``` - 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 `. +You can view the build logs of any image in any namespace `kpdemo `. ``` -pbdemo logs +kpdemo logs ``` ## 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. diff --git a/build.sh b/build.sh index f35711a..b0cec75 100755 --- a/build.sh +++ b/build.sh @@ -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 diff --git a/buildpacks/update_buildpack.go b/buildpacks/update_buildpack.go index 0358b75..a2f7783 100644 --- a/buildpacks/update_buildpack.go +++ b/buildpacks/update_buildpack.go @@ -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 { diff --git a/cmd/pbdemo/main.go b/cmd/pbdemo/main.go deleted file mode 100644 index df873ad..0000000 --- a/cmd/pbdemo/main.go +++ /dev/null @@ -1,157 +0,0 @@ -package main - -import ( - "errors" - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/matthewmcnew/pbdemo/buildpacks" - "github.com/matthewmcnew/pbdemo/logs" - "github.com/matthewmcnew/pbdemo/populate" - "github.com/matthewmcnew/pbdemo/rebase" - "github.com/matthewmcnew/pbdemo/server" -) - -var rootCmd = &cobra.Command{ - Use: "", - Short: "A tool to demo build service & kpack", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Welcome to the Build Service Demo") - }, -} - -func main() { - _ = rootCmd.Execute() -} - -func init() { - rootCmd.AddCommand(populateCmd(), - serveCmd(), - updateRunImageCmd(), - cleanupCmd(), - logsCmd(), - updateBPCmd(), - ) -} - -func populateCmd() *cobra.Command { - var registry string - var cacheSize string - var count int32 - var cmd = &cobra.Command{ - Use: "populate", - Aliases: []string{"setup"}, - Short: "Populate Build Service with Images", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("Relocating Buildpacks and Run Image. This will take a moment.") - imageTag := fmt.Sprintf("%s/pbdemo", registry) - - fmt.Printf("Writing all images to: %s\n", imageTag) - - relocated, err := populate.Relocate(imageTag) - if err != nil { - return err - } - - return populate.Populate(count, relocated.Order, imageTag, cacheSize) - }, - } - cmd.Flags().StringVarP(&cacheSize, "cache-size", "s", "500Mi", "the cache size to use for build service images") - - cmd.Flags().StringVarP(®istry, "registry", "r", "", "registry to deploy images into") - _ = cmd.MarkFlagRequired("registry") - - cmd.Flags().Int32VarP(&count, "count", "c", 0, "the number of images to populate in build service") - _ = cmd.MarkFlagRequired("count") - - return cmd -} - -func updateBPCmd() *cobra.Command { - var buildpack string - var cmd = &cobra.Command{ - Use: "update-buildpack", - Short: "Create new buildpack to simulate update", - RunE: func(cmd *cobra.Command, args []string) error { - return buildpacks.UpdateBuildpack(buildpack) - }, - } - cmd.Flags().StringVarP(&buildpack, "buildpack", "b", "", "the id of the buildpack to update") - _ = cmd.MarkFlagRequired("buildpack") - - return cmd -} - -func serveCmd() *cobra.Command { - var port string - var cmd = &cobra.Command{ - Use: "serve", - Aliases: []string{"visualization", "ui"}, - Short: "Setup a local web server build service visualization ", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("Starting Up") - go func() { - time.Sleep(500 * time.Millisecond) - - url := fmt.Sprintf("http://localhost:%s", port) - fmt.Printf("Open up a browser to %s\n", url) - - server.OpenBrowser(url) - }() - - server.Serve(port) - - return nil - }, - } - - cmd.Flags().StringVarP(&port, "port", "p", "8080", "registry to deploy images into") - - return cmd -} - -func updateRunImageCmd() *cobra.Command { - var cmd = &cobra.Command{ - Use: "update-stack", - Aliases: []string{"rebase", "update-run-image", "stack-update"}, - Short: "Demo an update by pushing an updated stack run image", - RunE: func(cmd *cobra.Command, args []string) error { - return rebase.UpdateRunImage() - }, - } - - return cmd -} - -func cleanupCmd() *cobra.Command { - var cmd = &cobra.Command{ - Use: "cleanup", - Short: "Remove build service demo images", - RunE: func(cmd *cobra.Command, args []string) error { - return populate.Cleanup() - }, - } - - return cmd -} - -func logsCmd() *cobra.Command { - var cmd = &cobra.Command{ - Use: "logs", - Short: "Stream build logs from an image", - Example: "pbdemo logs ", - RunE: func(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return errors.New("no image name provided") - } - - image := args[0] - - return logs.Logs(image) - }, - } - - return cmd -} diff --git a/defaults/demo.go b/defaults/demo.go index 2f49e16..184b272 100644 --- a/defaults/demo.go +++ b/defaults/demo.go @@ -5,5 +5,5 @@ const ( StackName = "default" StoreName = "default" Namespace = "demo-project" - OldSpecAnnotation = "pbdemo/old-spec" + OldSpecAnnotation = "kpdemo/old-spec" ) diff --git a/go.mod b/go.mod index bb50f30..b3cb1fa 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/matthewmcnew/pbdemo +module github.com/matthewmcnew/kpdemo go 1.13 diff --git a/logs/logs.go b/logs/logs.go index a720648..6473961 100644 --- a/logs/logs.go +++ b/logs/logs.go @@ -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 { diff --git a/populate/cleanup.go b/populate/cleanup.go index 408be32..fe5ec53 100644 --- a/populate/cleanup.go +++ b/populate/cleanup.go @@ -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 { diff --git a/populate/populate.go b/populate/populate.go index 0c709c1..386bded 100644 --- a/populate/populate.go +++ b/populate/populate.go @@ -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 { @@ -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, }, @@ -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{ { diff --git a/populate/relocate.go b/populate/relocate.go index deddb1c..b5267e3 100644 --- a/populate/relocate.go +++ b/populate/relocate.go @@ -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 ( @@ -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 } diff --git a/rebase/update_run_image.go b/rebase/update_run_image.go index 02c891c..c4e5e4a 100644 --- a/rebase/update_run_image.go +++ b/rebase/update_run_image.go @@ -12,8 +12,8 @@ import ( "github.com/pivotal/kpack/pkg/registry/imagehelpers" 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 UpdateRunImage() error { @@ -49,7 +49,7 @@ func UpdateRunImage() error { return err } - i, err = imagehelpers.SetStringLabel(i, "PBDEMO_DEMO", time.Now().String()) + i, err = imagehelpers.SetStringLabel(i, "KPDEMO_DEMO", time.Now().String()) if err != nil { return err } diff --git a/server/server.go b/server/server.go index fff11cc..656af02 100644 --- a/server/server.go +++ b/server/server.go @@ -11,9 +11,9 @@ import ( "github.com/pivotal/kpack/pkg/client/listers/build/v1alpha1" "github.com/rakyll/statik/fs" - "github.com/matthewmcnew/pbdemo/images" - "github.com/matthewmcnew/pbdemo/k8s" - _ "github.com/matthewmcnew/pbdemo/statik" + "github.com/matthewmcnew/kpdemo/images" + "github.com/matthewmcnew/kpdemo/k8s" + _ "github.com/matthewmcnew/kpdemo/statik" ) func Serve(port string) { diff --git a/setup/minikube/README.md b/setup/minikube/README.md index 1ceafea..a233ef1 100644 --- a/setup/minikube/README.md +++ b/setup/minikube/README.md @@ -43,5 +43,5 @@ kubectl apply -f https://storage.googleapis.com/beam-releases/out.yaml ### Demo: ```bash -pbdemo populate --registry registry.default.svc.cluster.local:5000/please --count 15 +kpdemo populate --registry registry.default.svc.cluster.local:5000/please --count 15 ``` diff --git a/ui/public/index.html b/ui/public/index.html index 86c13cc..f319a36 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -21,7 +21,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - Build Service Visualization + kpack Visualization