Skip to content

Commit

Permalink
Fix duplicate component labels (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
Calebjh authored Oct 16, 2024
1 parent 62a4061 commit d62c3b4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
12 changes: 12 additions & 0 deletions helm/db-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "db-proxy-test.labels" -}}
helm.sh/chart: {{ include "db-controller.chart" . }}
app.kubernetes.io/name: {{ include "db-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: dbproxy-test
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}


{{/*
Selector labels
*/}}
Expand Down
1 change: 0 additions & 1 deletion helm/db-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
app.kubernetes.io/component: manager
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand Down
17 changes: 8 additions & 9 deletions helm/db-controller/templates/tests/dbproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
app.kubernetes.io/component: dbproxy-test
{{- include "db-proxy-test.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": "test"
---
Expand All @@ -15,7 +14,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": "test"
rules:
Expand All @@ -34,7 +33,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": "test"
roleRef:
Expand All @@ -52,7 +51,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
annotations:
# ensure this runs on the new db-controller, not the existing one
"helm.sh/hook": "test"
Expand All @@ -70,7 +69,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
annotations:
# ensure this runs on the new db-controller, not the existing one
"helm.sh/hook": "test"
Expand Down Expand Up @@ -100,7 +99,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test-db
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
spec:
selector:
app: dbproxy-test-db
Expand All @@ -116,7 +115,7 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: dbproxy-test-db
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
spec:
containers:
- name: postgres
Expand All @@ -135,7 +134,7 @@ metadata:
name: {{ .Release.Name }}-dbproxy-test
namespace: {{ .Release.Namespace }}
labels:
{{- include "db-controller.labels" . | nindent 4 }}
{{- include "db-proxy-test.labels" . | nindent 4 }}
persistance.atlas.infoblox.com/claim: {{ .Release.Name }}-dbproxy-test
persistance.atlas.infoblox.com/class: {{ .Values.dbController.class | quote }}
persistance.atlas.infoblox.com/dbproxy: enabled
Expand Down

0 comments on commit d62c3b4

Please sign in to comment.