Skip to content

Commit

Permalink
chore: fix labels for postgres in helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Apr 8, 2024
1 parent fd83a95 commit 02862ca
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
20 changes: 18 additions & 2 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,25 @@ If release name contains chart name it will be used as a full name.
{{/*
Common labels
*/}}
{{- define "canary-checker.labels" -}}
{{- define "chart.labels" -}}
helm.sh/chart: {{ include "canary-checker.chart" . }}
{{ include "canary-checker.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "canary-checker.labels" -}}
{{ include "chart.labels" . }}
{{ include "canary-checker.selectorLabels" . }}
{{- end }}

{{- define "postgresql.labels" -}}
{{ include "chart.labels" . }}
{{ include "postgresql.selectorLabels" . }}
{{- end }}


{{/*
Selector labels
*/}}
Expand All @@ -51,6 +61,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
control-plane: canary-checker
{{- end }}

{{- define "postgresql.selectorLabels" -}}
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: {{ .Release.Name }}
control-plane: canary-checker
{{- end }}

{{/*
Image Name
*/}}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/postgres-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ kind: Service
metadata:
name: postgres
labels:
{{- include "canary-checker.labels" . | nindent 4 }}
{{- include "postgresql.labels" . | nindent 4 }}
spec:
selector:
app: postgresql
{{- include "canary-checker.selectorLabels" . | nindent 4 }}
{{- include "postgresql.selectorLabels" . | nindent 4 }}
ports:
- port: 5432
targetPort: 5432
Expand Down
6 changes: 3 additions & 3 deletions chart/templates/postgres-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ kind: StatefulSet
metadata:
name: postgresql
labels:
{{- include "canary-checker.labels" . | nindent 4 }}
{{- include "postgresql.labels" . | nindent 4 }}
spec:
serviceName: postgresql
selector:
matchLabels:
app: postgresql
{{- include "canary-checker.selectorLabels" . | nindent 6 }}
{{- include "postgresql.selectorLabels" . | nindent 6 }}
replicas: 1
template:
metadata:
labels:
app: postgresql
{{- include "canary-checker.labels" . | nindent 8 }}
{{- include "postgresql.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: postgresql
Expand Down

0 comments on commit 02862ca

Please sign in to comment.