diff --git a/Makefile b/Makefile index af88aeb3..0e85f8ee 100644 --- a/Makefile +++ b/Makefile @@ -20,5 +20,6 @@ build: install: go install cmd/tk +.PHONY: docs docs: mkdir -p ./docs/cmd && go run ./cmd/tk/ docgen diff --git a/cmd/tk/create_kustomization.go b/cmd/tk/create_kustomization.go index c296b3c3..87011d1a 100644 --- a/cmd/tk/create_kustomization.go +++ b/cmd/tk/create_kustomization.go @@ -24,25 +24,25 @@ var createKsCmd = &cobra.Command{ The kustomization source command generates a kustomization.kustomize.fluxcd.io resource for a given GitRepository source. API spec: https://github.com/fluxcd/kustomize-controller/tree/master/docs/spec/v1alpha1`, Example: ` # Create a kustomization from a source at a given path - create kustomization backend \ - --source=webapp \ - --path="./overlays/backend/" \ - --prune="app=backend" \ + create kustomization contour \ + --source=contour \ + --path="./examples/contour/" \ + --prune="instance=contour" \ + --generate=true \ --interval=10m \ --validate=client \ - --health-check="StatefulSet/backend.test" \ + --health-check="Deployment/contour.projectcontour" \ + --health-check="DaemonSet/envoy.projectcontour" \ --health-check-timeout=3m - # Create a kustomization that depends on another - create kustomization frontend \ - --depends-on=backend \ + # Create a kustomization that depends on the previous one + create kustomization webapp \ + --depends-on=contour \ --source=webapp \ - --path="./overlays/frontend/" \ - --prune="app=frontend" \ + --path="./deploy/overlays/dev" \ + --prune="env=dev,instance=webapp" \ --interval=5m \ - --validate=client \ - --health-check="Deployment/frontend.test" \ - --health-check-timeout=2m + --validate=client `, RunE: createKsCmdRun, } diff --git a/cmd/tk/main.go b/cmd/tk/main.go index 9e6f43cb..4cde0e67 100644 --- a/cmd/tk/main.go +++ b/cmd/tk/main.go @@ -16,11 +16,35 @@ var VERSION = "0.0.1" var rootCmd = &cobra.Command{ Use: "tk", - Short: "Command line utility for assembling Kubernetes CD pipelines", - Long: `Command line utility for assembling Kubernetes CD pipelines.`, Version: VERSION, SilenceUsage: true, SilenceErrors: true, + Short: "Command line utility for assembling Kubernetes CD pipelines", + Long: `Command line utility for assembling Kubernetes CD pipelines.`, + Example: ` # Check prerequisites + tk check --pre + + # Install the latest version of the toolkit + tk install --version=master + + # Create a source from a public Git repository + tk create source webapp \ + --git-url=https://github.com/stefanprodan/podinfo \ + --git-branch=master \ + --interval=5m + + # Create a kustomization for deploying a series of microservices + tk create kustomization webapp \ + --source=webapp \ + --path="./deploy/webapp/" \ + --prune="instance=webapp" \ + --generate=true \ + --interval=5m \ + --validate=client \ + --health-check="Deployment/backend.webapp" \ + --health-check="Deployment/frontend.webapp" \ + --health-check-timeout=2m +`, } var (