Skip to content

Commit

Permalink
Merge pull request #17975 from jakesmith/HPCC-30711-global-annotations
Browse files Browse the repository at this point in the history
HPCC-30711 Add global annotations

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Nov 2, 2023
2 parents 4d6b337 + e7d956f commit fb5d871
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 51 deletions.
13 changes: 13 additions & 0 deletions helm/hpcc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2527,3 +2527,16 @@ spec:
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
A template to generate component annotations, merges static default annotations with global and component annotations
Pass in dict with .root, .me
*/}}
{{- define "hpcc.generateAnnotations" -}}
{{- $annotations := dict -}}
{{- if hasKey .root.Values.global "componentAnnotations" -}}{{- $annotations = merge $annotations .root.Values.global.componentAnnotations -}}{{- end -}}
{{- if hasKey .me "annotations" -}}{{- $annotations = merge $annotations .me.annotations -}}{{- end -}}
{{- range $key, $value := $annotations }}
{{ $key }}: {{ $value | quote }}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions helm/hpcc/templates/dafilesrv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
helmVersion: 9.2.33-closedown0
annotations:
checksum/config: {{ $configSHA }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" .name "type" "dafilesrv") | indent 6 }}
serviceAccountName: "hpcc-default"
Expand Down
4 changes: 1 addition & 3 deletions helm/hpcc/templates/dali.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ spec:
{{- if hasKey $.Values.global "metrics" }}
{{- include "hpcc.addPrometheusScrapeAnnotations" $.Values.global.metrics | nindent 8 }}
{{- end }}
{{- if hasKey $dali "annotations" }}
{{- toYaml $dali.annotations | nindent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
{{- end }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $dali.name "type" "dali") | indent 6 }}
Expand Down
4 changes: 1 addition & 3 deletions helm/hpcc/templates/dfuserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey . "annotations" }}
{{ toYaml .annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" .name "target" .name "type" "dfuserver") | indent 6 }}
serviceAccountName: "hpcc-default"
Expand Down
8 changes: 2 additions & 6 deletions helm/hpcc/templates/eclagent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ data:
{{- if hasKey .me "labels" }}
{{ toYaml .me.labels | indent 12 }}
{{- end }}
{{- if hasKey .me "annotations" }}
annotations:
{{ toYaml .me.annotations | indent 12 }}
{{- end }}
{{- include "hpcc.generateAnnotations" . | indent 12 }}
spec:
{{- include "hpcc.placementsByJobTargetType" (dict "root" .root "job" $appJobName "target" .me.name "type" "eclagent") | indent 10 }}
serviceAccountName: "hpcc-agent"
Expand Down Expand Up @@ -141,9 +139,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey . "annotations" }}
{{ toYaml .annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" .name "target" .name "type" "eclagent") | indent 6 }}
serviceAccountName: "hpcc-agent"
Expand Down
8 changes: 2 additions & 6 deletions helm/hpcc/templates/eclccserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ data:
{{- if hasKey .me "labels" }}
{{ toYaml .me.labels | indent 12 }}
{{- end }}
{{- if hasKey .me "annotations" }}
annotations:
{{ toYaml .me.annotations | indent 12 }}
{{- end }}
{{- include "hpcc.generateAnnotations" . | indent 12 }}
spec:
{{- include "hpcc.placementsByJobTargetType" (dict "root" .root "job" $compileJobName "target" .me.name "type" "eclccserver") | indent 10 }}
serviceAccountName: "hpcc-default"
Expand Down Expand Up @@ -148,9 +146,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey . "annotations" }}
{{ toYaml .annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" .name "target" .name "type" "eclccserver") | indent 6 }}
serviceAccountName: {{ .useChildProcesses | default false | ternary "hpcc-default" "hpcc-agent" }}
Expand Down
4 changes: 1 addition & 3 deletions helm/hpcc/templates/eclscheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey . "annotations" }}
{{ toYaml .annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" .name "target" .name "type" "eclscheduler") | indent 6 }}
serviceAccountName: "hpcc-default"
Expand Down
4 changes: 1 addition & 3 deletions helm/hpcc/templates/esp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
{{- if hasKey $.Values.global "metrics" }}
{{- include "hpcc.addPrometheusScrapeAnnotations" $.Values.global.metrics | nindent 8 }}
{{- end }}
{{- if hasKey . "annotations" }}
{{ toYaml .annotations | indent 8 }}
{{- end }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" .name "type" "esp") | indent 6 }}
Expand Down
4 changes: 1 addition & 3 deletions helm/hpcc/templates/localroxie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey . "annotations" }}
{{ toYaml .annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $roxie.name "target" $roxie.name "type" "roxie") | indent 6 }}
serviceAccountName: "hpcc-default"
Expand Down
9 changes: 3 additions & 6 deletions helm/hpcc/templates/roxie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,9 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $topoconfigSHA }}
{{- include "hpcc.generateAnnotations" (dict "root" $commonCtx.root "me" $toposerver) | indent 8 }}
{{- if hasKey $.Values.global "metrics" }}
{{- include "hpcc.addPrometheusScrapeAnnotations" $.Values.global.metrics | nindent 8 }}
{{- end }}
{{- if hasKey $toposerver "annotations" }}
{{ toYaml $toposerver.annotations | indent 8 }}
{{- end }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $commonCtx.toponame "target" $roxie.name "type" "roxie") | indent 6 }}
Expand Down Expand Up @@ -252,6 +250,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
{{- if hasKey $.Values.global "metrics" }}
{{- include "hpcc.addPrometheusScrapeAnnotations" $.Values.global.metrics | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -356,11 +355,9 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
{{- if hasKey $.Values.global "metrics" }}
{{- include "hpcc.addPrometheusScrapeAnnotations" $.Values.global.metrics | nindent 8 }}
{{- end }}
{{- if hasKey $roxie "annotations" }}
{{ toYaml $roxie.annotations | indent 8 }}
{{- end }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $name "target" $roxie.name "type" "roxie") | indent 6 }}
Expand Down
4 changes: 1 addition & 3 deletions helm/hpcc/templates/sasha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey $sasha "annotations" }}
{{ toYaml $sasha.annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $serviceName "type" "sasha") | indent 6 }}
serviceAccountName: "hpcc-default"
Expand Down
20 changes: 5 additions & 15 deletions helm/hpcc/templates/thor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ data:
{{- if hasKey .me "labels" }}
{{ toYaml .me.labels | indent 12 }}
{{- end }}
{{- if hasKey .me "annotations" }}
annotations:
{{ toYaml .me.annotations | indent 12 }}
{{- end }}
{{- include "hpcc.generateAnnotations" . | indent 12 }}
spec:
{{- include "hpcc.placementsByJobTargetType" (dict "root" .root "job" $eclAgentJobName "target" .me.name "type" "thor") | indent 10 }}
serviceAccountName: "hpcc-agent"
Expand Down Expand Up @@ -154,10 +152,8 @@ data:
{{- if hasKey $thorScope "labels" }}
{{ toYaml $thorScope.labels | indent 12 }}
{{- end }}
{{- if hasKey $thorScope "annotations" }}
annotations:
{{ toYaml $thorScope.annotations | indent 12 }}
{{- end }}
{{- include "hpcc.generateAnnotations" . | indent 12 }}
spec:
{{- include "hpcc.placementsByJobTargetType" (dict "root" .root "job" $thorManagerJobName "target" .me.name "type" "thor") | indent 10 }}
serviceAccountName: hpcc-thoragent
Expand Down Expand Up @@ -221,10 +217,8 @@ data:
{{- if hasKey $thorScope "labels" }}
{{ toYaml $thorScope.labels | indent 12 }}
{{- end }}
{{- if hasKey $thorScope "annotations" }}
annotations:
{{ toYaml $thorScope.annotations | indent 12 }}
{{- end }}
{{- include "hpcc.generateAnnotations" . | indent 12 }}
spec:
{{- include "hpcc.placementsByJobTargetType" (dict "root" .root "job" $thorWorkerJobName "target" .me.name "type" "thor") | indent 10 }}
serviceAccountName: hpcc-default
Expand Down Expand Up @@ -355,9 +349,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey $commonCtx.me "annotations" }}
{{ toYaml $commonCtx.me.annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $commonCtx.eclAgentName "target" .name "type" "thor") | indent 6 }}
{{- include "hpcc.addImagePullSecrets" $commonCtx | nindent 6 -}}
Expand Down Expand Up @@ -420,9 +412,7 @@ spec:
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- if hasKey $commonCtx.me "annotations" }}
{{ toYaml $commonCtx.me.annotations | indent 8 }}
{{- end }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $commonCtx.thorAgentName "target" .name "type" "thor") | indent 6 }}
{{- include "hpcc.addImagePullSecrets" $commonCtx | nindent 6 -}}
Expand Down
13 changes: 13 additions & 0 deletions helm/hpcc/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@
},
"additionalProperties": false
}
},
"componentAnnotations": {
"type": "object",
"additionalProperties": { "type": "string" },
"description": "Global component annotations, generated into all components"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -2754,6 +2759,14 @@
"image": {
"$ref": "#/definitions/image"
},
"annotations": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"labels": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"logging": {
"$ref": "#/definitions/logging"
},
Expand Down

0 comments on commit fb5d871

Please sign in to comment.