helm-charts
helm-charts copied to clipboard
policy-controller: fix empty values
Description of the change
This PR fixes the issue where only the key is output when the value is not provided for some fields such as .Values.annotations
and .Values.webhook.podDisruptionBudget.maxUnavailable
.
Existing or Associated Issue(s)
Additional Information
The state in which only the key is output, such as annotations:
, is not syntactically correct in yaml, so lint tools such as kubeconform output an error.
In this PR, the position of the conditional branch has been slightly changed so that if value is not specified, key is also not output.
$ helm install policy-controller sigstore/policy-controller -n policy-controller --dry-run > old.yaml
$ helm install policy-controller ./charts/policy-controller -n policy-controller --dry-run > new.yaml
$ dyff between .\old.yaml .\new.yaml
old.yaml:
...
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: policy-controller-webhook
labels:
helm.sh/chart: policy-controller-0.7.0
app.kubernetes.io/name: policy-controller
app.kubernetes.io/instance: policy-controller
app.kubernetes.io/version: "0.8.2"
app.kubernetes.io/managed-by: Helm
control-plane: policy-controller-webhook
annotations:
spec:
minAvailable: 1
maxUnavailable:
selector:
matchLabels:
app.kubernetes.io/name: policy-controller
app.kubernetes.io/instance: policy-controller
control-plane: policy-controller-webhook
...
new.yaml:
...
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: policy-controller-webhook
labels:
helm.sh/chart: policy-controller-0.7.0
app.kubernetes.io/name: policy-controller
app.kubernetes.io/instance: policy-controller
app.kubernetes.io/version: "0.8.2"
app.kubernetes.io/managed-by: Helm
control-plane: policy-controller-webhook
spec:
minAvailable: 1
selector:
matchLabels:
app.kubernetes.io/name: policy-controller
app.kubernetes.io/instance: policy-controller
control-plane: policy-controller-webhook
...
Output:
metadata (document #6)
- one map entry removed:
annotations:
spec (document #6)
- one map entry removed:
maxUnavailable:
metadata (document #8)
- one map entry removed:
annotations:
metadata (document #19)
- one map entry removed:
annotations:
metadata (document #20)
- one map entry removed:
annotations:
spec.template.spec.containers.policy-controller-webhook (document #21)
- one map entry removed:
args:
Checklist
- [x] Chart version bumped in
Chart.yaml
according to semver. Where applicable, update and bump the versions in any associated umbrella chart - [x] Variables are documented in the
values.yaml
and added to the README.md. The helm-docs utility can be used to generate the necessary content. Usehelm-docs --dry-run
to preview the content. - [x] JSON Schema generated.
- [x] List tests pass for Chart using the Chart Testing tool and the
ct lint
command.