diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 00a6963..7256c6b 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -5,6 +5,14 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} +{{- define "n8n-webhook.name" -}} +{{ include "n8n.name" . }}-webhook +{{- end }} + +{{- define "n8n-worker.name" -}} +{{ include "n8n.name" . }}-worker +{{- end }} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -23,6 +31,14 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} +{{- define "n8n-webhook.fullname" -}} +{{ include "n8n.fullname" . }}-webhook +{{- end }} + +{{- define "n8n-worker.fullname" -}} +{{ include "n8n.fullname" . }}-worker +{{- end }} + {{/* Create chart name and version as used by the chart label. */}} @@ -33,15 +49,32 @@ Create chart name and version as used by the chart label. {{/* Common labels */}} -{{- define "n8n.labels" -}} +{{- define "common.labels" -}} helm.sh/chart: {{ include "n8n.chart" . }} -{{ include "n8n.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} +{{/* +n8n labels +*/}} +{{- define "n8n.labels" -}} +{{ include "common.labels" . }} +{{ include "n8n.selectorLabels" . }} +{{- end }} + +{{- define "n8n-webhook.labels" -}} +{{ include "common.labels" . }} +{{ include "n8n-webhook.selectorLabels" . }} +{{- end }} + +{{- define "n8n-worker.labels" -}} +{{ include "common.labels" . }} +{{ include "n8n-worker.selectorLabels" . }} +{{- end }} + {{/* Selector labels */}} @@ -49,3 +82,13 @@ Selector labels app.kubernetes.io/name: {{ include "n8n.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{- define "n8n-webhook.selectorLabels" -}} +app.kubernetes.io/name: {{ include "n8n-webhook.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "n8n-worker.selectorLabels" -}} +app.kubernetes.io/name: {{ include "n8n-worker.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/templates/webhook-deployment.yaml b/templates/webhook-deployment.yaml index aeedb1a..aa069cd 100644 --- a/templates/webhook-deployment.yaml +++ b/templates/webhook-deployment.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "n8n.fullname" . }}-webhook + name: {{ include "n8n-webhook.fullname" . }} labels: {{- include "n8n.labels" . | nindent 4 }} spec: @@ -10,7 +10,7 @@ spec: {{- end }} selector: matchLabels: - {{- include "n8n.selectorLabels" . | nindent 6 }} + {{- include "n8n-webhook.selectorLabels" . | nindent 6 }} template: metadata: annotations: @@ -20,7 +20,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "n8n.selectorLabels" . | nindent 8 }} + {{- include "n8n-webhook.selectorLabels" . | nindent 8 }} spec: {{- with .Values.webhook.image.pullSecrets }} imagePullSecrets: diff --git a/templates/webhook-ingress.yaml b/templates/webhook-ingress.yaml index 31a4c89..f35c11e 100644 --- a/templates/webhook-ingress.yaml +++ b/templates/webhook-ingress.yaml @@ -1,5 +1,5 @@ {{- if .Values.webhook.ingress.enabled -}} -{{- $fullName := include "n8n.fullname" . -}} +{{- $fullName := include "n8n-webhook.fullname" . -}} {{- $svcPort := .Values.webhook.service.port -}} {{- if and .Values.webhook.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.webhook.ingress.annotations "kubernetes.io/ingress.class") }} @@ -15,9 +15,9 @@ apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: - name: {{ $fullName }}-webhook + name: {{ $fullName }} labels: - {{- include "n8n.labels" . | nindent 4 }} + {{- include "n8n-webhook.labels" . | nindent 4 }} {{- with .Values.webhook.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -47,11 +47,11 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ $fullName }}-webhook + name: {{ $fullName }} port: number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }}-webhook + serviceName: {{ $fullName }} servicePort: {{ $svcPort }} {{- end }} {{- end }} diff --git a/templates/webhook-service.yaml b/templates/webhook-service.yaml index 35142dc..3fa27f5 100644 --- a/templates/webhook-service.yaml +++ b/templates/webhook-service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "n8n.fullname" . }}-webhook + name: {{ include "n8n-webhook.fullname" . }}-webhook labels: - {{- include "n8n.labels" . | nindent 4 }} + {{- include "n8n-webhook.labels" . | nindent 4 }} spec: type: {{ .Values.webhook.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "n8n.selectorLabels" . | nindent 4 }} + {{- include "n8n-webhook.selectorLabels" . | nindent 4 }} diff --git a/templates/worker-deployment.yaml b/templates/worker-deployment.yaml index 894d94b..7812d73 100644 --- a/templates/worker-deployment.yaml +++ b/templates/worker-deployment.yaml @@ -1,9 +1,9 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "n8n.fullname" . }}-worker + name: {{ include "n8n-worker.fullname" . }} labels: - {{- include "n8n.labels" . | nindent 4 }} + {{- include "n8n-worker.labels" . | nindent 4 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} @@ -13,7 +13,7 @@ spec: {{- end }} selector: matchLabels: - {{- include "n8n.selectorLabels" . | nindent 6 }} + {{- include "n8n-worker.selectorLabels" . | nindent 6 }} template: metadata: annotations: @@ -23,7 +23,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "n8n.selectorLabels" . | nindent 8 }} + {{- include "n8n-worker.selectorLabels" . | nindent 8 }} spec: {{- with .Values.worker.image.pullSecrets }} imagePullSecrets: