diff --git a/helm/tenant/templates/NOTES.txt b/helm/tenant/templates/NOTES.txt index 235e67af26d..20f65e3be60 100644 --- a/helm/tenant/templates/NOTES.txt +++ b/helm/tenant/templates/NOTES.txt @@ -2,11 +2,11 @@ To connect to the {{ .name }} tenant if it doesn't have a service exposed, you can port-forward to it by running: {{- if dig "certificate" "requestAutoCert" false . }} - kubectl --namespace {{ $.Release.Namespace }} port-forward svc/{{ .name }}-console 9443:9443 + kubectl --namespace {{ template "minio-tenant.namespace" $ }} port-forward svc/{{ .name }}-console 9443:9443 Then visit the MinIO Console at https://127.0.0.1:9443 {{ else }} - kubectl --namespace {{ $.Release.Namespace }} port-forward svc/{{ .name }}-console 9090:9090 + kubectl --namespace {{ template "minio-tenant.namespace" $ }} port-forward svc/{{ .name }}-console 9090:9090 Then visit the MinIO Console at http://127.0.0.1:9090 {{ end }} diff --git a/helm/tenant/templates/_helpers.tpl b/helm/tenant/templates/_helpers.tpl index 91e5194097b..ef48a26e547 100644 --- a/helm/tenant/templates/_helpers.tpl +++ b/helm/tenant/templates/_helpers.tpl @@ -20,6 +20,17 @@ If release name contains chart name it will be used as a full name. {{- end -}} {{- end -}} +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts +*/}} +{{- define "minio-tenant.namespace" -}} + {{- if .Values.namespaceOverride -}} + {{- .Values.namespaceOverride -}} + {{- else -}} + {{- .Release.Namespace -}} + {{- end -}} +{{- end -}} + {{/* Expand the name of the Operator Console. */}} diff --git a/helm/tenant/templates/api-ingress.yaml b/helm/tenant/templates/api-ingress.yaml index 25038cddb3f..87eff2ee8ab 100644 --- a/helm/tenant/templates/api-ingress.yaml +++ b/helm/tenant/templates/api-ingress.yaml @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ .Values.tenant.name }} + namespace: {{ template "minio-tenant.namespace" $ }} {{- with .Values.ingress.api.labels }} labels: {{ toYaml . | nindent 4 }} {{- end }} diff --git a/helm/tenant/templates/console-ingress.yaml b/helm/tenant/templates/console-ingress.yaml index 01382faf545..a56aee8ccdc 100644 --- a/helm/tenant/templates/console-ingress.yaml +++ b/helm/tenant/templates/console-ingress.yaml @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ .Values.tenant.name }}-console + namespace: {{ template "minio-tenant.namespace" $ }} {{- with .Values.ingress.console.labels }} labels: {{ toYaml . | nindent 4 }} {{- end }} diff --git a/helm/tenant/templates/kes-configuration-secret.yaml b/helm/tenant/templates/kes-configuration-secret.yaml index bdbe0ecbb86..5c91c4967ea 100644 --- a/helm/tenant/templates/kes-configuration-secret.yaml +++ b/helm/tenant/templates/kes-configuration-secret.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: kes-configuration + namespace: {{ template "minio-tenant.namespace" $ }} type: Opaque stringData: server-config.yaml: {{ .Values.tenant.kes.configuration | toYaml | indent 2 }} diff --git a/helm/tenant/templates/tenant-configuration.yaml b/helm/tenant/templates/tenant-configuration.yaml index d749cc4fa7e..9f005e05a0c 100644 --- a/helm/tenant/templates/tenant-configuration.yaml +++ b/helm/tenant/templates/tenant-configuration.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ dig "secrets" "name" "" (.Values | merge (dict)) }} + namespace: {{ template "minio-tenant.namespace" $ }} type: Opaque stringData: config.env: |- diff --git a/helm/tenant/templates/tenant.yaml b/helm/tenant/templates/tenant.yaml index e21e9247712..eda486c3b93 100644 --- a/helm/tenant/templates/tenant.yaml +++ b/helm/tenant/templates/tenant.yaml @@ -3,6 +3,7 @@ apiVersion: minio.min.io/v2 kind: Tenant metadata: name: {{ .name }} + namespace: {{ template "minio-tenant.namespace" $ }} ## Optionally pass labels to be applied to the statefulset pods labels: app: minio diff --git a/helm/tenant/values.yaml b/helm/tenant/values.yaml index 996eb246fef..8fd33836e73 100644 --- a/helm/tenant/values.yaml +++ b/helm/tenant/values.yaml @@ -1,3 +1,6 @@ + +# Override the tenant namespace +namespaceOverride: "" ## Secret with default environment variable configurations to be used by MinIO Tenant. ## Not recommended for production deployments! Create the secret manually instead. secrets: