fix: split env config and image pull secret into separate helm releases

Bundling these Secrets in the app helm chart caused two bugs in the scheduler-k3s plugin: a chart rollback could delete Secrets that older ReplicaSets still referenced by exact timestamped name (`env-{app}.{ts}` and `ims-{app}.{ts}`), hard-crashing pods until manual intervention; and the strategic-merge `patchMergeKey` on `imagePullSecrets` let stale entries leak into the live Deployment until the list pointed at many nonexistent Secrets. Each Secret now lives in its own helm release with a stable name (`config-{app}` and `pull-secret-{app}`), installed before the app chart on every deploy. The deployment trigger also prunes any leaked `imagePullSecrets` entries from the live Deployment so the next deploy lands on a clean list, and the rename and destroy paths uninstall the new releases (and the previously-leaked TLS release on rename) under the old app name.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-04-29 12:18:03 -04:00
1 parent f06048a266
commit ef9bdc0379
18 files changed
+1086 -56

No files matched your search

@@ -77,7 +77,7 @@ spec:
{{- end }}
envFrom:
- secretRef:
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
name: config-{{ $.Values.global.app_name }}
optional: true
image: {{ $.Values.global.image.name }}
imagePullPolicy: Always
@@ -74,7 +74,7 @@ spec:
{{- end }}
envFrom:
- secretRef:
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
name: config-{{ $.Values.global.app_name }}
optional: true
image: {{ $.Values.global.image.name }}
imagePullPolicy: Always
@@ -1,20 +0,0 @@
{{- if $.Values.global.image.pull_secret_base64 }}
---
apiVersion: v1
kind: Secret
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
dokku.com/managed: "true"
{{ include "print.annotations" (dict "config" $.Values.global "key" "secret") | indent 4 }}
labels:
app.kubernetes.io/instance: ims-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
app.kubernetes.io/name: ims-{{ $.Values.global.app_name }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
{{ include "print.labels" (dict "config" $.Values.global "key" "secret") | indent 4 }}
name: ims-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
namespace: {{ $.Values.global.namespace }}
data:
.dockerconfigjson: "{{ $.Values.global.image.pull_secret_base64 }}"
type: kubernetes.io/dockerconfigjson
{{- end }}
@@ -1,19 +0,0 @@
---
apiVersion: v1
kind: Secret
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
dokku.com/managed: "true"
{{ include "print.annotations" (dict "config" $.Values.global "key" "secret") | indent 4 }}
labels:
app.kubernetes.io/instance: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
app.kubernetes.io/name: env-{{ $.Values.global.app_name }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
{{ include "print.labels" (dict "config" $.Values.global "key" "secret") | indent 4 }}
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
namespace: {{ $.Values.global.namespace }}
{{- with .Values.global.secrets }}
data:
{{- toYaml . | nindent 2 }}
{{- end }}