Skip to content
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ The chart supports both internal and external PostgreSQL databases:
| `affinity` | Affinity rules | `{}` |
| `volumes` | Additional volumes | `[]` |
| `volumeMounts` | Additional volume mounts | `[]` |
| `extraEnv` | Environment variables (EnvVar entries) for API pods only, rendered before the chart's own | `[]` |
| `extraVolumes` | Volumes for API pods only, rendered before the chart's own | `[]` |
| `extraVolumeMounts` | Volume mounts for the API container only, rendered before the chart's own | `[]` |
| `commonAnnotations` | Annotations added to every rendered object; an object's own annotation with the same key wins | `{}` |

### Graceful rollouts

Expand Down Expand Up @@ -356,6 +360,8 @@ The fusillade daemon handles background batch processing tasks. By default, it r
| `fusillade.nodeSelector` | Node selector for fusillade pods | `{}` |
| `fusillade.tolerations` | Tolerations for fusillade pods | `[]` |
| `fusillade.affinity` | Affinity rules for fusillade pods | `{}` |
| `fusillade.strategy` | Deployment strategy for fusillade daemons (per daemon under `fusillade.split.<daemon>.strategy`) | Kubernetes default |
| `fusillade.terminationGracePeriodSeconds` | Pod termination grace period for fusillade daemons (per daemon under `fusillade.split.<daemon>`) | Kubernetes default |
| `fusillade.env` | Additional environment variables | `{}` |

When `fusillade.enabled: true`:
Expand Down
54 changes: 51 additions & 3 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ options renders byte-for-byte the same template as before this helper existed.
{{ " " }}template:
metadata:
annotations:
checksum/secret: {{ include (print $root.Template.BasePath "/secret.yaml") $root | sha256sum }}
checksum/config: {{ include (print $root.Template.BasePath "/configmap.yaml") $root | sha256sum }}
checksum/secret: {{ include "control-layer.checksum" (dict "root" $root "path" "secret.yaml") }}
checksum/config: {{ include "control-layer.checksum" (dict "root" $root "path" "configmap.yaml") }}
{{- if $root.Values.modelProvisioning.enabled }}
checksum/model-provisioning: {{ include (print $root.Template.BasePath "/model-provisioning-configmap.yaml") $root | sha256sum }}
checksum/model-provisioning: {{ include "control-layer.checksum" (dict "root" $root "path" "model-provisioning-configmap.yaml") }}
{{- end }}
{{- with $root.Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -376,6 +376,9 @@ options renders byte-for-byte the same template as before this helper existed.
name: {{ . | quote }}
{{- end }}
env:
{{- with $root.Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $root.Values.modelProvisioning.enabled }}
- name: DWCTL_MODEL_PROVISIONING__ENABLED
value: "true"
Expand Down Expand Up @@ -430,6 +433,9 @@ options renders byte-for-byte the same template as before this helper existed.
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- with $root.Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
- name: config
mountPath: /app/config.yaml
subPath: control-layer-config.yaml
Expand All @@ -448,6 +454,9 @@ options renders byte-for-byte the same template as before this helper existed.
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{- with $root.Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
Comment on lines +457 to +458

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Deduplicate API-only volumes before appending built-ins

When extraVolumes contains a chart-owned name such as config, model-provisioning, or email-templates, this emits both the user entry and the built-in entry. Kubernetes requires volume names within a PodSpec to be unique, so the Deployment is rejected rather than the later chart-owned volume “winning” as documented in values.yaml. Merge or filter these lists by name, or reject collisions explicitly.

Useful? React with 👍 / 👎.

{{- end }}
- name: config
configMap:
name: {{ include "control-layer.fullname" $root }}-config
Expand Down Expand Up @@ -478,3 +487,42 @@ options renders byte-for-byte the same template as before this helper existed.
{{- end }}

{{- end }}

{{/*
`commonAnnotations` as the object's `annotations:` key and map, or nothing when
none are set. For templates whose objects carry no annotations of their own;
templates that do use control-layer.commonAnnotationEntries.
*/}}
{{- define "control-layer.commonAnnotations" -}}
{{- with .Values.commonAnnotations }}
annotations:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}

{{/*
The `commonAnnotations` entries an object does not set itself, as map entries
(no `annotations:` key): an object's own annotations win. Takes a dict: root
(the chart context), own (the object's own annotations, as a map).
*/}}
{{- define "control-layer.commonAnnotationEntries" -}}
{{- $own := .own | default dict -}}
{{- $entries := dict -}}
{{- range $key, $value := .root.Values.commonAnnotations | default dict }}
{{- if not (hasKey $own $key) }}{{ $_ := set $entries $key $value }}{{ end }}
{{- end }}
{{- with $entries }}{{ toYaml . }}{{ end }}
{{- end }}

{{/*
sha256 of a rendered template, computed without `commonAnnotations`: annotations
on a ConfigMap or Secret do not change what a pod mounts, so they must not roll
the pods. Takes a dict: root (the chart context), path (the template's path
under templates/).
*/}}
{{- define "control-layer.checksum" -}}
{{- $context := omit .root "Values" -}}
{{- $_ := set $context "Values" (omit .root.Values "commonAnnotations") -}}
{{- include (print .root.Template.BasePath "/" .path) $context | sha256sum -}}
{{- end }}

9 changes: 9 additions & 0 deletions templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-config
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
data:
control-layer-config.yaml: |
{{- .Values.config | nindent 4 }}
Expand All @@ -15,6 +18,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-bootstrap
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
data:
bootstrap.js: |
{{- .Values.bootstrap.content | nindent 4 }}
Expand All @@ -27,6 +33,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-email-templates
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
data:
{{- range $name, $content := .Values.emailTemplates.files }}
{{ $name }}: |
Expand Down
3 changes: 3 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
{{- if .Values.rollout.enabled }}
Expand Down
17 changes: 15 additions & 2 deletions templates/fusillade/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,32 @@
{{- $database := mergeOverwrite (deepCopy ($fusillade.database | default dict)) (get $config "database" | default dict) -}}
{{- $podAnnotations := mergeOverwrite (deepCopy ($fusillade.podAnnotations | default dict)) (get $config "podAnnotations" | default dict) -}}
{{- $podLabels := mergeOverwrite (deepCopy ($fusillade.podLabels | default dict)) (get $config "podLabels" | default dict) -}}
{{- $strategy := get $config "strategy" | default $fusillade.strategy -}}
{{- $terminationGracePeriodSeconds := $fusillade.terminationGracePeriodSeconds -}}
{{- if and (hasKey $config "terminationGracePeriodSeconds") (not (kindIs "invalid" (index $config "terminationGracePeriodSeconds"))) }}{{ $terminationGracePeriodSeconds = index $config "terminationGracePeriodSeconds" }}{{ end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "control-layer.fullname" $root }}{{ $suffix }}
labels:
{{- include "control-layer.fusillade.labelsFor" (dict "root" $root "component" $component) | nindent 4 }}
{{- with include "control-layer.commonAnnotations" $root }}
{{- . | nindent 2 }}
{{- end }}
spec:
replicas: {{- if hasKey $config "replicaCount" }} {{ get $config "replicaCount" }}{{- else }} {{ $fusillade.replicaCount }}{{- end }}
selector:
matchLabels:
{{- include "control-layer.fusillade.selectorLabelsFor" (dict "root" $root "component" $component) | nindent 6 }}
{{- with $strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
annotations:
checksum/secret: {{ include (print $root.Template.BasePath "/secret.yaml") $root | sha256sum }}
checksum/config: {{ include (print $root.Template.BasePath "/configmap.yaml") $root | sha256sum }}
checksum/secret: {{ include "control-layer.checksum" (dict "root" $root "path" "secret.yaml") }}
checksum/config: {{ include "control-layer.checksum" (dict "root" $root "path" "configmap.yaml") }}
{{- with $podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -40,6 +50,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "control-layer.serviceAccountName" $root }}
{{- if not (kindIs "invalid" $terminationGracePeriodSeconds) }}
terminationGracePeriodSeconds: {{ $terminationGracePeriodSeconds }}
{{- end }}
{{- with (get $config "podSecurityContext" | default $fusillade.podSecurityContext | default $root.Values.podSecurityContext) }}
securityContext:
{{- toYaml . | nindent 8 }}
Expand Down
3 changes: 3 additions & 0 deletions templates/fusillade/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
name: {{ include "control-layer.fullname" $root }}{{ $suffix }}
labels:
{{- include "control-layer.fusillade.labelsFor" (dict "root" $root "component" $component) | nindent 4 }}
{{- with include "control-layer.commonAnnotations" $root }}
{{- . | nindent 2 }}
{{- end }}
spec:
type: ClusterIP
ports:
Expand Down
3 changes: 3 additions & 0 deletions templates/fusillade/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ metadata:
{{- with $root.Values.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with include "control-layer.commonAnnotations" $root }}
{{- . | nindent 2 }}
{{- end }}
spec:
selector:
matchLabels:
Expand Down
3 changes: 3 additions & 0 deletions templates/heap-profiling-networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-heap-profiling
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
podSelector:
matchLabels:
Expand Down
3 changes: 3 additions & 0 deletions templates/keystore/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-keystore
labels:
{{- include "control-layer.keystore.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
type: ClusterIP
ports:
Expand Down
3 changes: 3 additions & 0 deletions templates/keystore/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-keystore
labels:
{{- include "control-layer.keystore.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
serviceName: {{ include "control-layer.fullname" . }}-keystore
# Single instance by design: the keystore is a strongly-consistent custody
Expand Down
8 changes: 7 additions & 1 deletion templates/keystore/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ metadata:
name: {{ include "control-layer.keystore.storageClassName" . }}
labels:
{{- include "control-layer.keystore.labels" . | nindent 4 }}
{{- with .Values.keystore.persistence.managedStorageClass.annotations }}
{{- $commonAnnotations := include "control-layer.commonAnnotationEntries" (dict "root" . "own" .Values.keystore.persistence.managedStorageClass.annotations) }}
{{- if or .Values.keystore.persistence.managedStorageClass.annotations $commonAnnotations }}
annotations:
{{- with .Values.keystore.persistence.managedStorageClass.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $commonAnnotations }}
{{- . | nindent 4 }}
{{- end }}
{{- end }}
provisioner: {{ .Values.keystore.persistence.managedStorageClass.provisioner | quote }}
reclaimPolicy: {{ .Values.keystore.persistence.managedStorageClass.reclaimPolicy | quote }}
Expand Down
3 changes: 3 additions & 0 deletions templates/migrations/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ metadata:
{{- include "control-layer.migrations.labels" . | nindent 4 }}
annotations:
{{- include "control-layer.migrations.hookAnnotations" (dict "root" . "weight" "-5" "wave" .Values.migrations.job.prerequisiteSyncWave) | nindent 4 }}
{{- with include "control-layer.commonAnnotationEntries" (dict "root" . "own" (include "control-layer.migrations.hookAnnotations" (dict "root" . "weight" "-5" "wave" .Values.migrations.job.prerequisiteSyncWave) | fromYaml)) }}
{{- . | nindent 4 }}
{{- end }}
data:
control-layer-config.yaml: |
{{- .Values.config | nindent 4 }}
Expand Down
8 changes: 6 additions & 2 deletions templates/migrations/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ metadata:
{{- with .Values.migrations.job.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- $own := merge (include "control-layer.migrations.hookAnnotations" (dict "root" . "weight" "0" "wave" .Values.migrations.job.syncWave) | fromYaml) (.Values.migrations.job.annotations | default dict) }}
{{- with include "control-layer.commonAnnotationEntries" (dict "root" . "own" $own) }}
{{- . | nindent 4 }}
{{- end }}
spec:
backoffLimit: {{ .Values.migrations.job.backoffLimit }}
activeDeadlineSeconds: {{ .Values.migrations.job.activeDeadlineSeconds }}
Expand All @@ -66,8 +70,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/migrations/config.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/migrations/secret.yaml") . | sha256sum }}
checksum/config: {{ include "control-layer.checksum" (dict "root" . "path" "migrations/config.yaml") }}
checksum/secret: {{ include "control-layer.checksum" (dict "root" . "path" "migrations/secret.yaml") }}
{{- with .Values.migrations.job.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions templates/migrations/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ metadata:
{{- include "control-layer.migrations.labels" . | nindent 4 }}
annotations:
{{- include "control-layer.migrations.hookAnnotations" (dict "root" . "weight" "-5" "wave" .Values.migrations.job.prerequisiteSyncWave) | nindent 4 }}
{{- with include "control-layer.commonAnnotationEntries" (dict "root" . "own" (include "control-layer.migrations.hookAnnotations" (dict "root" . "weight" "-5" "wave" .Values.migrations.job.prerequisiteSyncWave) | fromYaml)) }}
{{- . | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- range $key, $value := include "control-layer.migrations.secretData" . | fromYaml }}
Expand Down
3 changes: 3 additions & 0 deletions templates/model-provisioning-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-model-provisioning
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
{{- if .Values.modelProvisioning.files }}
data:
{{- range $name := keys .Values.modelProvisioning.files | sortAlpha }}
Expand Down
3 changes: 3 additions & 0 deletions templates/postgres/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-postgres-secret
labels:
{{- include "control-layer.postgres.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
type: Opaque
stringData:
{{- with .Values.secrets.postgres.data }}
Expand Down
3 changes: 3 additions & 0 deletions templates/postgres/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-postgres
labels:
{{- include "control-layer.postgres.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
type: ClusterIP
ports:
Expand Down
5 changes: 4 additions & 1 deletion templates/postgres/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}-postgres
labels:
{{- include "control-layer.postgres.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
serviceName: {{ include "control-layer.fullname" . }}-postgres
replicas: {{ .Values.postgresql.replicaCount }}
Expand All @@ -14,7 +17,7 @@ spec:
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/postgres/secret.yaml") . | sha256sum }}
checksum/secret: {{ include "control-layer.checksum" (dict "root" . "path" "postgres/secret.yaml") }}
{{- with .Values.postgresql.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ include "control-layer.secretName" . }}
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
type: Opaque
stringData:
{{- $secrets := .Values.secrets.controlLayer.data }}
Expand Down
3 changes: 3 additions & 0 deletions templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ metadata:
name: {{ include "control-layer.fullname" . }}
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
8 changes: 7 additions & 1 deletion templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ metadata:
name: {{ include "control-layer.serviceAccountName" . }}
labels:
{{- include "control-layer.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
{{- $commonAnnotations := include "control-layer.commonAnnotationEntries" (dict "root" . "own" .Values.serviceAccount.annotations) }}
{{- if or .Values.serviceAccount.annotations $commonAnnotations }}
annotations:
{{- with .Values.serviceAccount.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $commonAnnotations }}
{{- . | nindent 4 }}
{{- end }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
3 changes: 3 additions & 0 deletions templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
{{- with .Values.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with include "control-layer.commonAnnotations" . }}
{{- . | nindent 2 }}
{{- end }}
spec:
selector:
matchLabels:
Expand Down
Loading
Loading