Skip to content

Commit 5ecab77

Browse files
authored
clarify create command flags (#437)
Signed-off-by: Manabu McCloskey <[email protected]>
1 parent c90dbd8 commit 5ecab77

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

pkg/cmd/create/root.go

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ import (
1717
ctrl "sigs.k8s.io/controller-runtime"
1818
)
1919

20+
const (
21+
recreateClusterUsage = "Delete cluster first if it already exists."
22+
buildNameUsage = "Name for build (Prefix for kind cluster name, pod names, etc)."
23+
kubeVersionUsage = "Version of the kind kubernetes cluster to create."
24+
extraPortsMappingUsage = "List of extra ports to expose on the docker container and kubernetes cluster as nodePort " +
25+
"(e.g. \"22:32222,9090:39090,etc\")."
26+
kindConfigPathUsage = "Path of the kind config file to be used instead of the default."
27+
hostUsage = "Host name to access resources in this cluster."
28+
ingressHostUsage = "Host name used by ingresses. Useful when you have another proxy in front of ingress-nginx that idpbuilder provisions."
29+
protocolUsage = "Protocol to use to access web UIs. http or https."
30+
portUsage = "Port number to use to access web UIs."
31+
pathRoutingUsage = "When set to true, web UIs are exposed under single domain name. " +
32+
"e.g. \"https://cnoe.localtest.me/argocd\" instead of \"https://argocd.cnoe.localtest.me\""
33+
extraPackagesUsage = "Paths to locations containing custom packages"
34+
packageCustomizationFilesUsage = "Name of the package and the path to file to customize the core packages with. " +
35+
"valid package names are: argocd, nginx, and gitea. e.g. argocd:/tmp/argocd.yaml"
36+
noExitUsage = "When set, idpbuilder will not exit after all packages are synced. Useful for continuously syncing local directories."
37+
)
38+
2039
var (
2140
// Flags
2241
recreateCluster bool
@@ -44,22 +63,24 @@ var CreateCmd = &cobra.Command{
4463

4564
func init() {
4665
// cluster related flags
47-
CreateCmd.PersistentFlags().BoolVar(&recreateCluster, "recreate", false, "Delete cluster first if it already exists.")
48-
CreateCmd.PersistentFlags().StringVar(&buildName, "build-name", "localdev", "Name for build (Prefix for kind cluster name, pod names, etc).")
49-
CreateCmd.PersistentFlags().StringVar(&kubeVersion, "kube-version", "v1.30.3", "Version of the kind kubernetes cluster to create.")
50-
CreateCmd.PersistentFlags().StringVar(&extraPortsMapping, "extra-ports", "", "List of extra ports to expose on the docker container and kubernetes cluster as nodePort (e.g. \"22:32222,9090:39090,etc\").")
51-
CreateCmd.PersistentFlags().StringVar(&kindConfigPath, "kind-config", "", "Path of the kind config file to be used instead of the default.")
66+
CreateCmd.PersistentFlags().BoolVar(&recreateCluster, "recreate", false, recreateClusterUsage)
67+
CreateCmd.PersistentFlags().StringVar(&buildName, "build-name", "localdev", buildNameUsage)
68+
CreateCmd.PersistentFlags().MarkDeprecated("build-name", "use --name instead.")
69+
CreateCmd.PersistentFlags().StringVar(&buildName, "name", "localdev", buildNameUsage)
70+
CreateCmd.PersistentFlags().StringVar(&kubeVersion, "kube-version", "v1.30.3", kubeVersionUsage)
71+
CreateCmd.PersistentFlags().StringVar(&extraPortsMapping, "extra-ports", "", extraPortsMappingUsage)
72+
CreateCmd.PersistentFlags().StringVar(&kindConfigPath, "kind-config", "", kindConfigPathUsage)
5273

5374
// in-cluster resources related flags
54-
CreateCmd.PersistentFlags().StringVar(&host, "host", globals.DefaultHostName, "Host name to access resources in this cluster.")
55-
CreateCmd.PersistentFlags().StringVar(&ingressHost, "ingress-host-name", "", "Host name used by ingresses. Useful when you have another proxy in front of ingress-nginx that idpbuilder provisions.")
56-
CreateCmd.PersistentFlags().StringVar(&protocol, "protocol", "https", "Protocol to use to access web UIs. http or https.")
57-
CreateCmd.PersistentFlags().StringVar(&port, "port", "8443", "Port number under which idpBuilder tools are accessible.")
58-
CreateCmd.PersistentFlags().BoolVar(&pathRouting, "use-path-routing", false, "When set to true, web UIs are exposed under single domain name.")
59-
CreateCmd.Flags().StringSliceVarP(&extraPackages, "package", "p", []string{}, "Paths to locations containing custom packages")
60-
CreateCmd.Flags().StringSliceVarP(&packageCustomizationFiles, "package-custom-file", "c", []string{}, "Name of the package and the path to file to customize the package with. e.g. argocd:/tmp/argocd.yaml")
75+
CreateCmd.PersistentFlags().StringVar(&host, "host", globals.DefaultHostName, hostUsage)
76+
CreateCmd.PersistentFlags().StringVar(&ingressHost, "ingress-host-name", "", ingressHostUsage)
77+
CreateCmd.PersistentFlags().StringVar(&protocol, "protocol", "https", protocolUsage)
78+
CreateCmd.PersistentFlags().StringVar(&port, "port", "8443", portUsage)
79+
CreateCmd.PersistentFlags().BoolVar(&pathRouting, "use-path-routing", false, pathRoutingUsage)
80+
CreateCmd.Flags().StringSliceVarP(&extraPackages, "package", "p", []string{}, extraPackagesUsage)
81+
CreateCmd.Flags().StringSliceVarP(&packageCustomizationFiles, "package-custom-file", "c", []string{}, packageCustomizationFilesUsage)
6182
// idpbuilder related flags
62-
CreateCmd.Flags().BoolVarP(&noExit, "no-exit", "n", true, "When set, idpbuilder will not exit after all packages are synced. Useful for continuously syncing local directories.")
83+
CreateCmd.Flags().BoolVarP(&noExit, "no-exit", "n", true, noExitUsage)
6384
}
6485

6586
func preCreateE(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)