Make app.kubernetes.io labels optional
This set of labels is not mandatory and introduces additional complexity in upgrading existing Helm charts as labels field is immutable and corresponding resources has to be deleted before upgrade. The default behavior won't be changed and labels won't be added only if explicitly disabled via values. Change-Id: I2bc1cdefdc2819100195502003d69fd8576554ab Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This commit is contained in:
parent
6b985e51be
commit
f37dd907f9
@ -37,18 +37,22 @@ return: |
|
||||
{{- $envAll := index . 0 -}}
|
||||
{{- $application := index . 1 -}}
|
||||
{{- $component := index . 2 -}}
|
||||
{{- $podValues := $envAll.Values.pod | default dict -}}
|
||||
{{- $labels := $podValues.labels | default dict -}}
|
||||
release_group: {{ $envAll.Values.release_group | default $envAll.Release.Name }}
|
||||
application: {{ $application }}
|
||||
component: {{ $component }}
|
||||
{{- if or $labels.include_app_kubernetes_io (not (hasKey $labels "include_app_kubernetes_io")) }}
|
||||
app.kubernetes.io/name: {{ $application }}
|
||||
app.kubernetes.io/component: {{ $component }}
|
||||
app.kubernetes.io/instance: {{ $envAll.Values.release_group | default $envAll.Release.Name }}
|
||||
{{- if ($envAll.Values.pod).labels }}
|
||||
{{- if hasKey $envAll.Values.pod.labels $component }}
|
||||
{{ index $envAll.Values.pod "labels" $component | toYaml }}
|
||||
{{- end -}}
|
||||
{{- if hasKey $envAll.Values.pod.labels "default" }}
|
||||
{{ $envAll.Values.pod.labels.default | toYaml }}
|
||||
{{- if $labels }}
|
||||
{{- if hasKey $labels $component }}
|
||||
{{ index $podValues "labels" $component | toYaml }}
|
||||
{{- end -}}
|
||||
{{- if hasKey $labels "default" }}
|
||||
{{ $labels.default | toYaml }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user