hazelcast / charts

Hazelcast Official Helm Chart Repository
Apache License 2.0
36 stars 86 forks source link

[CN-993] Common label and annotation parameters for all deployed objects #388

Closed semihbkgr closed 9 months ago

semihbkgr commented 10 months ago

provides a way to add common labels and annotations to all objects deployed by the chart

# Labels to add to all deployed objects
commonLabels: {}

# Annotations to add to all deployed objects
commonAnnotations: {}

Implementation Notes

To merge two maps, we are using merge function. eg:

merge nil .Values.mancenter.ingress.annotations .Values.commonAnnotations

The reason why we are passing nil to the first parameter of merge function is to keep the maps immutable.

$newdict := merge $dest $source1 $source2

The first parameter of the merge function is destination. The new merging entries are put into the destination map.

https://helm.sh/docs/chart_template_guide/function_list/#merge-mustmerge

We are passing nil as a destination map in order to not modify any of our existing map. In this way, the maps generated from the values.yaml and user args are not modified during the render process of templates.