Improve get-values-overrides help
Change-Id: I59b763b6109ad7af63c3d5484a03773915b23493
This commit is contained in:
parent
611f0cefdc
commit
5b1bcd99ab
43
README.md
43
README.md
@ -1,6 +1,6 @@
|
|||||||
# Install
|
# Install
|
||||||
```
|
```
|
||||||
helm plugin install https://github.com/kubepro/helm-plugin-osh.git
|
helm plugin install https://opendev.org/openstack/openstack-helm-plugin.git
|
||||||
```
|
```
|
||||||
|
|
||||||
# Uninstall
|
# Uninstall
|
||||||
@ -11,25 +11,38 @@ helm plugin uninstall osh
|
|||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
## get-values-overrides
|
## 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 <lookup_path>] [-u/--url <base_url>] <chart> <feature-1> <feature-2> ...
|
<overrides_path>/<chart>/values_overrides/<feature-3>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-2>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-2>-<feature-3>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>-<feature-3>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>-<feature-2>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>-<feature-2>-<feature-3>.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
- `-d/--download` download overrides if not found locally in the path
|
If you think of the features as bits of a binary number where <feature3> is
|
||||||
- `-u/--url <base_url>` the base url from where the plugin tries to download overrides. The resulting url is `<base_url>/<chart>/values_overrides/<override_candidate>`
|
the least significant bit, then the order corresponds to all numbers from 001
|
||||||
- `-p/--path <lookup_path>` the path where the plugin tries to find override files and puts downloaded override files. The resulting path is `<lookup_path>/<chart>/values_overrides/<override_candidate>`
|
to 111 in binary representation.
|
||||||
- `<chart>` the chart name for which the plugin tries to find overrides
|
|
||||||
- `<feature-X>` features in the beginning of the list are of higher priority
|
|
||||||
|
|
||||||
If there are 3 features in the list, then the order of override candidates will be like follows:
|
Usage:
|
||||||
```
|
```
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-3>.yaml
|
get-values-overrides <feature1> <feature2> ... [flags]
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-2>.yaml
|
```
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-2>-<feature-3>.yaml
|
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-1>.yaml
|
Flags:
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-1>-<feature-3>.yaml
|
```
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-1>-<feature-2>.yaml
|
-c, --chart string Chart to get the overrides for
|
||||||
<lookup_path>/<chart>/values_overrides/<feature-1>-<feature-2>-<feature-3>.yaml
|
-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
|
## wait-for-pods
|
||||||
|
Binary file not shown.
22
main.go
22
main.go
@ -39,7 +39,23 @@ func newRootCommand() *cobra.Command {
|
|||||||
|
|
||||||
cwd, _ = os.Getwd()
|
cwd, _ = os.Getwd()
|
||||||
rootCmd := &cobra.Command{
|
rootCmd := &cobra.Command{
|
||||||
Use: "get-values-overrides",
|
Use: "get-values-overrides <feature1> <feature2> ...",
|
||||||
|
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:
|
||||||
|
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-3>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-2>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-2>-<feature-3>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>-<feature-3>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>-<feature-2>.yaml
|
||||||
|
<overrides_path>/<chart>/values_overrides/<feature-1>-<feature-2>-<feature-3>.yaml
|
||||||
|
|
||||||
|
If you think of the features as bits of a binary number where <feature3> 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) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
features := args[0:]
|
features := args[0:]
|
||||||
if len(features) == 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, "Base URL: %s\nBase path: %s\n", baseUrl, basePath)
|
||||||
fmt.Fprintf(os.Stderr, "Chart: %s\n", chart)
|
fmt.Fprintf(os.Stderr, "Chart: %s\n", chart)
|
||||||
if subchart != "" {
|
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, " "))
|
fmt.Fprintf(os.Stderr, "Features: %s\n", strings.Join(features, " "))
|
||||||
overrideCandidates := generateOverrideCandidates(features)
|
overrideCandidates := generateOverrideCandidates(features)
|
||||||
@ -58,7 +74,7 @@ func newRootCommand() *cobra.Command {
|
|||||||
fmt.Println(strings.Join(overrideArgs, " "))
|
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(&baseUrl, "url", "u", DefaultBaseUrl, "Base url to download overrides")
|
||||||
rootCmd.Flags().StringVarP(&basePath, "path", "p", cwd, "Path to the overrides")
|
rootCmd.Flags().StringVarP(&basePath, "path", "p", cwd, "Path to the overrides")
|
||||||
rootCmd.Flags().StringVarP(&subchart, "subchart", "s", "", "Subchart to get the overrides for")
|
rootCmd.Flags().StringVarP(&subchart, "subchart", "s", "", "Subchart to get the overrides for")
|
||||||
|
Loading…
Reference in New Issue
Block a user