diff --git a/README.md b/README.md index 06a919c..ebb9922 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Install ``` -helm plugin install https://github.com/kubepro/helm-plugin-osh.git +helm plugin install https://opendev.org/openstack/openstack-helm-plugin.git ``` # Uninstall @@ -11,25 +11,38 @@ helm plugin uninstall osh # Usage ## get-values-overrides +Get Helm values overrides for a set of features. + +If 3 features are passed, then the overrides will be looked +up in the following order: + ``` -helm osh get-values-overrides [-d/--download] [-p/--path ] [-u/--url ] ... +//values_overrides/.yaml +//values_overrides/.yaml +//values_overrides/-.yaml +//values_overrides/.yaml +//values_overrides/-.yaml +//values_overrides/-.yaml +//values_overrides/--.yaml ``` -- `-d/--download` download overrides if not found locally in the path -- `-u/--url ` the base url from where the plugin tries to download overrides. The resulting url is `//values_overrides/` -- `-p/--path ` the path where the plugin tries to find override files and puts downloaded override files. The resulting path is `//values_overrides/` -- `` the chart name for which the plugin tries to find overrides -- `` features in the beginning of the list are of higher priority +If you think of the features as bits of a binary number where is +the least significant bit, then the order corresponds to all numbers from 001 +to 111 in binary representation. -If there are 3 features in the list, then the order of override candidates will be like follows: +Usage: ``` -//values_overrides/.yaml -//values_overrides/.yaml -//values_overrides/-.yaml -//values_overrides/.yaml -//values_overrides/-.yaml -//values_overrides/-.yaml -//values_overrides/--.yaml + get-values-overrides ... [flags] +``` + +Flags: +``` + -c, --chart string Chart to get the overrides for + -d, --download Download the overrides from the internet if not found in the path (default: false) + -h, --help help for get-values-overrides + -p, --path string Path to the overrides (default "$(pwd)") + -s, --subchart string Subchart to get the overrides for + -u, --url string Base url to download overrides (default "https://opendev.org/openstack/openstack-helm/raw/branch/master") ``` ## wait-for-pods diff --git a/get-values-overrides b/get-values-overrides index b3b05ab..f20dce9 100755 Binary files a/get-values-overrides and b/get-values-overrides differ diff --git a/main.go b/main.go index 367ac93..88ae721 100644 --- a/main.go +++ b/main.go @@ -39,7 +39,23 @@ func newRootCommand() *cobra.Command { cwd, _ = os.Getwd() rootCmd := &cobra.Command{ - Use: "get-values-overrides", + Use: "get-values-overrides ...", + Long: `Get Helm values overrides for a set of features. + +If 3 features are passed, then the overrides will be looked +up in the following order: + +//values_overrides/.yaml +//values_overrides/.yaml +//values_overrides/-.yaml +//values_overrides/.yaml +//values_overrides/-.yaml +//values_overrides/-.yaml +//values_overrides/--.yaml + +If you think of the features as bits of a binary number where is +the least significant bit, then the order corresponds to all numbers from 001 +to 111 in binary representation.`, Run: func(cmd *cobra.Command, args []string) { features := args[0:] if len(features) == 0 { @@ -49,7 +65,7 @@ func newRootCommand() *cobra.Command { fmt.Fprintf(os.Stderr, "Base URL: %s\nBase path: %s\n", baseUrl, basePath) fmt.Fprintf(os.Stderr, "Chart: %s\n", chart) if subchart != "" { - fmt.Fprintf(os.Stderr, " Subchart: %s\n", subchart) + fmt.Fprintf(os.Stderr, "Subchart: %s\n", subchart) } fmt.Fprintf(os.Stderr, "Features: %s\n", strings.Join(features, " ")) overrideCandidates := generateOverrideCandidates(features) @@ -58,7 +74,7 @@ func newRootCommand() *cobra.Command { fmt.Println(strings.Join(overrideArgs, " ")) }, } - rootCmd.Flags().BoolVarP(&download, "download", "d", false, "Download the overrides from the internet if does not exist in the path (default: false)") + rootCmd.Flags().BoolVarP(&download, "download", "d", false, "Download the overrides from the internet if not found in the path (default: false)") rootCmd.Flags().StringVarP(&baseUrl, "url", "u", DefaultBaseUrl, "Base url to download overrides") rootCmd.Flags().StringVarP(&basePath, "path", "p", cwd, "Path to the overrides") rootCmd.Flags().StringVarP(&subchart, "subchart", "s", "", "Subchart to get the overrides for")