add ability to specify extraAnnotations and extraLabels
Add ability to specify extra annotations and labels for helm chart
This adds the ability to specify a global set of extra annotations and labels that will be applied to each Kubernetes object deployed by the helm chart. It also allows for specifying extra annotations or labels specifically for the pods or pvc that is deployed as occasionally there are labels/annotations that need to be applied specifically just to these objects for various upstream integrations.
How to use
With the following values files, you can run helm template nebraska . and you can see the labels present on the appropriate objects
extraAnnotations:
hello: world
extraLabels:
flatcar: linux
podLabels:
pod: test
podAnnotations:
pod: annotest
config:
hostFlatcarPackages:
persistence:
enabled: true
annotations:
pvc: test
labels:
another: pvctest
serviceAccount:
create: true
Testing done
Ran helm template with the above updated files and verified that annotations and labels appear as expected
- [X] Changelog entries added in the respective
changelog/directory (user-facing change, bug fix, security fix, update) - [X] Inspected CI output for image differences:
/bootand/usrsize, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.
replaces #655 fixes #654
Great work on this PR! 👍 This addresses #654. The implementation is well-structured and follows Helm best practices overall.
There is only one minor inconsistency that I observed:
The annotation order in charts/nebraska/templates/pvc.yaml is inconsistent with the labels section:
Current (incorrect):
annotations:
{{- with .Values.extraAnnotations }} # Global first
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.config.hostFlatcarPackages.persistence.annotations }} # Specific second
{{- toYaml . | nindent 4 }}
{{- end }}
IMO should be:
annotations:
{{- with .Values.config.hostFlatcarPackages.persistence.annotations }} # Specific first
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }} # Global second
{{- toYaml . | nindent 4 }}
{{- end }}
Please double check if this is consistent with the other files as well.
@ervcz This should be in the right order now. Let me know what you think.
LGTM! There is one last minor issue found by the linter:
charts/nebraska/values.yaml
Error: 37:21 [trailing-spaces] trailing spaces