diff --git a/cmd/tk/bootstrap_github.go b/cmd/tk/bootstrap_github.go index 4e7f8d5fcda5eb0ece27504fce637518b8aa40a0..ad4a6fbbb75df037daf6a45b5a59c33c00e0df10 100644 --- a/cmd/tk/bootstrap_github.go +++ b/cmd/tk/bootstrap_github.go @@ -42,19 +42,19 @@ the bootstrap command will perform an upgrade if needed.`, export GITHUB_TOKEN=<my-token> # Run bootstrap for a private repo owned by a GitHub organization - bootstrap github --owner=<organization> --repository=<repo name> + tk bootstrap github --owner=<organization> --repository=<repo name> # Run bootstrap for a private repo and assign organization teams to it - bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug> + tk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug> # Run bootstrap for a repository path - bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster + tk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster # Run bootstrap for a public repository on a personal account - bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true + tk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true # Run bootstrap for a private repo hosted on GitHub Enterprise - bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain> + tk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain> `, RunE: bootstrapGitHubCmdRun, } diff --git a/cmd/tk/bootstrap_gitlab.go b/cmd/tk/bootstrap_gitlab.go index d35aab4f7a91d38489dc10aad90ceb84eea4f72b..b259e7bc54b5d30be7e7b1ec748444b8ed279f01 100644 --- a/cmd/tk/bootstrap_gitlab.go +++ b/cmd/tk/bootstrap_gitlab.go @@ -42,16 +42,16 @@ the bootstrap command will perform an upgrade if needed.`, export GITLAB_TOKEN=<my-token> # Run bootstrap for a private repo owned by a GitLab group - bootstrap gitlab --owner=<group> --repository=<repo name> + tk bootstrap gitlab --owner=<group> --repository=<repo name> # Run bootstrap for a repository path - bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster + tk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster # Run bootstrap for a public repository on a personal account - bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true + tk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true # Run bootstrap for a private repo hosted on a GitLab server - bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain> + tk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain> `, RunE: bootstrapGitLabCmdRun, } diff --git a/cmd/tk/create_kustomization.go b/cmd/tk/create_kustomization.go index 13ce334e16727d68368bd8b6526185a5ccc360b7..e358f5334a3991c8d52b460b9695141457505c29 100644 --- a/cmd/tk/create_kustomization.go +++ b/cmd/tk/create_kustomization.go @@ -40,7 +40,7 @@ var createKsCmd = &cobra.Command{ Short: "Create or update a Kustomization resource", Long: "The kustomization source create command generates a Kustomize resource for a given GitRepository source.", Example: ` # Create a Kustomization resource from a source at a given path - create kustomization contour \ + tk create kustomization contour \ --source=contour \ --path="./examples/contour/" \ --prune=true \ @@ -51,7 +51,7 @@ var createKsCmd = &cobra.Command{ --health-check-timeout=3m # Create a Kustomization resource that depends on the previous one - create kustomization webapp \ + tk create kustomization webapp \ --depends-on=contour \ --source=webapp \ --path="./deploy/overlays/dev" \ @@ -60,7 +60,7 @@ var createKsCmd = &cobra.Command{ --validation=client # Create a Kustomization resource that runs under a service account - create kustomization webapp \ + tk create kustomization webapp \ --source=webapp \ --path="./deploy/overlays/staging" \ --prune=true \ diff --git a/cmd/tk/create_source_git.go b/cmd/tk/create_source_git.go index 78d183eb995c45823fe1a671e1fecf095e37defd..9fa7d6f2d2f20daa2ff879313b66c5001379735d 100644 --- a/cmd/tk/create_source_git.go +++ b/cmd/tk/create_source_git.go @@ -46,35 +46,35 @@ The create source git command generates a GitRepository resource and waits for i For Git over SSH, host and SSH keys are automatically generated and stored in a Kubernetes secret. For private Git repositories, the basic authentication credentials are stored in a Kubernetes secret.`, Example: ` # Create a source from a public Git repository master branch - create source git podinfo \ + tk create source git podinfo \ --url=https://github.com/stefanprodan/podinfo \ --branch=master # Create a source from a Git repository pinned to specific git tag - create source git podinfo \ + tk create source git podinfo \ --url=https://github.com/stefanprodan/podinfo \ --tag="3.2.3" # Create a source from a public Git repository tag that matches a semver range - create source git podinfo \ + tk create source git podinfo \ --url=https://github.com/stefanprodan/podinfo \ --tag-semver=">=3.2.0 <3.3.0" # Create a source from a Git repository using SSH authentication - create source git podinfo \ + tk create source git podinfo \ --url=ssh://git@github.com/stefanprodan/podinfo \ --branch=master # Create a source from a Git repository using SSH authentication and an # ECDSA P-521 curve public key - create source git podinfo \ + tk create source git podinfo \ --url=ssh://git@github.com/stefanprodan/podinfo \ --branch=master \ --ssh-key-algorithm=ecdsa \ --ssh-ecdsa-curve=p521 # Create a source from a Git repository using basic authentication - create source git podinfo \ + tk create source git podinfo \ --url=https://github.com/stefanprodan/podinfo \ --username=username \ --password=password @@ -115,7 +115,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error { name := args[0] if sourceGitURL == "" { - return fmt.Errorf("git-url is required") + return fmt.Errorf("url is required") } tmpDir, err := ioutil.TempDir("", name) diff --git a/cmd/tk/delete_kustomization.go b/cmd/tk/delete_kustomization.go index d72bf18637954637030899a99c77b04542d884c9..68c61851bdbf27fc7203f3e00925331d1ea37497 100644 --- a/cmd/tk/delete_kustomization.go +++ b/cmd/tk/delete_kustomization.go @@ -31,7 +31,10 @@ var deleteKsCmd = &cobra.Command{ Aliases: []string{"ks"}, Short: "Delete a Kustomization resource", Long: "The delete kustomization command deletes the given Kustomization from the cluster.", - RunE: deleteKsCmdRun, + Example: ` # Delete a kustomization and the Kubernetes resources created by it + tk delete kustomization podinfo +`, + RunE: deleteKsCmdRun, } func init() { diff --git a/cmd/tk/delete_source_git.go b/cmd/tk/delete_source_git.go index cbb4f092fde811872633257b25f80aa7c2dc69ee..e307905e3b196d5ed93398caffa402a921c5051c 100644 --- a/cmd/tk/delete_source_git.go +++ b/cmd/tk/delete_source_git.go @@ -30,7 +30,10 @@ var deleteSourceGitCmd = &cobra.Command{ Use: "git [name]", Short: "Delete a GitRepository source", Long: "The delete source git command deletes the given GitRepository from the cluster.", - RunE: deleteSourceGitCmdRun, + Example: ` # Delete a Git repository + tk delete source git podinfo +`, + RunE: deleteSourceGitCmdRun, } func init() { diff --git a/cmd/tk/export_kustomization.go b/cmd/tk/export_kustomization.go index 17fc28007306cbfb4e2a6d18137bd74fc31fe3c3..71032de4eab197791081626c90e7cf96431e8ca7 100644 --- a/cmd/tk/export_kustomization.go +++ b/cmd/tk/export_kustomization.go @@ -34,10 +34,10 @@ var exportKsCmd = &cobra.Command{ Short: "Export Kustomization resources in YAML format", Long: "The export kustomization command exports one or all Kustomization resources in YAML format.", Example: ` # Export all Kustomization resources - export kustomization --all > kustomizations.yaml + tk export kustomization --all > kustomizations.yaml # Export a Kustomization - export kustomization my-app > kustomization.yaml + tk export kustomization my-app > kustomization.yaml `, RunE: exportKsCmdRun, } diff --git a/cmd/tk/export_source_git.go b/cmd/tk/export_source_git.go index 6b8dafa84f7ea052ff5055f5dcff0699ecaf6b40..f891748c5c9d4473aab8faadb3e4825b39a31e52 100644 --- a/cmd/tk/export_source_git.go +++ b/cmd/tk/export_source_git.go @@ -34,10 +34,10 @@ var exportSourceGitCmd = &cobra.Command{ Short: "Export GitRepository sources in YAML format", Long: "The export source git command exports on or all GitRepository sources in YAML format.", Example: ` # Export all GitRepository sources - export source git --all > sources.yaml + tk export source git --all > sources.yaml # Export a GitRepository source including the SSH key pair or basic auth credentials - export source git my-private-repo --with-credentials > source.yaml + tk export source git my-private-repo --with-credentials > source.yaml `, RunE: exportSourceGitCmdRun, } @@ -48,7 +48,7 @@ func init() { func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error { if !exportAll && len(args) < 1 { - return fmt.Errorf("kustomization name is required") + return fmt.Errorf("name is required") } ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -103,7 +103,7 @@ func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error { } func exportGit(source sourcev1.GitRepository) error { - gvk := sourcev1.GroupVersion.WithKind("GitRepository") + gvk := sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind) export := sourcev1.GitRepository{ TypeMeta: metav1.TypeMeta{ Kind: gvk.Kind, diff --git a/cmd/tk/get_kustomization.go b/cmd/tk/get_kustomization.go index f53d96006db247881673f7bd6a2f695d7c7495c7..83ad4aacf24cef1ee95e0c7d67fded28241622ea 100644 --- a/cmd/tk/get_kustomization.go +++ b/cmd/tk/get_kustomization.go @@ -28,9 +28,12 @@ import ( var getKsCmd = &cobra.Command{ Use: "kustomizations", Aliases: []string{"ks"}, - Short: "Get Kustomization source statuses", + Short: "Get Kustomization statuses", Long: "The get kustomizations command prints the statuses of the resources.", - RunE: getKsCmdRun, + Example: ` # List all kustomizations and their status + tk get kustomizations +`, + RunE: getKsCmdRun, } func init() { diff --git a/cmd/tk/get_source_git.go b/cmd/tk/get_source_git.go index f490b66da82ac5d07eb687f041c555b517392a86..9492a2c5213f51e19c87fa9d498b73a4f6427fd4 100644 --- a/cmd/tk/get_source_git.go +++ b/cmd/tk/get_source_git.go @@ -29,7 +29,10 @@ var getSourceGitCmd = &cobra.Command{ Use: "git", Short: "Get GitRepository source statuses", Long: "The get sources git command prints the status of the GitRepository sources.", - RunE: getSourceGitCmdRun, + Example: ` # List all Git repositories and their status + tk get sources git +`, + RunE: getSourceGitCmdRun, } func init() { diff --git a/cmd/tk/reconcile_source_helm.go b/cmd/tk/reconcile_source_helm.go index e5fa96625e038df75a86a1f6a1cffd02f9c5a4bf..efffc261e6b57a52476769fb313d20e87f02c613 100644 --- a/cmd/tk/reconcile_source_helm.go +++ b/cmd/tk/reconcile_source_helm.go @@ -34,7 +34,7 @@ var reconcileSourceHelmCmd = &cobra.Command{ Use: "helm [name]", Short: "Reconcile a HelmRepository source", Long: `The reconcile source command triggers a reconciliation of a HelmRepository resource and waits for it to finish.`, - Example: ` # Trigger a helm repo update for an existing source + Example: ` # Trigger a reconciliation for an existing source tk reconcile source helm podinfo `, RunE: syncSourceHelmCmdRun, diff --git a/cmd/tk/resume_helmrelease.go b/cmd/tk/resume_helmrelease.go index ce588b5e21db15ba997cb278e6f05e15d0f14ef6..a98ac07cc28c2c65a166222018f1dfb7beb5b1c7 100644 --- a/cmd/tk/resume_helmrelease.go +++ b/cmd/tk/resume_helmrelease.go @@ -35,6 +35,9 @@ var resumeHrCmd = &cobra.Command{ Short: "Resume a suspended HelmRelease", Long: `The resume command marks a previously suspended HelmRelease resource for reconciliation and waits for it to finish the apply.`, + Example: ` # Resume reconciliation for an existing Helm release + tk resume hr podinfo +`, RunE: resumeHrCmdRun, } diff --git a/cmd/tk/resume_kustomization.go b/cmd/tk/resume_kustomization.go index a1d708a862d899e0e5169a5d401798e98a0249e8..bac1bf8893d71e6d0f0f56f707069d53bd448fee 100644 --- a/cmd/tk/resume_kustomization.go +++ b/cmd/tk/resume_kustomization.go @@ -35,6 +35,9 @@ var resumeKsCmd = &cobra.Command{ Short: "Resume a suspended Kustomization", Long: `The resume command marks a previously suspended Kustomization resource for reconciliation and waits for it to finish the apply.`, + Example: ` # Resume reconciliation for an existing Kustomization + tk resume ks podinfo +`, RunE: resumeKsCmdRun, } diff --git a/cmd/tk/suspend_helmrelease.go b/cmd/tk/suspend_helmrelease.go index eafeab626fcf55de1f4664493d929e1d7671b97f..c7840ef7ff4fae02bac0d5367df6d5c3390d0c54 100644 --- a/cmd/tk/suspend_helmrelease.go +++ b/cmd/tk/suspend_helmrelease.go @@ -31,7 +31,10 @@ var suspendHrCmd = &cobra.Command{ Aliases: []string{"hr"}, Short: "Suspend reconciliation of HelmRelease", Long: "The suspend command disables the reconciliation of a HelmRelease resource.", - RunE: suspendHrCmdRun, + Example: ` # Suspend reconciliation for an existing Helm release + tk suspend hr podinfo +`, + RunE: suspendHrCmdRun, } func init() { diff --git a/cmd/tk/suspend_kustomization.go b/cmd/tk/suspend_kustomization.go index d879a44e504eb6a5a95ea9dc01f9130c8486d276..0a9593f5eb8e67de1605871d3ee62aab236a19be 100644 --- a/cmd/tk/suspend_kustomization.go +++ b/cmd/tk/suspend_kustomization.go @@ -29,7 +29,10 @@ var suspendKsCmd = &cobra.Command{ Aliases: []string{"ks"}, Short: "Suspend reconciliation of Kustomization", Long: "The suspend command disables the reconciliation of a Kustomization resource.", - RunE: suspendKsCmdRun, + Example: ` # Suspend reconciliation for an existing Kustomization + tk suspend ks podinfo +`, + RunE: suspendKsCmdRun, } func init() { diff --git a/cmd/tk/uninstall.go b/cmd/tk/uninstall.go index 7e145c73ead38370661df0f6a6d13b88b220bc72..a92951198a4c3ec2600340c32fc4e1c956ef5561 100644 --- a/cmd/tk/uninstall.go +++ b/cmd/tk/uninstall.go @@ -30,10 +30,10 @@ var uninstallCmd = &cobra.Command{ Short: "Uninstall the toolkit components", Long: "The uninstall command removes the namespace, cluster roles, cluster role bindings and CRDs from the cluster.", Example: ` # Dry-run uninstall of all components - uninstall --dry-run --namespace=gitops-system + tk uninstall --dry-run --namespace=gitops-system # Uninstall all components and delete custom resource definitions - uninstall --crds --namespace=gitops-system + tk uninstall --crds --namespace=gitops-system `, RunE: uninstallCmdRun, }