Skip to content

Commit

Permalink
fix: ensure patch jobs have different selector labels
Browse files Browse the repository at this point in the history
Ensure the patch jobs have different labels/label values than the
deployment so HPA does not consider the patch jobs in its
calculations creating errors.

Thanks to @jurgenweber

fixes estahn/k8s-image-swapper#124
  • Loading branch information
estahn committed Jan 30, 2023
1 parent 231b9a3 commit a59ea87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions charts/k8s-image-swapper/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ Selector labels
{{- define "k8s-image-swapper.selectorLabels" -}}
app.kubernetes.io/name: {{ include "k8s-image-swapper.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if contains "/job-patch/" .Template.Name }}
app.kubernetes.io/component: job-patch
{{- else }}
app.kubernetes.io/component: app
{{- end }}
{{- end }}

{{/*
Expand Down
1 change: 0 additions & 1 deletion charts/k8s-image-swapper/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
# Includes selectorLabels
{{- include "k8s-image-swapper.labels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
Expand Down

0 comments on commit a59ea87

Please sign in to comment.