Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/fullname override #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(Helm): fix templates full name usage
Replace some hard-coded names based on release name with Bitnami naming mechanism, to allow user override.
alexismanin committed Oct 21, 2024
commit 753dfb76cdd1c7f37237bfc87259be29804ca6fe
26 changes: 24 additions & 2 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -43,6 +43,12 @@ Compile all warnings into a single message.
{{- end -}}


{{/*
Return Novu API deployment full name
*/}}
{{- define "novu-api.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "api" -}}
{{- end -}}

{{/*
Return the proper api image name
@@ -58,7 +64,12 @@ Return the proper image name (for the init container volume-permissions image)
{{- include "common.images.image" ( dict "imageRoot" "global" .Values.global ) -}}
{{- end -}}


{{/*
Return Novu Worker deployment full name
*/}}
{{- define "novu-worker.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "worker" -}}
{{- end -}}
{{/*
Return the proper worker image name
*/}}
@@ -73,7 +84,12 @@ Return the proper image name (for the init container volume-permissions image)
{{- include "common.images.image" ( dict "imageRoot" "global" .Values.global ) -}}
{{- end -}}


{{/*
Return Novu web service deployment full name
*/}}
{{- define "novu-ws.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "ws" -}}
{{- end -}}
{{/*
Return the proper ws image name
*/}}
@@ -88,6 +104,12 @@ Return the proper image name (for the init container volume-permissions image)
{{- include "common.images.image" ( dict "imageRoot" "global" .Values.global ) -}}
{{- end -}}

{{/*
Return Novu web service deployment full name
*/}}
{{- define "novu-web.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "web" -}}
{{- end -}}
{{/*
Return the proper web image name
*/}}
8 changes: 4 additions & 4 deletions helm/templates/api/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-%s" .Release.Name "api" }}
name: {{ include "novu-api.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "api" }}
app.kubernetes.io/component: {{ include "novu-api.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -20,14 +20,14 @@ spec:
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "api" }}
app.kubernetes.io/component: {{ include "novu-api.fullname" . }}
template:
metadata:
{{- if .Values.api.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.api.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "api" }}
app.kubernetes.io/component: {{ include "novu-api.fullname" . }}
{{- if .Values.api.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.api.podLabels "context" $) | nindent 8 }}
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/api/ingress.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ printf "%s-%s" .Release.Name "api" }}
name: {{ include "novu-api.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
@@ -31,7 +31,7 @@ spec:
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.api.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" .Release.Name "api") "servicePort" "http" "context" $) | nindent 14 }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "novu-api.fullname") "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.api.ingress.extraHosts }}
- host: {{ include "common.tplvalues.render" ( dict "value" .name "context" $ ) }}
@@ -41,7 +41,7 @@ spec:
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" .Release.Name "api") "servicePort" "http" "context" $) | nindent 14 }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "novu-api.fullname") "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.api.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.api.ingress.extraRules "context" $) | nindent 4 }}
6 changes: 3 additions & 3 deletions helm/templates/api/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Release.Name "api" }}
name: {{ include "novu-api.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "api" }}
app.kubernetes.io/component: {{ include "novu-api.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -27,4 +27,4 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .Values.api.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "api" }}
app.kubernetes.io/component: {{ include "novu-api.fullname" . }}
2 changes: 1 addition & 1 deletion helm/templates/externals3-secrets.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" .Release.Name "externals3" }}
name: {{ include "novu.s3.secretName" }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
2 changes: 1 addition & 1 deletion helm/templates/localstack-secrets.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" .Release.Name "localstack" }}
name: {{ include "novu.s3.secretName" }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
8 changes: 4 additions & 4 deletions helm/templates/web/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-%s" .Release.Name "web" }}
name: {{ include "novu-web.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "web" }}
app.kubernetes.io/component: {{ include "novu-web.fullname" . }}

{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
@@ -21,14 +21,14 @@ spec:
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "web" }}
app.kubernetes.io/component: {{ include "novu-web.fullname" . }}
template:
metadata:
{{- if .Values.web.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.web.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "web" }}
app.kubernetes.io/component: {{ include "novu-web.fullname" . }}
{{- if .Values.web.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.web.podLabels "context" $) | nindent 8 }}
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/web/ingress.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ printf "%s-%s" .Release.Name "web" }}
name: {{ include "novu-web.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
@@ -31,7 +31,7 @@ spec:
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.web.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" .Release.Name "web") "servicePort" "http" "context" $) | nindent 14 }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "novu-web.fullname") "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.web.ingress.extraHosts }}
- host: {{ include "common.tplvalues.render" ( dict "value" .name "context" $ ) }}
@@ -41,7 +41,7 @@ spec:
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" .Release.Name "web") "servicePort" "http" "context" $) | nindent 14 }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "novu-web.fullname") "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.web.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.web.ingress.extraRules "context" $) | nindent 4 }}
6 changes: 3 additions & 3 deletions helm/templates/web/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Release.Name "web" }}
name: {{ include "novu-web.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "web" }}
app.kubernetes.io/component: {{ include "novu-web.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -27,4 +27,4 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .Values.web.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "web" }}
app.kubernetes.io/component: {{ include "novu-web.fullname" . }}
8 changes: 4 additions & 4 deletions helm/templates/worker/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-%s" .Release.Name "worker" }}
name: {{ include "novu-worker.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "worker" }}
app.kubernetes.io/component: {{ include "novu-worker.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -20,14 +20,14 @@ spec:
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "worker" }}
app.kubernetes.io/component: {{ include "novu-worker.fullname" . }}
template:
metadata:
{{- if .Values.worker.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.worker.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "worker" }}
app.kubernetes.io/component: {{ include "novu-worker.fullname" . }}
{{- if .Values.worker.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.worker.podLabels "context" $) | nindent 8 }}
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/worker/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Release.Name "worker" }}
name: {{ include "novu-worker.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "worker" }}
app.kubernetes.io/component: {{ include "novu-worker.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -27,4 +27,4 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .Values.worker.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "worker" }}
app.kubernetes.io/component: {{ include "novu-worker.fullname" . }}
8 changes: 4 additions & 4 deletions helm/templates/ws/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-%s" .Release.Name "ws" }}
name: {{ include "novu-ws.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "ws" }}
app.kubernetes.io/component: {{ include "novu-ws.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -20,14 +20,14 @@ spec:
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "ws" }}
app.kubernetes.io/component: {{ include "novu-ws.fullname" . }}
template:
metadata:
{{- if .Values.ws.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.ws.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "ws" }}
app.kubernetes.io/component: {{ include "novu-ws.fullname" . }}
{{- if .Values.ws.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.ws.podLabels "context" $) | nindent 8 }}
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/ws/ingress.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ printf "%s-%s" .Release.Name "ws" }}
name: {{ include "novu-ws.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
@@ -31,7 +31,7 @@ spec:
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.ws.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" .Release.Name "ws") "servicePort" "http" "context" $) | nindent 14 }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "novu-ws.fullname") "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- range .Values.ws.ingress.extraHosts }}
- host: {{ include "common.tplvalues.render" ( dict "value" .name "context" $ ) }}
@@ -41,7 +41,7 @@ spec:
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ default "ImplementationSpecific" .pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-%s" .Release.Name "ws") "servicePort" "http" "context" $) | nindent 14 }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "novu-ws.fullname") "servicePort" "http" "context" $) | nindent 14 }}
{{- end }}
{{- if .Values.ws.ingress.extraRules }}
{{- include "common.tplvalues.render" (dict "value" .Values.ws.ingress.extraRules "context" $) | nindent 4 }}
6 changes: 3 additions & 3 deletions helm/templates/ws/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Release.Name "ws" }}
name: {{ include "novu-ws.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "ws" }}
app.kubernetes.io/component: {{ include "novu-ws.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -27,4 +27,4 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "ws" }}
app.kubernetes.io/component: {{ include "novu-ws.fullname" . }}