Skip to content

Commit

Permalink
make helm chart working with good labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmi151 committed Feb 12, 2025
1 parent 8cb6d3a commit b4f8499
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion helm/templates/_bootstrap-maelstro-configuration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{- end }}
volumeMounts:
- mountPath: /etc/georchestra
name: maelstro-configuration
name: georchestra-datadir
{{- if .Values.datadir.git.ssh_secret }}
- mountPath: /ssh-secret
name: ssh-secret
Expand Down
11 changes: 10 additions & 1 deletion helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Common labels
*/}}
{{- define "helm-maelstro.labels" -}}
helm.sh/chart: {{ include "helm-maelstro.chart" . }}
{{ include "helm-maelstro.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -50,6 +49,16 @@ app.kubernetes.io/name: {{ include "helm-maelstro.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "helm-maelstro.selectorLabelsFrontend" -}}
app.kubernetes.io/name: {{ include "helm-maelstro.name" . }}-maelstro-frontend
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "helm-maelstro.selectorLabelsBackend" -}}
app.kubernetes.io/name: {{ include "helm-maelstro.name" . }}-maelstro-backend
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
Expand Down
8 changes: 4 additions & 4 deletions helm/templates/maelstro-backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ kind: Deployment
metadata:
name: {{ include "helm-maelstro.fullname" . }}-maelstro-backend-deployment
labels:
{{- include "helm-maelstro.selectorLabelsBackend" . | nindent 4 }}
{{- include "helm-maelstro.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.maelstro_backend.replicaCount }}
selector:
matchLabels:
{{- include "helm-maelstro.selectorLabels" . | nindent 6 }}
{{- include "helm-maelstro.selectorLabelsBackend" . | nindent 6 }}
template:
metadata:
{{- with .Values.maelstro_backend.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "helm-maelstro.selectorLabels" . | nindent 8 }}
app.kubernetes.io/name: {{ include "helm-maelstro.fullname" . }}-maelstro-backend-deployment
{{- include "helm-maelstro.selectorLabelsBackend" . | nindent 8 }}
spec:
{{- if .Values.datadir.git.url }}
initContainers:
Expand Down Expand Up @@ -92,4 +92,4 @@ spec:
{{- with .Values.maelstro_backend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion helm/templates/maelstro-backend-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ spec:
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "helm-maelstro.fullname" . }}-maelstro-backend-deployment
app.kubernetes.io/name: {{ include "helm-maelstro.fullname" . }}-maelstro-backend
8 changes: 4 additions & 4 deletions helm/templates/maelstro-frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ kind: Deployment
metadata:
name: {{ include "helm-maelstro.fullname" . }}-maelstro-frontend-deployment
labels:
{{- include "helm-maelstro.selectorLabelsFrontend" . | nindent 4 }}
{{- include "helm-maelstro.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.maelstro_frontend.replicaCount }}
selector:
matchLabels:
{{- include "helm-maelstro.selectorLabels" . | nindent 6 }}
{{- include "helm-maelstro.selectorLabelsFrontend" . | nindent 6 }}
template:
metadata:
{{- with .Values.maelstro_frontend.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "helm-maelstro.selectorLabels" . | nindent 8 }}
app.kubernetes.io/name: {{ include "helm-maelstro.fullname" . }}-maelstro-frontend-deployment
{{- include "helm-maelstro.selectorLabelsFrontend" . | nindent 8 }}
spec:
{{- if .Values.datadir.git.url }}
initContainers:
Expand Down Expand Up @@ -78,4 +78,4 @@ spec:
{{- with .Values.maelstro_frontend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion helm/templates/maelstro-frontend-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ spec:
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "helm-maelstro.fullname" . }}-maelstro-frontend-deployment
app.kubernetes.io/name: {{ include "helm-maelstro.fullname" . }}-maelstro-frontend
4 changes: 2 additions & 2 deletions helm/templates/maelstro-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ metadata:
labels:
{{- include "helm-maelstro.labels" . | nindent 4 }}
type: Opaque
data: |
data:
{{- range .Values.credentials }}
{{ .name | indent 2 }}_USERNAME: {{ .username | b64enc }}
{{ .name | indent 2 }}_PASSWORD: {{ .password | b64enc }}
{{ .name | indent 2 }}_URL: {{ .url | b64enc }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit b4f8499

Please sign in to comment.