Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-30711 Add global annotations #17975

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit strange using indent (rather than nindent) in an indented block. It works if the block leads with a newline, but would cause problems if not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using nindent would result in a newline here in cases where there was no content generated

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