Add a NamespaceLabels field to the Install action and a --namespace-labels
flag on both 'helm install' and 'helm upgrade --install'. When set, the
provided labels replace the default name=<namespace> label that is applied
to newly created namespaces. When not set the existing default behaviour is
preserved.
Three tests cover the new behaviour:
- default label is applied when NamespaceLabels is nil
- custom labels replace the default when NamespaceLabels is set
- labels are ignored entirely when CreateNamespace is false
RecordedBuildInputs is added to FailingKubeClient so tests can inspect the
YAML passed to Build without wiring up a full HTTP interceptor.
Closes: inspired by https://github.com/helm/helm/pull/13200
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
f.BoolVar(&client.CreateNamespace,"create-namespace",false,"create the release namespace if not present")
f.StringToStringVar(&client.NamespaceLabels,"namespace-labels",nil,"labels to apply to the namespace when --create-namespace is set. Comma-separated key=value pairs. When not set the default label name=<namespace> is applied.")
f.BoolVar(&client.ForceReplace,"force-replace",false,"force resource updates by replacement")
f.BoolVar(&createNamespace,"create-namespace",false,"if --install is set, create the release namespace if not present")
f.StringToStringVar(&namespaceLabels,"namespace-labels",nil,"labels to apply to the namespace when --create-namespace is set. Comma-separated key=value pairs. When not set the default label name=<namespace> is applied.")
f.BoolVarP(&client.Install,"install","i",false,"if a release by this name doesn't already exist, run an install")
f.BoolVar(&client.Devel,"devel",false,"use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored")
f.BoolVar(&client.HideSecret,"hide-secret",false,"hide Kubernetes Secrets when also using the --dry-run flag")