diff --git a/README.md b/README.md index 04f94109..9b053651 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Nelm is production-ready: as the werf deployment engine, it was battle-tested ac - [Advanced resource lifecycle capabilities](#advanced-resource-lifecycle-capabilities) - [Resource state tracking](#resource-state-tracking) - [Printing logs and events during deploy](#printing-logs-and-events-during-deploy) - - [Release planning and two-stage deployment support](#release-planning-and-two-stage-deployment-workflow-support) + - [Release planning and two-stage deployment workflow support](#release-planning-and-two-stage-deployment-workflow-support) - [Encrypted values and encrypted files](#encrypted-values-and-encrypted-files) - [Improved CRD management](#improved-crd-management) - [Usage](#usage) @@ -45,7 +45,6 @@ Nelm is production-ready: as the werf deployment engine, it was battle-tested ac - [`werf.io/weight` annotation](#werfioweight-annotation) - [`werf.io/deploy-dependency-` annotation](#werfiodeploy-dependency-id-annotation) - [`werf.io/delete-dependency-` annotation](#werfiodelete-dependency-id-annotation) - - [`werf.io/ownership` annotation](#werfioownership-annotation) - [`werf.io/deploy-on` annotation](#werfiodeploy-on-annotation) - [`werf.io/delete-policy` annotation](#werfiodelete-policy-annotation) diff --git a/docs/reference.md b/docs/reference.md index f8ac59c9..858b5987 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -6,16 +6,16 @@ - [Chart commands](#chart-commands) - [Secret commands](#secret-commands) - [Dependency commands](#dependency-commands) - - [TypeScript commands](#typescript-commands) - [Repo commands](#repo-commands) + - [TypeScript commands](#typescript-commands) - [Other commands](#other-commands) - [Commands](#commands) - [release install](#release-install) - [release rollback](#release-rollback) - [release plan install](#release-plan-install) - [release uninstall](#release-uninstall) - - [release list](#release-list) - [release history](#release-history) + - [release list](#release-list) - [release get](#release-get) - [release plan show](#release-plan-show) - [chart lint](#chart-lint) @@ -33,26 +33,20 @@ - [chart secret file decrypt](#chart-secret-file-decrypt) - [chart dependency download](#chart-dependency-download) - [chart dependency update](#chart-dependency-update) + - [chart repo add](#chart-repo-add) + - [chart repo remove](#chart-repo-remove) + - [chart repo update](#chart-repo-update) + - [chart repo login](#chart-repo-login) + - [chart repo logout](#chart-repo-logout) - [chart ts init](#chart-ts-init) - [chart ts build](#chart-ts-build) - - [repo add](#repo-add) - - [repo remove](#repo-remove) - - [repo update](#repo-update) - - [repo login](#repo-login) - - [repo logout](#repo-logout) - [completion bash](#completion-bash) - [completion fish](#completion-fish) - [completion powershell](#completion-powershell) - [completion zsh](#completion-zsh) - [version](#version) - [Feature Gates](#feature-gates) - - [NELM_FEAT_REMOTE_CHARTS](#nelm_feat_remote_charts) - [NELM_FEAT_PERIODIC_STACK_TRACES](#nelm_feat_periodic_stack_traces) - - [NELM_FEAT_FIELD_SENSITIVE](#nelm_feat_field_sensitive) - - [NELM_FEAT_PREVIEW_V2](#nelm_feat_preview_v2) - - [NELM_FEAT_CLEAN_NULL_FIELDS](#nelm_feat_clean_null_fields) - - [NELM_FEAT_MORE_DETAILED_EXIT_CODE_FOR_PLAN](#nelm_feat_more_detailed_exit_code_for_plan) - - [NELM_FEAT_RESOURCE_VALIDATION](#nelm_feat_resource_validation) - [NELM_FEAT_TYPESCRIPT](#nelm_feat_typescript) @@ -65,8 +59,8 @@ - [`nelm release rollback`](#release-rollback) — Rollback to a previously deployed release\. - [`nelm release plan install`](#release-plan-install) — Plan a release install to Kubernetes\. - [`nelm release uninstall`](#release-uninstall) — Uninstall a Helm Release from Kubernetes\. -- [`nelm release list`](#release-list) — List all deployed releases\. - [`nelm release history`](#release-history) — Show release history\. +- [`nelm release list`](#release-list) — List all deployed releases\. - [`nelm release get`](#release-get) — Get information about a deployed release\. - [`nelm release plan show`](#release-plan-show) — Show plan artifact planned changes\. @@ -94,19 +88,19 @@ - [`nelm chart dependency download`](#chart-dependency-download) — Download chart dependencies from Chart\.lock\. - [`nelm chart dependency update`](#chart-dependency-update) — Update Chart\.lock and download chart dependencies\. +### Repo commands + +- [`nelm chart repo add`](#chart-repo-add) — Set up a new chart repository\. +- [`nelm chart repo remove`](#chart-repo-remove) — Remove a chart repository\. +- [`nelm chart repo update`](#chart-repo-update) — Update info about available charts for all chart repositories\. +- [`nelm chart repo login`](#chart-repo-login) — Log in to an OCI registry with charts\. +- [`nelm chart repo logout`](#chart-repo-logout) — Log out from an OCI registry with charts\. + ### TypeScript commands - [`nelm chart ts init`](#chart-ts-init) — Initialize the files needed to render manifests using TypeScript\. - [`nelm chart ts build`](#chart-ts-build) — Build TypeScript chart\. -### Repo commands - -- [`nelm repo add`](#repo-add) — Set up a new chart repository\. -- [`nelm repo remove`](#repo-remove) — Remove a chart repository\. -- [`nelm repo update`](#repo-update) — Update info about available charts for all chart repositories\. -- [`nelm repo login`](#repo-login) — Log in to an OCI registry with charts\. -- [`nelm repo logout`](#repo-logout) — Log out from an OCI registry with charts\. - ### Other commands - [`nelm completion bash`](#completion-bash) — Generate the autocompletion script for bash @@ -124,7 +118,7 @@ Deploy a chart to Kubernetes\. **Usage:** ```shell -nelm release install [options...] -n namespace -r release [chart-dir] +nelm release install [options...] -n namespace -r release [chart-dir|chart-repo-name/chart-name|chart-archive|chart-archive-url] ``` **Options:** @@ -133,7 +127,11 @@ nelm release install [options...] -n namespace -r release [chart-dir] Automatically rollback the release on failure\. Var: \$NELM\_RELEASE\_INSTALL\_AUTO\_ROLLBACK -- `--delete-propagation` (default: `"Foreground"`) +- `--chart-version` (default: `""`) + + Choose a remote chart version, otherwise the latest version is used\. Vars: \$NELM\_CHART\_VERSION, \$NELM\_RELEASE\_INSTALL\_CHART\_VERSION + +- `--delete-propagation` (default: `"Background"`) Default delete propagation strategy\. Vars: \$NELM\_DELETE\_PROPAGATION, \$NELM\_RELEASE\_INSTALL\_DELETE\_PROPAGATION @@ -232,10 +230,6 @@ nelm release install [options...] -n namespace -r release [chart-dir] Set new keys in the global context \(\$\), where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_ROOT\_JSON, \$NELM\_RELEASE\_INSTALL\_SET\_ROOT\_JSON -- `--set-runtime-json` (default: `[]`) - - Set new keys in \$\.Runtime, where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_RUNTIME\_JSON, \$NELM\_RELEASE\_INSTALL\_SET\_RUNTIME\_JSON - - `--set-string` (default: `[]`) Set new values, where the key is the value path and the value is the value\. The value will always become a string\. Vars: \$NELM\_SET\_STRING, \$NELM\_RELEASE\_INSTALL\_SET\_STRING @@ -264,6 +258,41 @@ nelm release install [options...] -n namespace -r release [chart-dir] Secret values files paths\. Vars: \$NELM\_SECRET\_VALUES, \$NELM\_RELEASE\_INSTALL\_SECRET\_VALUES +**Resource validation options:** + +- `--local-resource-validation` (default: `false`) + + Do not use external json schema sources\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_INSTALL\_LOCAL\_RESOURCE\_VALIDATION + +- `--no-resource-validation` (default: `false`) + + Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_INSTALL\_NO\_RESOURCE\_VALIDATION + +- `--no-values-schema-validation` (default: `false`) + + Disable values validation against JSON schema\. Vars: \$NELM\_NO\_VALUES\_SCHEMA\_VALIDATION, \$NELM\_RELEASE\_INSTALL\_NO\_VALUES\_SCHEMA\_VALIDATION + +- `--resource-validation-cache-lifetime` (default: `48h0m0s`) + + How long local schema cache will be valid\. Vars: \$NELM\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME, \$NELM\_RELEASE\_INSTALL\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME + +- `--resource-validation-extra-schema` (default: `[]`) + + Extra json schema sources to validate resources \(preferred over default sources\)\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\*, \$NELM\_RELEASE\_INSTALL\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\* + +- `--resource-validation-kube-version` (default: `"1.35.0"`) + + Kubernetes schemas version to use during resource validation\. Vars: \$NELM\_RESOURCE\_VALIDATION\_KUBE\_VERSION, \$NELM\_RELEASE\_INSTALL\_RESOURCE\_VALIDATION\_KUBE\_VERSION + +- `--resource-validation-schema` (default: `[https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json,https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json]`) + + Default json schema sources to validate resources\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SCHEMA\_\*, \$NELM\_RELEASE\_INSTALL\_RESOURCE\_VALIDATION\_SCHEMA\_\* + +- `--resource-validation-skip` (default: `[]`) + + Skip resource validation for resources with specified attributes\. Format: key1=value1,key2=value2\. Supported keys: group, version, kind, name, namespace\. Example: kind=Deployment,name=my\-app\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SKIP, \$NELM\_RELEASE\_INSTALL\_RESOURCE\_VALIDATION\_SKIP + + **Patch options:** - `--annotations` (default: `{}`) @@ -363,6 +392,10 @@ nelm release install [options...] -n namespace -r release [chart-dir] Set URL of chart repo to be used to look for chart\. Vars: \$NELM\_CHART\_REPO\_URL, \$NELM\_RELEASE\_INSTALL\_CHART\_REPO\_URL +- `--docker-config` (default: `"~/.docker"`) + + Docker config directory path\. Vars: \$DOCKER\_CONFIG, \$NELM\_DOCKER\_CONFIG, \$NELM\_RELEASE\_INSTALL\_DOCKER\_CONFIG + - `--insecure-chart-repos` (default: `false`) Allow insecure HTTP connections to chart repository\. Vars: \$NELM\_INSECURE\_CHART\_REPOS, \$NELM\_RELEASE\_INSTALL\_INSECURE\_CHART\_REPOS @@ -375,7 +408,7 @@ nelm release install [options...] -n namespace -r release [chart-dir] Don't verify TLS certificates of chart repository\. Vars: \$NELM\_NO\_VERIFY\_CHART\_REPOS\_TLS, \$NELM\_RELEASE\_INSTALL\_NO\_VERIFY\_CHART\_REPOS\_TLS -- `--oci-chart-repos-creds` (default: `"~/.docker/config.json"`) +- `--oci-chart-repos-creds` (default: `""`) Credentials to access OCI chart repositories\. Vars: \$NELM\_OCI\_CHART\_REPOS\_CREDS, \$NELM\_RELEASE\_INSTALL\_OCI\_CHART\_REPOS\_CREDS @@ -537,7 +570,7 @@ nelm release rollback [options...] -n namespace -r release [revision] **Options:** -- `--delete-propagation` (default: `"Foreground"`) +- `--delete-propagation` (default: `"Background"`) Default delete propagation strategy\. Vars: \$NELM\_DELETE\_PROPAGATION, \$NELM\_RELEASE\_ROLLBACK\_DELETE\_PROPAGATION @@ -582,6 +615,41 @@ nelm release rollback [options...] -n namespace -r release [revision] Fail if not finished in time\. Vars: \$NELM\_TIMEOUT, \$NELM\_RELEASE\_ROLLBACK\_TIMEOUT +**Resource validation options:** + +- `--local-resource-validation` (default: `false`) + + Do not use external json schema sources\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_ROLLBACK\_LOCAL\_RESOURCE\_VALIDATION + +- `--no-resource-validation` (default: `false`) + + Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_ROLLBACK\_NO\_RESOURCE\_VALIDATION + +- `--no-values-schema-validation` (default: `false`) + + Disable values validation against JSON schema\. Vars: \$NELM\_NO\_VALUES\_SCHEMA\_VALIDATION, \$NELM\_RELEASE\_ROLLBACK\_NO\_VALUES\_SCHEMA\_VALIDATION + +- `--resource-validation-cache-lifetime` (default: `48h0m0s`) + + How long local schema cache will be valid\. Vars: \$NELM\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME, \$NELM\_RELEASE\_ROLLBACK\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME + +- `--resource-validation-extra-schema` (default: `[]`) + + Extra json schema sources to validate resources \(preferred over default sources\)\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\*, \$NELM\_RELEASE\_ROLLBACK\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\* + +- `--resource-validation-kube-version` (default: `"1.35.0"`) + + Kubernetes schemas version to use during resource validation\. Vars: \$NELM\_RESOURCE\_VALIDATION\_KUBE\_VERSION, \$NELM\_RELEASE\_ROLLBACK\_RESOURCE\_VALIDATION\_KUBE\_VERSION + +- `--resource-validation-schema` (default: `[https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json,https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json]`) + + Default json schema sources to validate resources\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SCHEMA\_\*, \$NELM\_RELEASE\_ROLLBACK\_RESOURCE\_VALIDATION\_SCHEMA\_\* + +- `--resource-validation-skip` (default: `[]`) + + Skip resource validation for resources with specified attributes\. Format: key1=value1,key2=value2\. Supported keys: group, version, kind, name, namespace\. Example: kind=Deployment,name=my\-app\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SKIP, \$NELM\_RELEASE\_ROLLBACK\_RESOURCE\_VALIDATION\_SKIP + + **Patch options:** - `--runtime-annotations` (default: `{}`) @@ -776,12 +844,16 @@ Plan a release install to Kubernetes\. **Usage:** ```shell -nelm release plan install [options...] -n namespace -r release [chart-dir] +nelm release plan install [options...] -n namespace -r release [chart-dir|chart-repo-name/chart-name|chart-archive|chart-archive-url] ``` **Options:** -- `--delete-propagation` (default: `"Foreground"`) +- `--chart-version` (default: `""`) + + Choose a remote chart version, otherwise the latest version is used\. Vars: \$NELM\_CHART\_VERSION, \$NELM\_RELEASE\_PLAN\_INSTALL\_CHART\_VERSION + +- `--delete-propagation` (default: `"Background"`) Default delete propagation strategy\. Vars: \$NELM\_DELETE\_PROPAGATION, \$NELM\_RELEASE\_PLAN\_INSTALL\_DELETE\_PROPAGATION @@ -791,7 +863,7 @@ nelm release plan install [options...] -n namespace -r release [chart-dir] - `--exit-code` (default: `false`) - Return exit code 0 if no changes, 1 if error, 2 if any changes planned\. Var: \$NELM\_RELEASE\_PLAN\_INSTALL\_EXIT\_CODE + Return exit code 0 if no changes, 1 if error, 2 if resource changes planned, 3 if no resource changes planned, but release still should be installed\. Var: \$NELM\_RELEASE\_PLAN\_INSTALL\_EXIT\_CODE - `--force-adoption` (default: `false`) @@ -884,10 +956,6 @@ nelm release plan install [options...] -n namespace -r release [chart-dir] Set new keys in the global context \(\$\), where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_ROOT\_JSON, \$NELM\_RELEASE\_PLAN\_INSTALL\_SET\_ROOT\_JSON -- `--set-runtime-json` (default: `[]`) - - Set new keys in \$\.Runtime, where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_RUNTIME\_JSON, \$NELM\_RELEASE\_PLAN\_INSTALL\_SET\_RUNTIME\_JSON - - `--set-string` (default: `[]`) Set new values, where the key is the value path and the value is the value\. The value will always become a string\. Vars: \$NELM\_SET\_STRING, \$NELM\_RELEASE\_PLAN\_INSTALL\_SET\_STRING @@ -916,6 +984,41 @@ nelm release plan install [options...] -n namespace -r release [chart-dir] Secret values files paths\. Vars: \$NELM\_SECRET\_VALUES, \$NELM\_RELEASE\_PLAN\_INSTALL\_SECRET\_VALUES +**Resource validation options:** + +- `--local-resource-validation` (default: `false`) + + Do not use external json schema sources\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_PLAN\_INSTALL\_LOCAL\_RESOURCE\_VALIDATION + +- `--no-resource-validation` (default: `false`) + + Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_PLAN\_INSTALL\_NO\_RESOURCE\_VALIDATION + +- `--no-values-schema-validation` (default: `false`) + + Disable values validation against JSON schema\. Vars: \$NELM\_NO\_VALUES\_SCHEMA\_VALIDATION, \$NELM\_RELEASE\_PLAN\_INSTALL\_NO\_VALUES\_SCHEMA\_VALIDATION + +- `--resource-validation-cache-lifetime` (default: `48h0m0s`) + + How long local schema cache will be valid\. Vars: \$NELM\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME, \$NELM\_RELEASE\_PLAN\_INSTALL\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME + +- `--resource-validation-extra-schema` (default: `[]`) + + Extra json schema sources to validate resources \(preferred over default sources\)\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\*, \$NELM\_RELEASE\_PLAN\_INSTALL\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\* + +- `--resource-validation-kube-version` (default: `"1.35.0"`) + + Kubernetes schemas version to use during resource validation\. Vars: \$NELM\_RESOURCE\_VALIDATION\_KUBE\_VERSION, \$NELM\_RELEASE\_PLAN\_INSTALL\_RESOURCE\_VALIDATION\_KUBE\_VERSION + +- `--resource-validation-schema` (default: `[https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json,https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json]`) + + Default json schema sources to validate resources\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SCHEMA\_\*, \$NELM\_RELEASE\_PLAN\_INSTALL\_RESOURCE\_VALIDATION\_SCHEMA\_\* + +- `--resource-validation-skip` (default: `[]`) + + Skip resource validation for resources with specified attributes\. Format: key1=value1,key2=value2\. Supported keys: group, version, kind, name, namespace\. Example: kind=Deployment,name=my\-app\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SKIP, \$NELM\_RELEASE\_PLAN\_INSTALL\_RESOURCE\_VALIDATION\_SKIP + + **Patch options:** - `--annotations` (default: `{}`) @@ -991,6 +1094,10 @@ nelm release plan install [options...] -n namespace -r release [chart-dir] Set URL of chart repo to be used to look for chart\. Vars: \$NELM\_CHART\_REPO\_URL, \$NELM\_RELEASE\_PLAN\_INSTALL\_CHART\_REPO\_URL +- `--docker-config` (default: `"~/.docker"`) + + Docker config directory path\. Vars: \$DOCKER\_CONFIG, \$NELM\_DOCKER\_CONFIG, \$NELM\_RELEASE\_PLAN\_INSTALL\_DOCKER\_CONFIG + - `--insecure-chart-repos` (default: `false`) Allow insecure HTTP connections to chart repository\. Vars: \$NELM\_INSECURE\_CHART\_REPOS, \$NELM\_RELEASE\_PLAN\_INSTALL\_INSECURE\_CHART\_REPOS @@ -1003,7 +1110,7 @@ nelm release plan install [options...] -n namespace -r release [chart-dir] Don't verify TLS certificates of chart repository\. Vars: \$NELM\_NO\_VERIFY\_CHART\_REPOS\_TLS, \$NELM\_RELEASE\_PLAN\_INSTALL\_NO\_VERIFY\_CHART\_REPOS\_TLS -- `--oci-chart-repos-creds` (default: `"~/.docker/config.json"`) +- `--oci-chart-repos-creds` (default: `""`) Credentials to access OCI chart repositories\. Vars: \$NELM\_OCI\_CHART\_REPOS\_CREDS, \$NELM\_RELEASE\_PLAN\_INSTALL\_OCI\_CHART\_REPOS\_CREDS @@ -1165,7 +1272,7 @@ nelm release uninstall [options...] -n namespace -r release Delete the release namespace\. Var: \$NELM\_RELEASE\_UNINSTALL\_DELETE\_NAMESPACE -- `--delete-propagation` (default: `"Foreground"`) +- `--delete-propagation` (default: `"Background"`) Default delete propagation strategy\. Vars: \$NELM\_DELETE\_PROPAGATION, \$NELM\_RELEASE\_UNINSTALL\_DELETE\_PROPAGATION @@ -1370,154 +1477,158 @@ nelm release uninstall [options...] -n namespace -r release The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR -### release list +### release history -List all deployed releases\. +Show release history\. **Usage:** ```shell -nelm release list [options...] [-n namespace] +nelm release history [options...] -n namespace -r release ``` **Options:** - `-n`, `--namespace` (default: `""`) - The release namespace\. Query all namespaces if not specified\. Vars: \$NELM\_NAMESPACE, \$NELM\_RELEASE\_LIST\_NAMESPACE + The release namespace\. Resources with no namespace will be deployed here\. Vars: \$NELM\_NAMESPACE, \$NELM\_RELEASE\_HISTORY\_NAMESPACE + +- `-r`, `--release` (default: `""`) + + The release name\. Must be unique within the release namespace\. Vars: \$NELM\_RELEASE, \$NELM\_RELEASE\_HISTORY\_RELEASE + +- `--revisions-limit` (default: `0`) + + Maximum number of revisions to show\. 0 means no limit\. Vars: \$NELM\_REVISIONS\_LIMIT, \$NELM\_RELEASE\_HISTORY\_REVISIONS\_LIMIT **Kubernetes connection options:** - `--kube-api-server` (default: `""`) - Kubernetes API server address\. Vars: \$NELM\_KUBE\_API\_SERVER, \$NELM\_RELEASE\_LIST\_KUBE\_API\_SERVER + Kubernetes API server address\. Vars: \$NELM\_KUBE\_API\_SERVER, \$NELM\_RELEASE\_HISTORY\_KUBE\_API\_SERVER - `--kube-api-server-tls-name` (default: `""`) - Server name for Kubernetes API TLS validation, if different from the hostname of Kubernetes API server\. Vars: \$NELM\_KUBE\_API\_SERVER\_TLS\_NAME, \$NELM\_RELEASE\_LIST\_KUBE\_API\_SERVER\_TLS\_NAME + Server name for Kubernetes API TLS validation, if different from the hostname of Kubernetes API server\. Vars: \$NELM\_KUBE\_API\_SERVER\_TLS\_NAME, \$NELM\_RELEASE\_HISTORY\_KUBE\_API\_SERVER\_TLS\_NAME - `--kube-auth-password` (default: `""`) - Basic auth password for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PASSWORD, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_PASSWORD + Basic auth password for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PASSWORD, \$NELM\_RELEASE\_HISTORY\_KUBE\_AUTH\_PASSWORD - `--kube-auth-provider` (default: `""`) - Auth provider name for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_PROVIDER + Auth provider name for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER, \$NELM\_RELEASE\_HISTORY\_KUBE\_AUTH\_PROVIDER - `--kube-auth-provider-config` (default: `{}`) - Auth provider config for authentication in Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER\_CONFIG, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_PROVIDER\_CONFIG + Auth provider config for authentication in Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER\_CONFIG, \$NELM\_RELEASE\_HISTORY\_KUBE\_AUTH\_PROVIDER\_CONFIG - `--kube-auth-username` (default: `""`) - Basic auth username for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_USERNAME, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_USERNAME + Basic auth username for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_USERNAME, \$NELM\_RELEASE\_HISTORY\_KUBE\_AUTH\_USERNAME - `--kube-ca` (default: `""`) - Path to Kubernetes API server TLS CA file\. Vars: \$NELM\_KUBE\_CA, \$NELM\_RELEASE\_LIST\_KUBE\_CA + Path to Kubernetes API server TLS CA file\. Vars: \$NELM\_KUBE\_CA, \$NELM\_RELEASE\_HISTORY\_KUBE\_CA - `--kube-ca-data` (default: `""`) - Pass Kubernetes API server TLS CA data\. Vars: \$NELM\_KUBE\_CA\_DATA, \$NELM\_RELEASE\_LIST\_KUBE\_CA\_DATA + Pass Kubernetes API server TLS CA data\. Vars: \$NELM\_KUBE\_CA\_DATA, \$NELM\_RELEASE\_HISTORY\_KUBE\_CA\_DATA - `--kube-cert` (default: `""`) - Path to PEM\-encoded TLS client cert for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_CERT, \$NELM\_RELEASE\_LIST\_KUBE\_CERT + Path to PEM\-encoded TLS client cert for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_CERT, \$NELM\_RELEASE\_HISTORY\_KUBE\_CERT - `--kube-cert-data` (default: `""`) - Pass PEM\-encoded TLS client cert for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_CERT\_DATA, \$NELM\_RELEASE\_LIST\_KUBE\_CERT\_DATA + Pass PEM\-encoded TLS client cert for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_CERT\_DATA, \$NELM\_RELEASE\_HISTORY\_KUBE\_CERT\_DATA - `--kube-config` (default: `[]`) - Kubeconfig path\(s\)\. If multiple specified, their contents are merged\. Vars: \$KUBECONFIG, \$NELM\_KUBE\_CONFIG\_\*, \$NELM\_RELEASE\_LIST\_KUBE\_CONFIG\_\* + Kubeconfig path\(s\)\. If multiple specified, their contents are merged\. Vars: \$KUBECONFIG, \$NELM\_KUBE\_CONFIG\_\*, \$NELM\_RELEASE\_HISTORY\_KUBE\_CONFIG\_\* - `--kube-config-base64` (default: `""`) - Pass Kubeconfig file content encoded as base64\. Vars: \$NELM\_KUBE\_CONFIG\_BASE\_64, \$NELM\_RELEASE\_LIST\_KUBE\_CONFIG\_BASE\_64 + Pass Kubeconfig file content encoded as base64\. Vars: \$NELM\_KUBE\_CONFIG\_BASE\_64, \$NELM\_RELEASE\_HISTORY\_KUBE\_CONFIG\_BASE\_64 - `--kube-context` (default: `""`) - Use specified Kubeconfig context\. Vars: \$NELM\_KUBE\_CONTEXT, \$NELM\_RELEASE\_LIST\_KUBE\_CONTEXT + Use specified Kubeconfig context\. Vars: \$NELM\_KUBE\_CONTEXT, \$NELM\_RELEASE\_HISTORY\_KUBE\_CONTEXT - `--kube-context-cluster` (default: `""`) - Use cluster from Kubeconfig for current context\. Vars: \$NELM\_KUBE\_CONTEXT\_CLUSTER, \$NELM\_RELEASE\_LIST\_KUBE\_CONTEXT\_CLUSTER + Use cluster from Kubeconfig for current context\. Vars: \$NELM\_KUBE\_CONTEXT\_CLUSTER, \$NELM\_RELEASE\_HISTORY\_KUBE\_CONTEXT\_CLUSTER - `--kube-context-user` (default: `""`) - Use user from Kubeconfig for current context\. Vars: \$NELM\_KUBE\_CONTEXT\_USER, \$NELM\_RELEASE\_LIST\_KUBE\_CONTEXT\_USER + Use user from Kubeconfig for current context\. Vars: \$NELM\_KUBE\_CONTEXT\_USER, \$NELM\_RELEASE\_HISTORY\_KUBE\_CONTEXT\_USER - `--kube-impersonate-group` (default: `[]`) - Sets Impersonate\-Group headers when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_GROUP, \$NELM\_RELEASE\_LIST\_KUBE\_IMPERSONATE\_GROUP + Sets Impersonate\-Group headers when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_GROUP, \$NELM\_RELEASE\_HISTORY\_KUBE\_IMPERSONATE\_GROUP - `--kube-impersonate-uid` (default: `""`) - Sets Impersonate\-Uid header when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_UID, \$NELM\_RELEASE\_LIST\_KUBE\_IMPERSONATE\_UID + Sets Impersonate\-Uid header when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_UID, \$NELM\_RELEASE\_HISTORY\_KUBE\_IMPERSONATE\_UID - `--kube-impersonate-user` (default: `""`) - Sets Impersonate\-User header when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_USER, \$NELM\_RELEASE\_LIST\_KUBE\_IMPERSONATE\_USER + Sets Impersonate\-User header when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_USER, \$NELM\_RELEASE\_HISTORY\_KUBE\_IMPERSONATE\_USER - `--kube-key` (default: `""`) - Path to PEM\-encoded TLS client key for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_KEY, \$NELM\_RELEASE\_LIST\_KUBE\_KEY + Path to PEM\-encoded TLS client key for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_KEY, \$NELM\_RELEASE\_HISTORY\_KUBE\_KEY - `--kube-key-data` (default: `""`) - Pass PEM\-encoded TLS client key for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_KEY\_DATA, \$NELM\_RELEASE\_LIST\_KUBE\_KEY\_DATA + Pass PEM\-encoded TLS client key for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_KEY\_DATA, \$NELM\_RELEASE\_HISTORY\_KUBE\_KEY\_DATA - `--kube-proxy-url` (default: `""`) - Proxy URL to use for proxying all requests to Kubernetes API\. Vars: \$NELM\_KUBE\_PROXY\_URL, \$NELM\_RELEASE\_LIST\_KUBE\_PROXY\_URL + Proxy URL to use for proxying all requests to Kubernetes API\. Vars: \$NELM\_KUBE\_PROXY\_URL, \$NELM\_RELEASE\_HISTORY\_KUBE\_PROXY\_URL - `--kube-request-timeout` (default: `0s`) - Timeout for all requests to Kubernetes API\. Vars: \$NELM\_KUBE\_REQUEST\_TIMEOUT, \$NELM\_RELEASE\_LIST\_KUBE\_REQUEST\_TIMEOUT + Timeout for all requests to Kubernetes API\. Vars: \$NELM\_KUBE\_REQUEST\_TIMEOUT, \$NELM\_RELEASE\_HISTORY\_KUBE\_REQUEST\_TIMEOUT - `--kube-token` (default: `""`) - Bearer token for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_TOKEN, \$NELM\_RELEASE\_LIST\_KUBE\_TOKEN + Bearer token for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_TOKEN, \$NELM\_RELEASE\_HISTORY\_KUBE\_TOKEN - `--kube-token-path` (default: `""`) - Path to file with bearer token for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_TOKEN\_PATH, \$NELM\_RELEASE\_LIST\_KUBE\_TOKEN\_PATH + Path to file with bearer token for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_TOKEN\_PATH, \$NELM\_RELEASE\_HISTORY\_KUBE\_TOKEN\_PATH - `--no-verify-kube-tls` (default: `false`) - Don't verify TLS certificates of Kubernetes API\. Vars: \$NELM\_NO\_VERIFY\_KUBE\_TLS, \$NELM\_RELEASE\_LIST\_NO\_VERIFY\_KUBE\_TLS + Don't verify TLS certificates of Kubernetes API\. Vars: \$NELM\_NO\_VERIFY\_KUBE\_TLS, \$NELM\_RELEASE\_HISTORY\_NO\_VERIFY\_KUBE\_TLS **Performance options:** - `--kube-burst-limit` (default: `100`) - Burst limit for requests to Kubernetes\. Vars: \$NELM\_KUBE\_BURST\_LIMIT, \$NELM\_RELEASE\_LIST\_KUBE\_BURST\_LIMIT + Burst limit for requests to Kubernetes\. Vars: \$NELM\_KUBE\_BURST\_LIMIT, \$NELM\_RELEASE\_HISTORY\_KUBE\_BURST\_LIMIT - `--kube-qps-limit` (default: `30`) - Queries Per Second limit for requests to Kubernetes\. Vars: \$NELM\_KUBE\_QPS\_LIMIT, \$NELM\_RELEASE\_LIST\_KUBE\_QPS\_LIMIT - -- `--network-parallelism` (default: `30`) - - Limit of network\-related tasks to run in parallel\. Vars: \$NELM\_NETWORK\_PARALLELISM, \$NELM\_RELEASE\_LIST\_NETWORK\_PARALLELISM + Queries Per Second limit for requests to Kubernetes\. Vars: \$NELM\_KUBE\_QPS\_LIMIT, \$NELM\_RELEASE\_HISTORY\_KUBE\_QPS\_LIMIT **Other options:** - `--color-mode` (default: `"auto"`) - Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_RELEASE\_LIST\_COLOR\_MODE + Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_RELEASE\_HISTORY\_COLOR\_MODE - `--log-level` (default: `"error"`) - Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_RELEASE\_LIST\_LOG\_LEVEL + Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_RELEASE\_HISTORY\_LOG\_LEVEL - `--output-format` (default: `"table"`) - Result output format\. Vars: \$NELM\_OUTPUT\_FORMAT, \$NELM\_RELEASE\_LIST\_OUTPUT\_FORMAT + Result output format\. Vars: \$NELM\_OUTPUT\_FORMAT, \$NELM\_RELEASE\_HISTORY\_OUTPUT\_FORMAT - `--release-storage` (default: `""`) @@ -1532,163 +1643,226 @@ nelm release list [options...] [-n namespace] The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR -### release history - - -History prints historical revisions for a given release\. - -A default maximum of 256 revisions will be returned\. Setting '\-\-max' -configures the maximum length of the revision list returned\. - -The historical release set is printed as a formatted table, e\.g: - - $ helm history angry-bird - REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION - 1 Mon Oct 3 10:15:13 2016 superseded alpine-0.1.0 1.0 Initial install - 2 Mon Oct 3 10:15:13 2016 superseded alpine-0.1.0 1.0 Upgraded successfully - 3 Mon Oct 3 10:15:13 2016 superseded alpine-0.1.0 1.0 Rolled back to 2 - 4 Mon Oct 3 10:15:13 2016 deployed alpine-0.1.0 1.0 Upgraded successfully +### release list +List all deployed releases\. **Usage:** ```shell -nelm release history RELEASE_NAME [flags] +nelm release list [options...] [-n namespace] ``` -**Other options:** +**Options:** -- `--burst-limit` (default: `100`) +- `-n`, `--namespace` (default: `""`) - client\-side default throttling limit + The release namespace\. Query all namespaces if not specified\. Vars: \$NELM\_NAMESPACE, \$NELM\_RELEASE\_LIST\_NAMESPACE -- `--debug` (default: `false`) - enable verbose output +**Kubernetes connection options:** -- `--kube-apiserver` (default: `""`) +- `--kube-api-server` (default: `""`) - the address and the port for the Kubernetes API server + Kubernetes API server address\. Vars: \$NELM\_KUBE\_API\_SERVER, \$NELM\_RELEASE\_LIST\_KUBE\_API\_SERVER -- `--kube-as-group` (default: `[]`) +- `--kube-api-server-tls-name` (default: `""`) - group to impersonate for the operation, this flag can be repeated to specify multiple groups\. + Server name for Kubernetes API TLS validation, if different from the hostname of Kubernetes API server\. Vars: \$NELM\_KUBE\_API\_SERVER\_TLS\_NAME, \$NELM\_RELEASE\_LIST\_KUBE\_API\_SERVER\_TLS\_NAME -- `--kube-as-user` (default: `""`) +- `--kube-auth-password` (default: `""`) - username to impersonate for the operation + Basic auth password for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PASSWORD, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_PASSWORD -- `--kube-ca-file` (default: `""`) +- `--kube-auth-provider` (default: `""`) - the certificate authority file for the Kubernetes API server connection + Auth provider name for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_PROVIDER -- `--kube-context` (default: `""`) +- `--kube-auth-provider-config` (default: `{}`) - name of the kubeconfig context to use + Auth provider config for authentication in Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER\_CONFIG, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_PROVIDER\_CONFIG -- `--kube-insecure-skip-tls-verify` (default: `false`) +- `--kube-auth-username` (default: `""`) - if true, the Kubernetes API server's certificate will not be checked for validity\. This will make your HTTPS connections insecure + Basic auth username for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_USERNAME, \$NELM\_RELEASE\_LIST\_KUBE\_AUTH\_USERNAME -- `--kube-tls-server-name` (default: `""`) +- `--kube-ca` (default: `""`) - server name to use for Kubernetes API server certificate validation\. If it is not provided, the hostname used to contact the server is used + Path to Kubernetes API server TLS CA file\. Vars: \$NELM\_KUBE\_CA, \$NELM\_RELEASE\_LIST\_KUBE\_CA -- `--kube-token` (default: `""`) +- `--kube-ca-data` (default: `""`) - bearer token used for authentication + Pass Kubernetes API server TLS CA data\. Vars: \$NELM\_KUBE\_CA\_DATA, \$NELM\_RELEASE\_LIST\_KUBE\_CA\_DATA -- `--kubeconfig` (default: `""`) +- `--kube-cert` (default: `""`) - path to the kubeconfig file + Path to PEM\-encoded TLS client cert for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_CERT, \$NELM\_RELEASE\_LIST\_KUBE\_CERT -- `--max` (default: `256`) +- `--kube-cert-data` (default: `""`) - maximum number of revision to include in history + Pass PEM\-encoded TLS client cert for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_CERT\_DATA, \$NELM\_RELEASE\_LIST\_KUBE\_CERT\_DATA -- `-n`, `--namespace` (default: `""`) +- `--kube-config` (default: `[]`) - namespace scope for this request + Kubeconfig path\(s\)\. If multiple specified, their contents are merged\. Vars: \$KUBECONFIG, \$NELM\_KUBE\_CONFIG\_\*, \$NELM\_RELEASE\_LIST\_KUBE\_CONFIG\_\* -- `-o`, `--output` (default: `table`) +- `--kube-config-base64` (default: `""`) - prints the output in the specified format\. Allowed values: table, json, yaml + Pass Kubeconfig file content encoded as base64\. Vars: \$NELM\_KUBE\_CONFIG\_BASE\_64, \$NELM\_RELEASE\_LIST\_KUBE\_CONFIG\_BASE\_64 -- `--qps` (default: `0`) +- `--kube-context` (default: `""`) - queries per second used when communicating with the Kubernetes API, not including bursting + Use specified Kubeconfig context\. Vars: \$NELM\_KUBE\_CONTEXT, \$NELM\_RELEASE\_LIST\_KUBE\_CONTEXT -- `--registry-config` (default: `"~/.config/helm/registry/config.json"`) +- `--kube-context-cluster` (default: `""`) - path to the registry config file + Use cluster from Kubeconfig for current context\. Vars: \$NELM\_KUBE\_CONTEXT\_CLUSTER, \$NELM\_RELEASE\_LIST\_KUBE\_CONTEXT\_CLUSTER -- `--repository-cache` (default: `"~/.cache/helm/repository"`) +- `--kube-context-user` (default: `""`) - path to the file containing cached repository indexes + Use user from Kubeconfig for current context\. Vars: \$NELM\_KUBE\_CONTEXT\_USER, \$NELM\_RELEASE\_LIST\_KUBE\_CONTEXT\_USER -- `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) +- `--kube-impersonate-group` (default: `[]`) - path to the file containing repository names and URLs + Sets Impersonate\-Group headers when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_GROUP, \$NELM\_RELEASE\_LIST\_KUBE\_IMPERSONATE\_GROUP +- `--kube-impersonate-uid` (default: `""`) -### release get + Sets Impersonate\-Uid header when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_UID, \$NELM\_RELEASE\_LIST\_KUBE\_IMPERSONATE\_UID -Get information about a deployed release\. +- `--kube-impersonate-user` (default: `""`) -**Usage:** + Sets Impersonate\-User header when authenticating in Kubernetes\. Vars: \$NELM\_KUBE\_IMPERSONATE\_USER, \$NELM\_RELEASE\_LIST\_KUBE\_IMPERSONATE\_USER -```shell -nelm release get [options...] -n namespace -r release [revision] -``` +- `--kube-key` (default: `""`) -**Options:** + Path to PEM\-encoded TLS client key for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_KEY, \$NELM\_RELEASE\_LIST\_KUBE\_KEY -- `-n`, `--namespace` (default: `""`) +- `--kube-key-data` (default: `""`) - The release namespace\. Resources with no namespace will be deployed here\. Vars: \$NELM\_NAMESPACE, \$NELM\_RELEASE\_GET\_NAMESPACE + Pass PEM\-encoded TLS client key for connecting to Kubernetes API\. Vars: \$NELM\_KUBE\_KEY\_DATA, \$NELM\_RELEASE\_LIST\_KUBE\_KEY\_DATA -- `--print-values` (default: `false`) +- `--kube-proxy-url` (default: `""`) - Print Values of the last Helm release\. Var: \$NELM\_RELEASE\_GET\_PRINT\_VALUES + Proxy URL to use for proxying all requests to Kubernetes API\. Vars: \$NELM\_KUBE\_PROXY\_URL, \$NELM\_RELEASE\_LIST\_KUBE\_PROXY\_URL -- `-r`, `--release` (default: `""`) +- `--kube-request-timeout` (default: `0s`) - The release name\. Must be unique within the release namespace\. Vars: \$NELM\_RELEASE, \$NELM\_RELEASE\_GET\_RELEASE + Timeout for all requests to Kubernetes API\. Vars: \$NELM\_KUBE\_REQUEST\_TIMEOUT, \$NELM\_RELEASE\_LIST\_KUBE\_REQUEST\_TIMEOUT +- `--kube-token` (default: `""`) -**Kubernetes connection options:** + Bearer token for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_TOKEN, \$NELM\_RELEASE\_LIST\_KUBE\_TOKEN -- `--kube-api-server` (default: `""`) +- `--kube-token-path` (default: `""`) - Kubernetes API server address\. Vars: \$NELM\_KUBE\_API\_SERVER, \$NELM\_RELEASE\_GET\_KUBE\_API\_SERVER + Path to file with bearer token for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_TOKEN\_PATH, \$NELM\_RELEASE\_LIST\_KUBE\_TOKEN\_PATH -- `--kube-api-server-tls-name` (default: `""`) +- `--no-verify-kube-tls` (default: `false`) - Server name for Kubernetes API TLS validation, if different from the hostname of Kubernetes API server\. Vars: \$NELM\_KUBE\_API\_SERVER\_TLS\_NAME, \$NELM\_RELEASE\_GET\_KUBE\_API\_SERVER\_TLS\_NAME + Don't verify TLS certificates of Kubernetes API\. Vars: \$NELM\_NO\_VERIFY\_KUBE\_TLS, \$NELM\_RELEASE\_LIST\_NO\_VERIFY\_KUBE\_TLS -- `--kube-auth-password` (default: `""`) - Basic auth password for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PASSWORD, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_PASSWORD +**Performance options:** -- `--kube-auth-provider` (default: `""`) +- `--kube-burst-limit` (default: `100`) - Auth provider name for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_PROVIDER + Burst limit for requests to Kubernetes\. Vars: \$NELM\_KUBE\_BURST\_LIMIT, \$NELM\_RELEASE\_LIST\_KUBE\_BURST\_LIMIT -- `--kube-auth-provider-config` (default: `{}`) +- `--kube-qps-limit` (default: `30`) - Auth provider config for authentication in Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER\_CONFIG, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_PROVIDER\_CONFIG + Queries Per Second limit for requests to Kubernetes\. Vars: \$NELM\_KUBE\_QPS\_LIMIT, \$NELM\_RELEASE\_LIST\_KUBE\_QPS\_LIMIT -- `--kube-auth-username` (default: `""`) +- `--network-parallelism` (default: `30`) - Basic auth username for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_USERNAME, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_USERNAME + Limit of network\-related tasks to run in parallel\. Vars: \$NELM\_NETWORK\_PARALLELISM, \$NELM\_RELEASE\_LIST\_NETWORK\_PARALLELISM -- `--kube-ca` (default: `""`) - Path to Kubernetes API server TLS CA file\. Vars: \$NELM\_KUBE\_CA, \$NELM\_RELEASE\_GET\_KUBE\_CA +**Other options:** -- `--kube-ca-data` (default: `""`) +- `--color-mode` (default: `"auto"`) - Pass Kubernetes API server TLS CA data\. Vars: \$NELM\_KUBE\_CA\_DATA, \$NELM\_RELEASE\_GET\_KUBE\_CA\_DATA + Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_RELEASE\_LIST\_COLOR\_MODE + +- `--log-level` (default: `"error"`) + + Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_RELEASE\_LIST\_LOG\_LEVEL + +- `--output-format` (default: `"table"`) + + Result output format\. Vars: \$NELM\_OUTPUT\_FORMAT, \$NELM\_RELEASE\_LIST\_OUTPUT\_FORMAT + +- `--release-storage` (default: `""`) + + How releases should be stored\. Var: \$NELM\_RELEASE\_STORAGE + +- `--release-storage-sql-connection` (default: `""`) + + SQL connection string for MySQL release storage driver\. Var: \$NELM\_RELEASE\_STORAGE\_SQL\_CONNECTION + +- `--temp-dir` (default: `""`) + + The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR + + +### release get + +Get information about a deployed release\. + +**Usage:** + +```shell +nelm release get [options...] -n namespace -r release [revision] +``` + +**Options:** + +- `-n`, `--namespace` (default: `""`) + + The release namespace\. Resources with no namespace will be deployed here\. Vars: \$NELM\_NAMESPACE, \$NELM\_RELEASE\_GET\_NAMESPACE + +- `--print-values` (default: `false`) + + Print Values of the last Helm release\. Var: \$NELM\_RELEASE\_GET\_PRINT\_VALUES + +- `-r`, `--release` (default: `""`) + + The release name\. Must be unique within the release namespace\. Vars: \$NELM\_RELEASE, \$NELM\_RELEASE\_GET\_RELEASE + + +**Kubernetes connection options:** + +- `--kube-api-server` (default: `""`) + + Kubernetes API server address\. Vars: \$NELM\_KUBE\_API\_SERVER, \$NELM\_RELEASE\_GET\_KUBE\_API\_SERVER + +- `--kube-api-server-tls-name` (default: `""`) + + Server name for Kubernetes API TLS validation, if different from the hostname of Kubernetes API server\. Vars: \$NELM\_KUBE\_API\_SERVER\_TLS\_NAME, \$NELM\_RELEASE\_GET\_KUBE\_API\_SERVER\_TLS\_NAME + +- `--kube-auth-password` (default: `""`) + + Basic auth password for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PASSWORD, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_PASSWORD + +- `--kube-auth-provider` (default: `""`) + + Auth provider name for authentication in Kubernetes\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_PROVIDER + +- `--kube-auth-provider-config` (default: `{}`) + + Auth provider config for authentication in Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_PROVIDER\_CONFIG, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_PROVIDER\_CONFIG + +- `--kube-auth-username` (default: `""`) + + Basic auth username for Kubernetes API\. Vars: \$NELM\_KUBE\_AUTH\_USERNAME, \$NELM\_RELEASE\_GET\_KUBE\_AUTH\_USERNAME + +- `--kube-ca` (default: `""`) + + Path to Kubernetes API server TLS CA file\. Vars: \$NELM\_KUBE\_CA, \$NELM\_RELEASE\_GET\_KUBE\_CA + +- `--kube-ca-data` (default: `""`) + + Pass Kubernetes API server TLS CA data\. Vars: \$NELM\_KUBE\_CA\_DATA, \$NELM\_RELEASE\_GET\_KUBE\_CA\_DATA - `--kube-cert` (default: `""`) @@ -1856,12 +2030,16 @@ Lint a chart\. **Usage:** ```shell -nelm chart lint [options...] [chart-dir] +nelm chart lint [options...] [chart-dir|chart-repo-name/chart-name|chart-archive|chart-archive-url] ``` **Options:** -- `--delete-propagation` (default: `"Foreground"`) +- `--chart-version` (default: `""`) + + Choose a remote chart version, otherwise the latest version is used\. Vars: \$NELM\_CHART\_VERSION, \$NELM\_CHART\_LINT\_CHART\_VERSION + +- `--delete-propagation` (default: `"Background"`) Default delete propagation strategy\. Vars: \$NELM\_DELETE\_PROPAGATION, \$NELM\_CHART\_LINT\_DELETE\_PROPAGATION @@ -1873,7 +2051,7 @@ nelm chart lint [options...] [chart-dir] Always adopt resources, even if they belong to a different Helm release\. Vars: \$NELM\_FORCE\_ADOPTION, \$NELM\_CHART\_LINT\_FORCE\_ADOPTION -- `--kube-version` (default: `"1.20.0"`) +- `--kube-version` (default: `"1.36.0"`) Kubernetes version stub for non\-remote mode\. Var: \$NELM\_CHART\_LINT\_KUBE\_VERSION @@ -1932,10 +2110,6 @@ nelm chart lint [options...] [chart-dir] Set new keys in the global context \(\$\), where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_ROOT\_JSON, \$NELM\_CHART\_LINT\_SET\_ROOT\_JSON -- `--set-runtime-json` (default: `[]`) - - Set new keys in \$\.Runtime, where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_RUNTIME\_JSON, \$NELM\_CHART\_LINT\_SET\_RUNTIME\_JSON - - `--set-string` (default: `[]`) Set new values, where the key is the value path and the value is the value\. The value will always become a string\. Vars: \$NELM\_SET\_STRING, \$NELM\_CHART\_LINT\_SET\_STRING @@ -1964,6 +2138,41 @@ nelm chart lint [options...] [chart-dir] Secret values files paths\. Vars: \$NELM\_SECRET\_VALUES, \$NELM\_CHART\_LINT\_SECRET\_VALUES +**Resource validation options:** + +- `--local-resource-validation` (default: `false`) + + Do not use external json schema sources\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_CHART\_LINT\_LOCAL\_RESOURCE\_VALIDATION + +- `--no-resource-validation` (default: `false`) + + Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_CHART\_LINT\_NO\_RESOURCE\_VALIDATION + +- `--no-values-schema-validation` (default: `false`) + + Disable values validation against JSON schema\. Vars: \$NELM\_NO\_VALUES\_SCHEMA\_VALIDATION, \$NELM\_CHART\_LINT\_NO\_VALUES\_SCHEMA\_VALIDATION + +- `--resource-validation-cache-lifetime` (default: `48h0m0s`) + + How long local schema cache will be valid\. Vars: \$NELM\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME, \$NELM\_CHART\_LINT\_RESOURCE\_VALIDATION\_CACHE\_LIFETIME + +- `--resource-validation-extra-schema` (default: `[]`) + + Extra json schema sources to validate resources \(preferred over default sources\)\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\*, \$NELM\_CHART\_LINT\_RESOURCE\_VALIDATION\_EXTRA\_SCHEMA\_\* + +- `--resource-validation-kube-version` (default: `"1.35.0"`) + + Kubernetes schemas version to use during resource validation\. Vars: \$NELM\_RESOURCE\_VALIDATION\_KUBE\_VERSION, \$NELM\_CHART\_LINT\_RESOURCE\_VALIDATION\_KUBE\_VERSION + +- `--resource-validation-schema` (default: `[https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json,https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json]`) + + Default json schema sources to validate resources\. Must be a valid go template defining a http\(s\) URL, or an absolute path on local file system\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SCHEMA\_\*, \$NELM\_CHART\_LINT\_RESOURCE\_VALIDATION\_SCHEMA\_\* + +- `--resource-validation-skip` (default: `[]`) + + Skip resource validation for resources with specified attributes\. Format: key1=value1,key2=value2\. Supported keys: group, version, kind, name, namespace\. Example: kind=Deployment,name=my\-app\. Vars: \$NELM\_RESOURCE\_VALIDATION\_SKIP, \$NELM\_CHART\_LINT\_RESOURCE\_VALIDATION\_SKIP + + **Patch options:** - `--annotations` (default: `{}`) @@ -2039,6 +2248,10 @@ nelm chart lint [options...] [chart-dir] Set URL of chart repo to be used to look for chart\. Vars: \$NELM\_CHART\_REPO\_URL, \$NELM\_CHART\_LINT\_CHART\_REPO\_URL +- `--docker-config` (default: `"~/.docker"`) + + Docker config directory path\. Vars: \$DOCKER\_CONFIG, \$NELM\_DOCKER\_CONFIG, \$NELM\_CHART\_LINT\_DOCKER\_CONFIG + - `--insecure-chart-repos` (default: `false`) Allow insecure HTTP connections to chart repository\. Vars: \$NELM\_INSECURE\_CHART\_REPOS, \$NELM\_CHART\_LINT\_INSECURE\_CHART\_REPOS @@ -2051,7 +2264,7 @@ nelm chart lint [options...] [chart-dir] Don't verify TLS certificates of chart repository\. Vars: \$NELM\_NO\_VERIFY\_CHART\_REPOS\_TLS, \$NELM\_CHART\_LINT\_NO\_VERIFY\_CHART\_REPOS\_TLS -- `--oci-chart-repos-creds` (default: `"~/.docker/config.json"`) +- `--oci-chart-repos-creds` (default: `""`) Credentials to access OCI chart repositories\. Vars: \$NELM\_OCI\_CHART\_REPOS\_CREDS, \$NELM\_CHART\_LINT\_OCI\_CHART\_REPOS\_CREDS @@ -2204,16 +2417,20 @@ Render a chart\. **Usage:** ```shell -nelm chart render [options...] [chart-dir] +nelm chart render [options...] [chart-dir|chart-repo-name/chart-name|chart-archive|chart-archive-url] ``` **Options:** +- `--chart-version` (default: `""`) + + Choose a remote chart version, otherwise the latest version is used\. Vars: \$NELM\_CHART\_VERSION, \$NELM\_CHART\_RENDER\_CHART\_VERSION + - `--extra-apiversions` (default: `[]`) Extra Kubernetes API versions passed to \$\.Capabilities\.APIVersions\. Vars: \$NELM\_EXTRA\_APIVERSIONS\_\*, \$NELM\_CHART\_RENDER\_EXTRA\_APIVERSIONS\_\* -- `--kube-version` (default: `"1.20.0"`) +- `--kube-version` (default: `"1.36.0"`) Kubernetes version stub for non\-remote mode\. Var: \$NELM\_CHART\_RENDER\_KUBE\_VERSION @@ -2280,10 +2497,6 @@ nelm chart render [options...] [chart-dir] Set new keys in the global context \(\$\), where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_ROOT\_JSON, \$NELM\_CHART\_RENDER\_SET\_ROOT\_JSON -- `--set-runtime-json` (default: `[]`) - - Set new keys in \$\.Runtime, where the key is the value path and the value is JSON\. This is meant to be generated inside the program, so use \-\-set\-json instead, unless you know what you are doing\. Vars: \$NELM\_SET\_RUNTIME\_JSON, \$NELM\_CHART\_RENDER\_SET\_RUNTIME\_JSON - - `--set-string` (default: `[]`) Set new values, where the key is the value path and the value is the value\. The value will always become a string\. Vars: \$NELM\_SET\_STRING, \$NELM\_CHART\_RENDER\_SET\_STRING @@ -2376,6 +2589,10 @@ nelm chart render [options...] [chart-dir] Set URL of chart repo to be used to look for chart\. Vars: \$NELM\_CHART\_REPO\_URL, \$NELM\_CHART\_RENDER\_CHART\_REPO\_URL +- `--docker-config` (default: `"~/.docker"`) + + Docker config directory path\. Vars: \$DOCKER\_CONFIG, \$NELM\_DOCKER\_CONFIG, \$NELM\_CHART\_RENDER\_DOCKER\_CONFIG + - `--insecure-chart-repos` (default: `false`) Allow insecure HTTP connections to chart repository\. Vars: \$NELM\_INSECURE\_CHART\_REPOS, \$NELM\_CHART\_RENDER\_INSECURE\_CHART\_REPOS @@ -2388,7 +2605,7 @@ nelm chart render [options...] [chart-dir] Don't verify TLS certificates of chart repository\. Vars: \$NELM\_NO\_VERIFY\_CHART\_REPOS\_TLS, \$NELM\_CHART\_RENDER\_NO\_VERIFY\_CHART\_REPOS\_TLS -- `--oci-chart-repos-creds` (default: `"~/.docker/config.json"`) +- `--oci-chart-repos-creds` (default: `""`) Credentials to access OCI chart repositories\. Vars: \$NELM\_OCI\_CHART\_REPOS\_CREDS, \$NELM\_CHART\_RENDER\_OCI\_CHART\_REPOS\_CREDS @@ -2571,6 +2788,18 @@ nelm chart download [chart URL | repo/chartname] [...] [flags] identify HTTPS client using this SSL certificate file +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -2665,7 +2894,7 @@ nelm chart download [chart URL | repo/chartname] [...] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) @@ -2721,6 +2950,18 @@ nelm chart upload [archive] [remote] [flags] identify registry client using this SSL certificate file +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -2773,6 +3014,10 @@ nelm chart upload [archive] [remote] [flags] namespace scope for this request +- `--password` (default: `""`) + + chart repository password where to locate the requested chart + - `--plain-http` (default: `false`) use insecure HTTP connections for the chart upload @@ -2787,12 +3032,16 @@ nelm chart upload [archive] [remote] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) path to the file containing repository names and URLs +- `--username` (default: `""`) + + chart repository username where to locate the requested chart + ### chart pack @@ -2835,6 +3084,26 @@ nelm chart pack [CHART_PATH] [...] [flags] client\-side default throttling limit +- `--ca-file` (default: `""`) + + verify certificates of HTTPS\-enabled servers using this CA bundle + +- `--cert-file` (default: `""`) + + identify HTTPS client using this SSL certificate file + +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -2847,10 +3116,18 @@ nelm chart pack [CHART_PATH] [...] [flags] location to write the chart\. +- `--insecure-skip-tls-verify` (default: `false`) + + skip tls certificate checks for the chart download + - `--key` (default: `""`) name of the key to use when signing\. Used if \-\-sign is true +- `--key-file` (default: `""`) + + identify HTTPS client using this SSL key file + - `--keyring` (default: `"~/.gnupg/pubring.gpg"`) location of a public keyring @@ -2899,6 +3176,14 @@ nelm chart pack [CHART_PATH] [...] [flags] location of a file which contains the passphrase for the signing key\. Use "\-" in order to read from stdin\. +- `--password` (default: `""`) + + chart repository password where to locate the requested chart + +- `--plain-http` (default: `false`) + + use insecure HTTP connections for the chart download + - `--qps` (default: `0`) queries per second used when communicating with the Kubernetes API, not including bursting @@ -2909,7 +3194,7 @@ nelm chart pack [CHART_PATH] [...] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) @@ -2919,6 +3204,10 @@ nelm chart pack [CHART_PATH] [...] [flags] use a PGP private key to sign this package +- `--username` (default: `""`) + + chart repository username where to locate the requested chart + - `--version` (default: `""`) set the version on the chart to this semver version @@ -3213,10 +3502,38 @@ nelm chart dependency download CHART [flags] client\-side default throttling limit +- `--ca-file` (default: `""`) + + verify certificates of HTTPS\-enabled servers using this CA bundle + +- `--cert-file` (default: `""`) + + identify HTTPS client using this SSL certificate file + +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output +- `--insecure-skip-tls-verify` (default: `false`) + + skip tls certificate checks for the chart download + +- `--key-file` (default: `""`) + + identify HTTPS client using this SSL key file + - `--keyring` (default: `"~/.gnupg/pubring.gpg"`) keyring containing public keys @@ -3261,6 +3578,14 @@ nelm chart dependency download CHART [flags] namespace scope for this request +- `--password` (default: `""`) + + chart repository password where to locate the requested chart + +- `--plain-http` (default: `false`) + + use insecure HTTP connections for the chart download + - `--qps` (default: `0`) queries per second used when communicating with the Kubernetes API, not including bursting @@ -3271,7 +3596,7 @@ nelm chart dependency download CHART [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) @@ -3281,6 +3606,10 @@ nelm chart dependency download CHART [flags] do not refresh the local repository cache +- `--username` (default: `""`) + + chart repository username where to locate the requested chart + - `--verify` (default: `false`) verify the packages against signatures @@ -3315,10 +3644,38 @@ nelm chart dependency update CHART [flags] client\-side default throttling limit +- `--ca-file` (default: `""`) + + verify certificates of HTTPS\-enabled servers using this CA bundle + +- `--cert-file` (default: `""`) + + identify HTTPS client using this SSL certificate file + +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output +- `--insecure-skip-tls-verify` (default: `false`) + + skip tls certificate checks for the chart download + +- `--key-file` (default: `""`) + + identify HTTPS client using this SSL key file + - `--keyring` (default: `"~/.gnupg/pubring.gpg"`) keyring containing public keys @@ -3363,6 +3720,14 @@ nelm chart dependency update CHART [flags] namespace scope for this request +- `--password` (default: `""`) + + chart repository password where to locate the requested chart + +- `--plain-http` (default: `false`) + + use insecure HTTP connections for the chart download + - `--qps` (default: `0`) queries per second used when communicating with the Kubernetes API, not including bursting @@ -3373,7 +3738,7 @@ nelm chart dependency update CHART [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) @@ -3383,83 +3748,23 @@ nelm chart dependency update CHART [flags] do not refresh the local repository cache -- `--verify` (default: `false`) - - verify the packages against signatures - - -### chart ts init - -Initialize the files needed to render manifests using TypeScript\. If PATH is not specified, uses the current directory\. - -**Usage:** - -```shell -nelm chart ts init [PATH] -``` - -**TypeScript options:** - -- `--deno-binary-path` (default: `""`) - - Path to the Deno binary to use instead of auto\-downloading\. Vars: \$NELM\_DENO\_BINARY\_PATH, \$NELM\_CHART\_TS\_INIT\_DENO\_BINARY\_PATH - - -**Other options:** - -- `--color-mode` (default: `"auto"`) - - Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_CHART\_TS\_INIT\_COLOR\_MODE - -- `--log-level` (default: `"info"`) - - Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_CHART\_TS\_INIT\_LOG\_LEVEL - -- `--temp-dir` (default: `""`) - - The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR - - -### chart ts build - -Build TypeScript chart in the specified directory\. If PATH is not specified, uses the current directory\. - -**Usage:** - -```shell -nelm chart ts build [PATH] -``` - -**TypeScript options:** - -- `--deno-binary-path` (default: `""`) - - Path to the Deno binary to use instead of auto\-downloading\. Vars: \$NELM\_DENO\_BINARY\_PATH, \$NELM\_CHART\_TS\_BUILD\_DENO\_BINARY\_PATH - - -**Other options:** - -- `--color-mode` (default: `"auto"`) - - Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_CHART\_TS\_BUILD\_COLOR\_MODE - -- `--log-level` (default: `"info"`) +- `--username` (default: `""`) - Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_CHART\_TS\_BUILD\_LOG\_LEVEL + chart repository username where to locate the requested chart -- `--temp-dir` (default: `""`) +- `--verify` (default: `false`) - The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR + verify the packages against signatures -### repo add +### chart repo add Set up a new chart repository\. **Usage:** ```shell -nelm repo add [NAME] [URL] [flags] +nelm chart repo add [NAME] [URL] [flags] ``` **Other options:** @@ -3480,6 +3785,18 @@ nelm repo add [NAME] [URL] [flags] identify HTTPS client using this SSL certificate file +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -3536,10 +3853,6 @@ nelm repo add [NAME] [URL] [flags] namespace scope for this request -- `--no-update` (default: `false`) - - Ignored\. Formerly, it would disabled forced updates\. It is deprecated by force\-update\. - - `--pass-credentials` (default: `false`) pass credentials to all domains @@ -3562,25 +3875,29 @@ nelm repo add [NAME] [URL] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) path to the file containing repository names and URLs +- `--timeout` (default: `2m0s`) + + time to wait for the index file download to complete + - `--username` (default: `""`) chart repository username -### repo remove +### chart repo remove Remove a chart repository\. **Usage:** ```shell -nelm repo remove [REPO1 [REPO2 ...]] [flags] +nelm chart repo remove [REPO1 [REPO2 ...]] [flags] ``` **Other options:** @@ -3589,6 +3906,18 @@ nelm repo remove [REPO1 [REPO2 ...]] [flags] client\-side default throttling limit +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -3643,21 +3972,21 @@ nelm repo remove [REPO1 [REPO2 ...]] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) path to the file containing repository names and URLs -### repo update +### chart repo update Update info about available charts for all chart repositories\. **Usage:** ```shell -nelm repo update [REPO1 [REPO2 ...]] [flags] +nelm chart repo update [REPO1 [REPO2 ...]] [flags] ``` **Other options:** @@ -3666,13 +3995,21 @@ nelm repo update [REPO1 [REPO2 ...]] [flags] client\-side default throttling limit -- `--debug` (default: `false`) +- `--color` (default: `"auto"`) - enable verbose output + use colored output \(never, auto, always\) -- `--fail-on-repo-update-fail` (default: `false`) +- `--colour` (default: `"auto"`) - update fails if any of the repository updates fail + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + +- `--debug` (default: `false`) + + enable verbose output - `--kube-apiserver` (default: `""`) @@ -3724,21 +4061,25 @@ nelm repo update [REPO1 [REPO2 ...]] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) path to the file containing repository names and URLs +- `--timeout` (default: `2m0s`) -### repo login + time to wait for the index file download to complete + + +### chart repo login Log in to an OCI registry with charts\. **Usage:** ```shell -nelm repo login [host] [flags] +nelm chart repo login [host] [flags] ``` **Other options:** @@ -3755,6 +4096,18 @@ nelm repo login [host] [flags] identify registry client using this SSL certificate file +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -3815,6 +4168,10 @@ nelm repo login [host] [flags] read password or identity token from stdin +- `--plain-http` (default: `false`) + + use insecure HTTP connections for the chart upload + - `--qps` (default: `0`) queries per second used when communicating with the Kubernetes API, not including bursting @@ -3825,7 +4182,7 @@ nelm repo login [host] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) @@ -3836,14 +4193,14 @@ nelm repo login [host] [flags] registry username -### repo logout +### chart repo logout Log out from an OCI registry with charts\. **Usage:** ```shell -nelm repo logout [host] [flags] +nelm chart repo logout [host] [flags] ``` **Other options:** @@ -3852,6 +4209,18 @@ nelm repo logout [host] [flags] client\-side default throttling limit +- `--color` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--colour` (default: `"auto"`) + + use colored output \(never, auto, always\) + +- `--content-cache` (default: `"~/.cache/helm/content"`) + + path to the directory containing cached content \(e\.g\. charts\) + - `--debug` (default: `false`) enable verbose output @@ -3906,13 +4275,77 @@ nelm repo logout [host] [flags] - `--repository-cache` (default: `"~/.cache/helm/repository"`) - path to the file containing cached repository indexes + path to the directory containing cached repository indexes - `--repository-config` (default: `"~/.config/helm/repositories.yaml"`) path to the file containing repository names and URLs +### chart ts init + +Initialize the files needed to render manifests using TypeScript\. If PATH is not specified, uses the current directory\. + +**Usage:** + +```shell +nelm chart ts init [PATH] +``` + +**TypeScript options:** + +- `--deno-binary-path` (default: `""`) + + Path to the Deno binary to use instead of auto\-downloading\. Vars: \$NELM\_DENO\_BINARY\_PATH, \$NELM\_CHART\_TS\_INIT\_DENO\_BINARY\_PATH + + +**Other options:** + +- `--color-mode` (default: `"auto"`) + + Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_CHART\_TS\_INIT\_COLOR\_MODE + +- `--log-level` (default: `"info"`) + + Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_CHART\_TS\_INIT\_LOG\_LEVEL + +- `--temp-dir` (default: `""`) + + The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR + + +### chart ts build + +Build TypeScript chart in the specified directory\. If PATH is not specified, uses the current directory\. + +**Usage:** + +```shell +nelm chart ts build [PATH] +``` + +**TypeScript options:** + +- `--deno-binary-path` (default: `""`) + + Path to the Deno binary to use instead of auto\-downloading\. Vars: \$NELM\_DENO\_BINARY\_PATH, \$NELM\_CHART\_TS\_BUILD\_DENO\_BINARY\_PATH + + +**Other options:** + +- `--color-mode` (default: `"auto"`) + + Color mode for logs\. Allowed: auto, off, on\. Vars: \$NELM\_COLOR\_MODE, \$NELM\_CHART\_TS\_BUILD\_COLOR\_MODE + +- `--log-level` (default: `"info"`) + + Set log level\. Allowed: silent, error, warning, info, debug, trace\. Vars: \$NELM\_LOG\_LEVEL, \$NELM\_CHART\_TS\_BUILD\_LOG\_LEVEL + +- `--temp-dir` (default: `""`) + + The directory for temporary files\. By default, create a new directory in the default system directory for temporary files\. Var: \$NELM\_TEMP\_DIR + + ### completion bash Generate the autocompletion script for the bash shell\. @@ -4075,48 +4508,12 @@ nelm version [options...] Feature gates are experimental features that can be enabled via environment variables. -### NELM_FEAT_REMOTE_CHARTS - -**Default:** `false` - -Allow not only local, but also remote charts as an argument to cli commands\. Also adds the "\-\-chart\-version" option - ### NELM_FEAT_PERIODIC_STACK_TRACES **Default:** `false` Print stack traces periodically to help with debugging deadlocks and other issues -### NELM_FEAT_FIELD_SENSITIVE - -**Default:** `false` - -Enable JSONPath\-based selective sensitive field redaction - -### NELM_FEAT_PREVIEW_V2 - -**Default:** `false` - -Activate all feature gates that will be enabled by default in Nelm v2 - -### NELM_FEAT_CLEAN_NULL_FIELDS - -**Default:** `false` - -Enable cleaning of null fields from resource manifests for better Helm chart compatibility - -### NELM_FEAT_MORE_DETAILED_EXIT_CODE_FOR_PLAN - -**Default:** `false` - -Make the "plan" command with the flag "\-\-exit\-code" return an exit code 3 instead of 2 when no resource changes, but still must install the release - -### NELM_FEAT_RESOURCE_VALIDATION - -**Default:** `false` - -Validate chart resources against specific Kubernetes resources' schemas - ### NELM_FEAT_TYPESCRIPT **Default:** `false` diff --git a/pkg/helm/pkg/cmd/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz b/pkg/helm/pkg/cmd/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz index 21e50abe..44960187 100644 Binary files a/pkg/helm/pkg/cmd/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz and b/pkg/helm/pkg/cmd/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz differ diff --git a/pkg/helm/pkg/storage/driver/cfgmaps.go b/pkg/helm/pkg/storage/driver/cfgmaps.go index bc930bc8..cb323dfb 100644 --- a/pkg/helm/pkg/storage/driver/cfgmaps.go +++ b/pkg/helm/pkg/storage/driver/cfgmaps.go @@ -230,6 +230,31 @@ func (cfgmaps *ConfigMaps) Update(key string, rel release.Releaser) error { return nil } +// UpdateLabels merges the given custom labels into the ConfigMap holding the +// release named by key without creating a new revision. System labels in the +// map are ignored to avoid corrupting release metadata. +func (cfgmaps *ConfigMaps) UpdateLabels(key string, lbls map[string]string) error { + obj, err := cfgmaps.impl.Get(context.Background(), key, metav1.GetOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + return ErrReleaseNotFound + } + return fmt.Errorf("update labels: failed to get %q: %w", key, err) + } + + if obj.Labels == nil { + obj.Labels = map[string]string{} + } + for k, v := range filterSystemLabels(lbls) { + obj.Labels[k] = v + } + + if _, err := cfgmaps.impl.Update(context.Background(), obj, metav1.UpdateOptions{}); err != nil { + return fmt.Errorf("update labels: failed to update %q: %w", key, err) + } + return nil +} + // Delete deletes the ConfigMap holding the release named by key. func (cfgmaps *ConfigMaps) Delete(key string) (rls release.Releaser, err error) { // fetch the release to check existence diff --git a/pkg/helm/pkg/storage/driver/driver.go b/pkg/helm/pkg/storage/driver/driver.go index 0dc8a0ac..41171105 100644 --- a/pkg/helm/pkg/storage/driver/driver.go +++ b/pkg/helm/pkg/storage/driver/driver.go @@ -92,6 +92,15 @@ type Queryor interface { Query(labels map[string]string) ([]release.Releaser, error) } +// LabelUpdator is the interface that wraps the UpdateLabels method. +// +// UpdateLabels merges the given custom labels into the stored release named by +// key without creating a new revision, or returns ErrReleaseNotFound if the +// release does not exist. Existing labels not present in the map are preserved. +type LabelUpdator interface { + UpdateLabels(key string, labels map[string]string) error +} + // Driver is the interface composed of Creator, Updator, Deletor, and Queryor // interfaces. It defines the behavior for storing, updating, deleted, // and retrieving Helm releases from some underlying storage mechanism, @@ -101,6 +110,7 @@ type Driver interface { Updator Deletor Queryor + LabelUpdator Name() string } diff --git a/pkg/helm/pkg/storage/driver/memory.go b/pkg/helm/pkg/storage/driver/memory.go index 586771e1..a2927603 100644 --- a/pkg/helm/pkg/storage/driver/memory.go +++ b/pkg/helm/pkg/storage/driver/memory.go @@ -210,6 +210,37 @@ func (mem *Memory) Update(key string, rel release.Releaser) error { return ErrReleaseNotFound } +// UpdateLabels merges the given custom labels into the stored release named by +// key without creating a new revision. Returns ErrReleaseNotFound if the +// release does not exist. +func (mem *Memory) UpdateLabels(key string, lbls map[string]string) error { + defer unlock(mem.wlock()) + + keyWithoutPrefix := strings.TrimPrefix(key, "sh.helm.release.v1.") + elems := strings.Split(keyWithoutPrefix, ".v") + if len(elems) != 2 { + return ErrInvalidKey + } + name := elems[0] + + recs, ok := mem.cache[mem.namespace][name] + if !ok { + return ErrReleaseNotFound + } + r := recs.Get(key) + if r == nil { + return ErrReleaseNotFound + } + + if r.rls.Labels == nil { + r.rls.Labels = map[string]string{} + } + for k, v := range filterSystemLabels(lbls) { + r.rls.Labels[k] = v + } + return nil +} + // Delete deletes a release or returns ErrReleaseNotFound. func (mem *Memory) Delete(key string) (release.Releaser, error) { defer unlock(mem.wlock()) diff --git a/pkg/helm/pkg/storage/driver/memory_test.go b/pkg/helm/pkg/storage/driver/memory_test.go index 1dbdcce1..d7073c60 100644 --- a/pkg/helm/pkg/storage/driver/memory_test.go +++ b/pkg/helm/pkg/storage/driver/memory_test.go @@ -238,6 +238,35 @@ func TestMemoryUpdate(t *testing.T) { } } +func TestMemoryUpdateLabels(t *testing.T) { + ts := tsFixtureMemory(t) + ts.SetNamespace("default") + + key := testKey("rls-a", 4) + if err := ts.UpdateLabels(key, map[string]string{"owned-by": "operator", "key1": "changed"}); err != nil { + t.Fatalf("Failed to update labels: %s\n", err) + } + + r, err := ts.Get(key) + if err != nil { + t.Fatalf("Failed to get: %s\n", err) + } + rls := r.(*rspb.Release) + if rls.Labels["owned-by"] != "operator" { + t.Fatalf("Expected merged label owned-by=operator, got %q\n", rls.Labels["owned-by"]) + } + if rls.Labels["key1"] != "changed" { + t.Fatalf("Expected overwritten label key1=changed, got %q\n", rls.Labels["key1"]) + } + if rls.Labels["key2"] != "val2" { + t.Fatalf("Expected preserved label key2=val2, got %q\n", rls.Labels["key2"]) + } + + if err := ts.UpdateLabels(testKey("rls-missing", 1), map[string]string{"owned-by": "operator"}); err != ErrReleaseNotFound { + t.Fatalf("Expected ErrReleaseNotFound, got %v\n", err) + } +} + func TestMemoryDelete(t *testing.T) { var tests = []struct { desc string diff --git a/pkg/helm/pkg/storage/driver/secrets.go b/pkg/helm/pkg/storage/driver/secrets.go index fc7d8f1b..46201b16 100644 --- a/pkg/helm/pkg/storage/driver/secrets.go +++ b/pkg/helm/pkg/storage/driver/secrets.go @@ -217,6 +217,31 @@ func (secrets *Secrets) Update(key string, rel release.Releaser) error { return nil } +// UpdateLabels merges the given custom labels into the Secret holding the +// release named by key without creating a new revision. System labels in the +// map are ignored to avoid corrupting release metadata. +func (secrets *Secrets) UpdateLabels(key string, lbls map[string]string) error { + obj, err := secrets.impl.Get(context.Background(), key, metav1.GetOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + return ErrReleaseNotFound + } + return fmt.Errorf("update labels: failed to get %q: %w", key, err) + } + + if obj.Labels == nil { + obj.Labels = map[string]string{} + } + for k, v := range filterSystemLabels(lbls) { + obj.Labels[k] = v + } + + if _, err := secrets.impl.Update(context.Background(), obj, metav1.UpdateOptions{}); err != nil { + return fmt.Errorf("update labels: failed to update %q: %w", key, err) + } + return nil +} + // Delete deletes the Secret holding the release named by key. func (secrets *Secrets) Delete(key string) (rls release.Releaser, err error) { // fetch the release to check existence diff --git a/pkg/helm/pkg/storage/driver/secrets_test.go b/pkg/helm/pkg/storage/driver/secrets_test.go index 92ef233c..a9fd3179 100644 --- a/pkg/helm/pkg/storage/driver/secrets_test.go +++ b/pkg/helm/pkg/storage/driver/secrets_test.go @@ -226,6 +226,40 @@ func TestSecretUpdate(t *testing.T) { } } +func TestSecretUpdateLabels(t *testing.T) { + vers := 1 + name := "smug-pigeon" + namespace := "default" + key := testKey(name, vers) + rel := releaseStub(name, vers, namespace, common.StatusDeployed) + + secrets := newTestFixtureSecrets(t, []*rspb.Release{rel}...) + + if err := secrets.UpdateLabels(key, map[string]string{"owned-by": "operator", "key1": "changed"}); err != nil { + t.Fatalf("Failed to update labels: %s", err) + } + + goti, err := secrets.Get(key) + if err != nil { + t.Fatalf("Failed to get release with key %q: %s", key, err) + } + got := convertReleaserToV1(t, goti) + + if got.Labels["owned-by"] != "operator" { + t.Errorf("Expected merged label owned-by=operator, got %q", got.Labels["owned-by"]) + } + if got.Labels["key1"] != "changed" { + t.Errorf("Expected overwritten label key1=changed, got %q", got.Labels["key1"]) + } + if got.Labels["key2"] != "val2" { + t.Errorf("Expected preserved label key2=val2, got %q", got.Labels["key2"]) + } + + if err := secrets.UpdateLabels("nonexistent", map[string]string{"owned-by": "operator"}); !errors.Is(err, ErrReleaseNotFound) { + t.Fatalf("Expected ErrReleaseNotFound, got %v", err) + } +} + func TestSecretDelete(t *testing.T) { vers := 1 name := "smug-pigeon" diff --git a/pkg/helm/pkg/storage/driver/sql.go b/pkg/helm/pkg/storage/driver/sql.go index 5e73a756..68b522cf 100644 --- a/pkg/helm/pkg/storage/driver/sql.go +++ b/pkg/helm/pkg/storage/driver/sql.go @@ -618,6 +618,79 @@ func (s *SQL) Update(key string, rel release.Releaser) error { return nil } +// UpdateLabels merges the given custom labels into the release named by key +// without creating a new revision, by upserting rows in the custom labels +// table. System labels in the map are ignored to avoid corrupting release +// metadata. Returns ErrReleaseNotFound if the release does not exist. +func (s *SQL) UpdateLabels(key string, lbls map[string]string) error { + selectQuery, selectArgs, err := s.statementBuilder. + Select(sqlReleaseTableKeyColumn). + From(sqlReleaseTableName). + Where(sq.Eq{sqlReleaseTableKeyColumn: key}). + Where(sq.Eq{sqlReleaseTableNamespaceColumn: s.namespace}). + ToSql() + if err != nil { + s.Logger().Debug("failed to build select query", slog.Any("error", err)) + return err + } + + transaction, err := s.db.Beginx() + if err != nil { + s.Logger().Debug("failed to start SQL transaction", slog.Any("error", err)) + return fmt.Errorf("error beginning transaction: %v", err) + } + + var existingKey string + if err := transaction.Get(&existingKey, selectQuery, selectArgs...); err != nil { + transaction.Rollback() + return ErrReleaseNotFound + } + + for k, v := range filterSystemLabels(lbls) { + deleteQuery, deleteArgs, err := s.statementBuilder. + Delete(sqlCustomLabelsTableName). + Where(sq.Eq{ + sqlCustomLabelsTableReleaseKeyColumn: key, + sqlCustomLabelsTableReleaseNamespaceColumn: s.namespace, + sqlCustomLabelsTableKeyColumn: k, + }). + ToSql() + if err != nil { + transaction.Rollback() + s.Logger().Debug("failed to build delete labels query", slog.Any("error", err)) + return err + } + if _, err := transaction.Exec(deleteQuery, deleteArgs...); err != nil { + transaction.Rollback() + s.Logger().Debug("failed to delete existing label", slog.Any("error", err)) + return err + } + + insertQuery, insertArgs, err := s.statementBuilder. + Insert(sqlCustomLabelsTableName). + Columns( + sqlCustomLabelsTableReleaseKeyColumn, + sqlCustomLabelsTableReleaseNamespaceColumn, + sqlCustomLabelsTableKeyColumn, + sqlCustomLabelsTableValueColumn, + ). + Values(key, s.namespace, k, v). + ToSql() + if err != nil { + transaction.Rollback() + s.Logger().Debug("failed to build insert labels query", slog.Any("error", err)) + return err + } + if _, err := transaction.Exec(insertQuery, insertArgs...); err != nil { + transaction.Rollback() + s.Logger().Debug("failed to insert label", slog.Any("error", err)) + return err + } + } + + return transaction.Commit() +} + // Delete deletes a release or returns ErrReleaseNotFound. func (s *SQL) Delete(key string) (release.Releaser, error) { transaction, err := s.db.Beginx() diff --git a/pkg/helm/pkg/storage/driver/sql_test.go b/pkg/helm/pkg/storage/driver/sql_test.go index b6a0a12a..22991ef5 100644 --- a/pkg/helm/pkg/storage/driver/sql_test.go +++ b/pkg/helm/pkg/storage/driver/sql_test.go @@ -359,6 +359,61 @@ func TestSqlUpdate(t *testing.T) { } } +func TestSqlUpdateLabels(t *testing.T) { + vers := 1 + name := "smug-pigeon" + namespace := "default" + key := testKey(name, vers) + + sqlDriver, mock := newTestFixtureSQL(t) + + selectQuery := fmt.Sprintf( + "SELECT %s FROM %s WHERE %s = $1 AND %s = $2", + sqlReleaseTableKeyColumn, + sqlReleaseTableName, + sqlReleaseTableKeyColumn, + sqlReleaseTableNamespaceColumn, + ) + deleteQuery := fmt.Sprintf( + "DELETE FROM %s WHERE %s = $1 AND %s = $2 AND %s = $3", + sqlCustomLabelsTableName, + sqlCustomLabelsTableKeyColumn, + sqlCustomLabelsTableReleaseKeyColumn, + sqlCustomLabelsTableReleaseNamespaceColumn, + ) + insertQuery := fmt.Sprintf( + "INSERT INTO %s (%s,%s,%s,%s) VALUES ($1,$2,$3,$4)", + sqlCustomLabelsTableName, + sqlCustomLabelsTableReleaseKeyColumn, + sqlCustomLabelsTableReleaseNamespaceColumn, + sqlCustomLabelsTableKeyColumn, + sqlCustomLabelsTableValueColumn, + ) + + mock.ExpectBegin() + mock. + ExpectQuery(regexp.QuoteMeta(selectQuery)). + WithArgs(key, namespace). + WillReturnRows(sqlmock.NewRows([]string{sqlReleaseTableKeyColumn}).AddRow(key)) + mock. + ExpectExec(regexp.QuoteMeta(deleteQuery)). + WithArgs("owned-by", key, namespace). + WillReturnResult(sqlmock.NewResult(0, 0)) + mock. + ExpectExec(regexp.QuoteMeta(insertQuery)). + WithArgs(key, namespace, "owned-by", "operator"). + WillReturnResult(sqlmock.NewResult(1, 1)) + mock.ExpectCommit() + + if err := sqlDriver.UpdateLabels(key, map[string]string{"owned-by": "operator"}); err != nil { + t.Fatalf("failed to update labels with key %s: %v", key, err) + } + + if err := mock.ExpectationsWereMet(); err != nil { + t.Errorf("sql expectations weren't met: %v", err) + } +} + func TestSqlQuery(t *testing.T) { // Reflect actual use cases in ../storage.go labelSetUnknown := map[string]string{ diff --git a/pkg/helm/pkg/storage/storage.go b/pkg/helm/pkg/storage/storage.go index e089cb81..7410a4a2 100644 --- a/pkg/helm/pkg/storage/storage.go +++ b/pkg/helm/pkg/storage/storage.go @@ -89,6 +89,14 @@ func (s *Storage) Update(rls release.Releaser) error { return s.Driver.Update(makeKey(rac.Name(), rac.Version()), rls) } +// UpdateLabels merges the given custom labels into the stored release identified +// by name and version without creating a new revision. An error is returned if +// the storage backend fails or the release does not exist. +func (s *Storage) UpdateLabels(name string, version int, labels map[string]string) error { + s.Logger().Debug("updating release labels", "key", makeKey(name, version)) + return s.Driver.UpdateLabels(makeKey(name, version), labels) +} + // Delete deletes the release from storage. An error is returned if // the storage backend fails to delete the release or if the release // does not exist. diff --git a/pkg/helm/pkg/storage/storage_test.go b/pkg/helm/pkg/storage/storage_test.go index 23781c5c..2efd6389 100644 --- a/pkg/helm/pkg/storage/storage_test.go +++ b/pkg/helm/pkg/storage/storage_test.go @@ -307,6 +307,9 @@ func (d *MaxHistoryMockDriver) Create(key string, rls release.Releaser) error { func (d *MaxHistoryMockDriver) Update(key string, rls release.Releaser) error { return d.Driver.Update(key, rls) } +func (d *MaxHistoryMockDriver) UpdateLabels(key string, labels map[string]string) error { + return d.Driver.UpdateLabels(key, labels) +} func (d *MaxHistoryMockDriver) Delete(_ string) (release.Releaser, error) { return nil, errMaxHistoryMockDriverSomethingHappened } diff --git a/pkg/release/release_storage.go b/pkg/release/release_storage.go index cb67a0e9..7951e1ed 100644 --- a/pkg/release/release_storage.go +++ b/pkg/release/release_storage.go @@ -26,6 +26,7 @@ var _ ReleaseStorager = (*storageAdapter)(nil) type ReleaseStorager interface { Create(rls helmrel.Accessor) error Update(rls helmrel.Accessor) error + UpdateLabels(name string, version int, labels map[string]string) error Delete(name string, version int) (helmrel.Accessor, error) Query(labels map[string]string) ([]helmrel.Accessor, error) } @@ -99,6 +100,14 @@ func (a *storageAdapter) Update(rls helmrel.Accessor) error { return nil } +func (a *storageAdapter) UpdateLabels(name string, version int, labels map[string]string) error { + if err := a.storage.UpdateLabels(name, version, labels); err != nil { + return fmt.Errorf("update release labels: %w", err) + } + + return nil +} + type ReleaseStorageOptions struct { HistoryLimit int SQLConnection string