From 8c78a06a6d459eafae4cf5ccfd7115fe01b6bab7 Mon Sep 17 00:00:00 2001 From: jaydee94 Date: Mon, 6 May 2024 13:01:09 +0200 Subject: [PATCH 1/3] Add namespace value for configuring the destination namespace of the kubernetes manifests Signed-off-by: jaydee94 --- deploy/chart/templates/_helpers.tpl | 9 +++++++++ deploy/chart/templates/deployment.yaml | 1 + deploy/chart/templates/service.yaml | 1 + deploy/chart/templates/serviceaccount.yaml | 1 + deploy/chart/templates/servicemonitor.yaml | 1 + deploy/chart/values.yaml | 2 ++ 6 files changed, 15 insertions(+) diff --git a/deploy/chart/templates/_helpers.tpl b/deploy/chart/templates/_helpers.tpl index 6e9ac42..a7c6752 100644 --- a/deploy/chart/templates/_helpers.tpl +++ b/deploy/chart/templates/_helpers.tpl @@ -30,6 +30,15 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} +{{/* +Namespace for all resources to be installed into +If not defined in values file then the helm release namespace is used +By default this is not set so the helm release namespace will be used +*/}} +{{- define "openshift-routes.namespace" -}} + {{ .Values.namespace | default .Release.Namespace }} +{{- end -}} + {{/* Common labels */}} diff --git a/deploy/chart/templates/deployment.yaml b/deploy/chart/templates/deployment.yaml index 61cc995..e8bd914 100644 --- a/deploy/chart/templates/deployment.yaml +++ b/deploy/chart/templates/deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "openshift-routes.fullname" . }} + namespace: {{ include "openshift-routes.namespace" . }} labels: {{- include "openshift-routes.labels" . | nindent 4 }} spec: diff --git a/deploy/chart/templates/service.yaml b/deploy/chart/templates/service.yaml index 48bd8fd..7d6da57 100644 --- a/deploy/chart/templates/service.yaml +++ b/deploy/chart/templates/service.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Service metadata: name: {{ include "openshift-routes.fullname" . }} + namespace: {{ include "openshift-routes.namespace" . }} labels: {{- include "openshift-routes.labels" . | nindent 4 }} spec: diff --git a/deploy/chart/templates/serviceaccount.yaml b/deploy/chart/templates/serviceaccount.yaml index 7ff74c9..c1f14da 100644 --- a/deploy/chart/templates/serviceaccount.yaml +++ b/deploy/chart/templates/serviceaccount.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "openshift-routes.serviceAccountName" . }} + namespace: {{ include "openshift-routes.namespace" . }} labels: {{- include "openshift-routes.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} diff --git a/deploy/chart/templates/servicemonitor.yaml b/deploy/chart/templates/servicemonitor.yaml index f8fb67b..2e7b267 100644 --- a/deploy/chart/templates/servicemonitor.yaml +++ b/deploy/chart/templates/servicemonitor.yaml @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "openshift-routes.fullname" . }} + namespace: {{ include "openshift-routes.namespace" . }} labels: {{- include "openshift-routes.labels" . | nindent 4 }} spec: diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index d3208e4..a2bb672 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -5,6 +5,8 @@ logLevel: 5 nameOverride: "" fullnameOverride: "" +namespace: "" + image: # https://github.com/cert-manager/openshift-routes/pkgs/container/cert-manager-openshift-routes # the final image is generated as "${registry}/${repostiory}:${tag|digest}" From 64f8fd289d4c8a34094489463aec4c510ede326c Mon Sep 17 00:00:00 2001 From: Jan <55805868+Jaydee94@users.noreply.github.com> Date: Sat, 1 Jun 2024 13:04:32 +0200 Subject: [PATCH 2/3] Update deploy/chart/templates/_helpers.tpl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maël Valais Signed-off-by: Jan <55805868+Jaydee94@users.noreply.github.com> --- deploy/chart/templates/_helpers.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deploy/chart/templates/_helpers.tpl b/deploy/chart/templates/_helpers.tpl index a7c6752..9551bee 100644 --- a/deploy/chart/templates/_helpers.tpl +++ b/deploy/chart/templates/_helpers.tpl @@ -33,7 +33,11 @@ Create chart name and version as used by the chart label. {{/* Namespace for all resources to be installed into If not defined in values file then the helm release namespace is used -By default this is not set so the helm release namespace will be used +By default this is not set so the helm release namespace will be used. + + +This gets around an problem within Helm discussed in +https://github.com/helm/helm/issues/5358. */}} {{- define "openshift-routes.namespace" -}} {{ .Values.namespace | default .Release.Namespace }} From cb6b234addfaff7499c8be25c67d2ae7b86c4325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Valais?= Date: Mon, 3 Jun 2024 09:55:41 +0200 Subject: [PATCH 3/3] helm: explain what "namespace" is about MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maël Valais --- deploy/chart/values.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index a2bb672..2990d56 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -5,6 +5,9 @@ logLevel: 5 nameOverride: "" fullnameOverride: "" +# This namespace allows you to define where the services are installed into. +# If not set then they use the namespace of the release. +# This is helpful when installing cert manager as a chart dependency (sub chart). namespace: "" image: