From dd9ba25960311fc2ca4c9761710d28cf27413154 Mon Sep 17 00:00:00 2001 From: jaydee94 Date: Mon, 6 May 2024 13:01:09 +0200 Subject: [PATCH] Add namespace value for configuring the destination namespace of the kubernetes manifests --- 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}"