From c737cd089503d98bac96d28d5ab393dbb8aae757 Mon Sep 17 00:00:00 2001 From: Maxime Vidori Date: Wed, 28 Jun 2023 01:51:49 +0200 Subject: [PATCH] Tenant chart: : add extra resources capability (#1643) This commit introduces an extraResources value which is directly rendered as part of the chart like a regular Helm template. This allows users to add some Kubernetes object they might need as part of their cluster configuration. I added in the comment an example of my use case because I use a different type of ingress and it is easier to configure it this way. Closes: #1642 Co-authored-by: Pedro Juarez --- helm/tenant/templates/_helpers.tpl | 14 ++++++++++++++ helm/tenant/templates/extra-resources.yaml | 4 ++++ 2 files changed, 18 insertions(+) create mode 100644 helm/tenant/templates/extra-resources.yaml diff --git a/helm/tenant/templates/_helpers.tpl b/helm/tenant/templates/_helpers.tpl index ca3bdc46930..91e5194097b 100644 --- a/helm/tenant/templates/_helpers.tpl +++ b/helm/tenant/templates/_helpers.tpl @@ -82,3 +82,17 @@ Selector labels Operator app.kubernetes.io/name: {{ include "minio-operator.name" . }} app.kubernetes.io/instance: {{ printf "%s-%s" .Release.Name "console" }} {{- end -}} + + +{{/* +Renders a value that contains template. +Usage: +{{ include "minio-operator.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "minio-operator.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/tenant/templates/extra-resources.yaml b/helm/tenant/templates/extra-resources.yaml new file mode 100644 index 00000000000..13c5e9a9e7d --- /dev/null +++ b/helm/tenant/templates/extra-resources.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraResources }} +--- +{{- include "minio-operator.render" (dict "value" . "context" $) }} +{{- end }}