Skip to content

Commit

Permalink
feat: Allow the Helm release namespace to be overridden
Browse files Browse the repository at this point in the history
for multi-namespace deployments in combined charts

Signed-off-by: Mathieu Parent <[email protected]>
  • Loading branch information
sathieu committed Oct 11, 2023
1 parent d619113 commit e65b3ab
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions helm/tenant/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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-operator.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-operator.namespace" $ }} port-forward svc/{{ .name }}-console 9090:9090

Then visit the MinIO Console at http://127.0.0.1:9090
{{ end }}
Expand Down
11 changes: 11 additions & 0 deletions helm/tenant/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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-operator.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Expand the name of the Operator Console.
*/}}
Expand Down
1 change: 1 addition & 0 deletions helm/tenant/templates/api-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.tenant.name }}
namespace: {{ template "minio-operator.namespace" $ }}
{{- with .Values.ingress.api.labels }}
labels: {{ toYaml . | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions helm/tenant/templates/console-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.tenant.name }}-console
namespace: {{ template "minio-operator.namespace" $ }}
{{- with .Values.ingress.console.labels }}
labels: {{ toYaml . | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions helm/tenant/templates/kes-configuration-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: kes-configuration
namespace: {{ template "minio-operator.namespace" $ }}
type: Opaque
stringData:
server-config.yaml: {{ .Values.tenant.kes.configuration | toYaml | indent 2 }}
Expand Down
1 change: 1 addition & 0 deletions helm/tenant/templates/tenant-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ dig "secrets" "name" "" (.Values | merge (dict)) }}
namespace: {{ template "minio-operator.namespace" $ }}
type: Opaque
stringData:
config.env: |-
Expand Down
1 change: 1 addition & 0 deletions helm/tenant/templates/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: minio.min.io/v2
kind: Tenant
metadata:
name: {{ .name }}
namespace: {{ template "minio-operator.namespace" $ }}
## Optionally pass labels to be applied to the statefulset pods
labels:
app: minio
Expand Down
2 changes: 2 additions & 0 deletions helm/tenant/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 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:
Expand Down

0 comments on commit e65b3ab

Please sign in to comment.