From 2b96153a617cb2abf1a2bccea4da29c37065a954 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Sat, 14 Nov 2026 15:15:10 -0500 Subject: [PATCH] [helm] Improvements to Helm chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support releasing on “chart-” tags, fixes #223 * Add commonLabels that are used on all resources * Support templated values in numerous locations * Add oidc.existingConfigMapName and oidc.existingConfigUrlKey * Add networkPolicy.allowFrom * support targetLabels on ServiceMonitor * Support Probe relabelingConfigs * Allow postJob default containerSecurityContext * Allow policies to be templated string * Set MINIO_BROWSER_REDIRECT_URL * Ensure job egress only enabled when networkPolicy.egress.enabled set Signed-off-by: Trey Dockendorf --- .github/workflows/release-helm.yml | 31 +++++++++++++++ helm/silo/Chart.yaml | 2 +- helm/silo/README.md | 16 ++++---- helm/silo/templates/_helper_create_bucket.txt | 2 +- helm/silo/templates/_helper_create_policy.txt | 6 ++- helm/silo/templates/_helpers.tpl | 10 ++--- helm/silo/templates/ciliumnetworkpolicy.yaml | 3 ++ helm/silo/templates/configmap.yaml | 9 ++++- helm/silo/templates/console-ingress.yaml | 11 ++++-- helm/silo/templates/console-service.yaml | 8 +++- helm/silo/templates/deployment.yaml | 38 ++++++++++++++----- helm/silo/templates/ingress.yaml | 11 ++++-- helm/silo/templates/networkpolicy.yaml | 14 +++++-- helm/silo/templates/poddisruptionbudget.yaml | 3 ++ helm/silo/templates/post-job.yaml | 34 ++++++++++------- helm/silo/templates/pvc.yaml | 12 ++++-- helm/silo/templates/secrets.yaml | 3 ++ .../templates/securitycontextconstraints.yaml | 3 ++ helm/silo/templates/service.yaml | 8 +++- helm/silo/templates/serviceaccount.yaml | 4 ++ helm/silo/templates/servicemonitor.yaml | 27 +++++++++---- helm/silo/templates/statefulset.yaml | 24 ++++++++---- helm/silo/values.yaml | 25 ++++++++++++ 23 files changed, 229 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/release-helm.yml diff --git a/.github/workflows/release-helm.yml b/.github/workflows/release-helm.yml new file mode 100644 index 000000000..b08dcb88d --- /dev/null +++ b/.github/workflows/release-helm.yml @@ -0,0 +1,31 @@ +name: Publish Helm Chart to GHCR + +on: + push: + tags: + - "chart-.*" + +permissions: + contents: read + packages: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Install Helm + uses: azure/setup-helm@v4 + + - name: Log in to GitHub Container Registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io \ + --username ${{ github.actor }} \ + --password-stdin + + - name: Package and Push Helm Chart + run: | + helm package helm/silo + helm push silo-*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts diff --git a/helm/silo/Chart.yaml b/helm/silo/Chart.yaml index 9fee02110..c03ed1d24 100644 --- a/helm/silo/Chart.yaml +++ b/helm/silo/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: S3-Interface Libre Object Storage name: silo -version: 7.0.5 +version: 7.1.0 appVersion: RELEASE.2026-11-12T00-00-00Z keywords: - silo diff --git a/helm/silo/README.md b/helm/silo/README.md index bbe43ac51..9f332a305 100644 --- a/helm/silo/README.md +++ b/helm/silo/README.md @@ -7,15 +7,15 @@ The chart and server are licensed under AGPL-3.0-or-later. ## Prerequisites - Kubernetes 1.19 or later -- Helm 3 +- Helm 3 or 4 - A PersistentVolume provisioner unless `persistence.enabled=false` ## Install -From this repository: +From GHCR: ```bash -helm install silo ./helm/silo \ +helm install silo oci://ghcr.io/pgsty/charts/silo \ --namespace silo --create-namespace \ --set rootUser=silo-admin \ --set rootPassword='replace-with-a-long-random-secret' @@ -24,7 +24,7 @@ helm install silo ./helm/silo \ For a disposable standalone installation: ```bash -helm install silo ./helm/silo \ +helm install silo oci://ghcr.io/pgsty/charts/silo \ --namespace silo --create-namespace \ --set mode=standalone \ --set replicas=1 \ @@ -64,7 +64,7 @@ helm get values my-release -n my-namespace -a > values.before-silo.yaml SILO_TAG='' MCLI_TAG='' -helm template my-release ./helm/silo \ +helm template my-release oci://ghcr.io/pgsty/charts/silo \ -n my-namespace \ -f values.before-silo.yaml \ --set nameOverride=minio \ @@ -84,7 +84,7 @@ mounts. After review, upgrade the chart and image together: ```bash SILO_TAG='' MCLI_TAG='' -helm upgrade my-release ./helm/silo \ +helm upgrade my-release oci://ghcr.io/pgsty/charts/silo \ -n my-namespace \ -f values.before-silo.yaml \ --set nameOverride=minio \ @@ -126,13 +126,13 @@ The default PersistentVolumeClaim mounts at `/export`. Use an existing claim with: ```bash -helm install silo ./helm/silo --set persistence.existingClaim=PVC_NAME +helm install silo oci://ghcr.io/pgsty/charts/silo --set persistence.existingClaim=PVC_NAME ``` Create a TLS Secret containing `private.key` and `public.crt`, then set: ```bash -helm upgrade --install silo ./helm/silo \ +helm upgrade --install silo oci://ghcr.io/pgsty/charts/silo \ --set tls.enabled=true \ --set tls.certSecret=silo-tls ``` diff --git a/helm/silo/templates/_helper_create_bucket.txt b/helm/silo/templates/_helper_create_bucket.txt index fe1e80498..85d330146 100644 --- a/helm/silo/templates/_helper_create_bucket.txt +++ b/helm/silo/templates/_helper_create_bucket.txt @@ -119,5 +119,5 @@ connectToSilo $scheme {{ $global := . }} # Create the buckets {{- range .Values.buckets }} -createBucket {{ tpl .name $global }} {{ .policy | default "none" | quote }} {{ .purge | default false }} {{ .versioning | default "" }} {{ .objectlocking | default false }}{{- end }} +createBucket {{ tpl .name $global }} {{ tpl .policy $global | default "none" | quote }} {{ .purge | default false }} {{ .versioning | default "" }} {{ .objectlocking | default false }}{{- end }} {{- end }} diff --git a/helm/silo/templates/_helper_create_policy.txt b/helm/silo/templates/_helper_create_policy.txt index 638a83900..1a760a675 100644 --- a/helm/silo/templates/_helper_create_policy.txt +++ b/helm/silo/templates/_helper_create_policy.txt @@ -68,8 +68,12 @@ scheme=http connectToSilo $scheme {{ if .Values.policies }} +{{- $policies := .Values.policies }} +{{- if typeIs "string" .Values.policies }} + {{- $policies = tpl .Values.policies . | fromYamlArray }} +{{- end }} # Create the policies -{{- range $idx, $policy := .Values.policies }} +{{- range $idx, $policy := $policies }} createPolicy {{ $policy.name }} policy_{{ $idx }} {{- end }} {{- end }} diff --git a/helm/silo/templates/_helpers.tpl b/helm/silo/templates/_helpers.tpl index 5ce8ab39b..6e969f942 100644 --- a/helm/silo/templates/_helpers.tpl +++ b/helm/silo/templates/_helpers.tpl @@ -131,14 +131,14 @@ Also, we can not use a single if because lazy evaluation is not an option {{- if .Values.global }} {{- if .Values.global.imagePullSecrets }} imagePullSecrets: - {{ toYaml .Values.global.imagePullSecrets }} + {{ tpl (toYaml .Values.global.imagePullSecrets) $ }} {{- else if .Values.imagePullSecrets }} imagePullSecrets: - {{ toYaml .Values.imagePullSecrets }} + {{ tpl (toYaml .Values.imagePullSecrets) $ }} {{- end -}} {{- else if .Values.imagePullSecrets }} imagePullSecrets: - {{ toYaml .Values.imagePullSecrets }} + {{ tpl (toYaml .Values.imagePullSecrets) $ }} {{- end -}} {{- end -}} @@ -201,7 +201,7 @@ otherwise it generates a random value. {{- define "silo.root.username" -}} {{- if .Values.rootUser }} - {{- .Values.rootUser | toString }} + {{- tpl .Values.rootUser . | toString }} {{- else }} {{- include "silo.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "silo.fullname" .) "Length" 20 "Key" "rootUser") }} {{- end }} @@ -209,7 +209,7 @@ otherwise it generates a random value. {{- define "silo.root.password" -}} {{- if .Values.rootPassword }} - {{- .Values.rootPassword | toString }} + {{- tpl .Values.rootPassword . | toString }} {{- else }} {{- include "silo.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "silo.fullname" .) "Length" 40 "Key" "rootPassword") }} {{- end }} diff --git a/helm/silo/templates/ciliumnetworkpolicy.yaml b/helm/silo/templates/ciliumnetworkpolicy.yaml index d9d50301b..1b77646b3 100644 --- a/helm/silo/templates/ciliumnetworkpolicy.yaml +++ b/helm/silo/templates/ciliumnetworkpolicy.yaml @@ -8,6 +8,9 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} spec: endpointSelector: matchLabels: diff --git a/helm/silo/templates/configmap.yaml b/helm/silo/templates/configmap.yaml index c3636564d..575d3cbd4 100644 --- a/helm/silo/templates/configmap.yaml +++ b/helm/silo/templates/configmap.yaml @@ -7,6 +7,9 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} data: initialize: |- {{- include (print $.Template.BasePath "/_helper_create_bucket.txt") . | nindent 4 }} @@ -14,7 +17,11 @@ data: {{- include (print $.Template.BasePath "/_helper_create_user.txt") . | nindent 4 }} add-policy: |- {{- include (print $.Template.BasePath "/_helper_create_policy.txt") . | nindent 4 }} - {{- range $idx, $policy := .Values.policies }} + {{- $policies := .Values.policies }} + {{- if typeIs "string" .Values.policies }} + {{- $policies = tpl .Values.policies . | fromYamlArray }} + {{- end }} + {{- range $idx, $policy := $policies }} # Policy: {{ $policy.name }} policy_{{ $idx }}.json: |- {{- include (print $.Template.BasePath "/_helper_policy.tpl") . | nindent 4 }} diff --git a/helm/silo/templates/console-ingress.yaml b/helm/silo/templates/console-ingress.yaml index 248d9ce70..40941235a 100644 --- a/helm/silo/templates/console-ingress.yaml +++ b/helm/silo/templates/console-ingress.yaml @@ -12,10 +12,13 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- with .Values.consoleIngress.labels }} - {{- toYaml . | nindent 4 }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} {{- with .Values.consoleIngress.annotations }} - annotations: {{- toYaml . | nindent 4 }} + annotations: {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: {{- if .Values.consoleIngress.ingressClassName }} @@ -26,9 +29,9 @@ spec: {{- range .Values.consoleIngress.tls }} - hosts: {{- range .hosts }} - - {{ . | quote }} + - {{ tpl . $ | quote }} {{- end }} - secretName: {{ .secretName }} + secretName: {{ tpl .secretName $ }} {{- end }} {{- end }} rules: diff --git a/helm/silo/templates/console-service.yaml b/helm/silo/templates/console-service.yaml index f7f488e0f..d74760611 100644 --- a/helm/silo/templates/console-service.yaml +++ b/helm/silo/templates/console-service.yaml @@ -8,8 +8,12 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.consoleService.annotations }} - annotations: {{- toYaml .Values.consoleService.annotations | nindent 4 }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.consoleService.annotations }} + annotations: + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: type: {{ .Values.consoleService.type }} diff --git a/helm/silo/templates/deployment.yaml b/helm/silo/templates/deployment.yaml index 259890fab..e4d03e22d 100644 --- a/helm/silo/templates/deployment.yaml +++ b/helm/silo/templates/deployment.yaml @@ -10,11 +10,15 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.additionalLabels }} - {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- with .Values.additionalLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} - {{- if .Values.additionalAnnotations }} - annotations: {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.additionalAnnotations }} + annotations: + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: strategy: @@ -35,8 +39,11 @@ spec: labels: app: {{ template "silo.name" . }} release: {{ .Release.Name }} - {{- if .Values.podLabels }} - {{- toYaml .Values.podLabels | nindent 8 }} + {{- with .Values.podLabels }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} annotations: {{- if not .Values.ignoreChartChecksums }} @@ -62,7 +69,7 @@ spec: {{- end }} containers: - name: {{ include "silo.name" . }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: - "/bin/sh" @@ -111,7 +118,14 @@ spec: {{- end }} {{- if .Values.oidc.enabled }} - name: MINIO_IDENTITY_OPENID_CONFIG_URL + {{- if and .Values.oidc.existingConfigMapName .Values.oidc.existingConfigUrlKey }} + valueFrom: + configMapKeyRef: + name: {{ .Values.oidc.existingConfigMapName }} + key: {{ .Values.oidc.existingConfigUrlKey }} + {{- else }} value: {{ .Values.oidc.configUrl }} + {{- end }} - name: MINIO_IDENTITY_OPENID_CLIENT_ID {{- if and .Values.oidc.existingClientSecretName .Values.oidc.existingClientIdKey }} valueFrom: @@ -135,11 +149,15 @@ spec: - name: MINIO_IDENTITY_OPENID_CLAIM_PREFIX value: {{ .Values.oidc.claimPrefix }} - name: MINIO_IDENTITY_OPENID_SCOPES - value: {{ .Values.oidc.scopes }} + value: {{ tpl .Values.oidc.scopes . }} - name: MINIO_IDENTITY_OPENID_COMMENT value: {{ .Values.oidc.comment }} + {{- if .Values.oidc.redirectUri }} - name: MINIO_IDENTITY_OPENID_REDIRECT_URI - value: {{ .Values.oidc.redirectUri }} + value: {{ tpl .Values.oidc.redirectUri . }} + {{- end }} + - name: MINIO_BROWSER_REDIRECT_URL + value: {{ tpl .Values.oidc.redirectUrl . }} - name: MINIO_IDENTITY_OPENID_DISPLAY_NAME value: {{ .Values.oidc.displayName }} {{- end }} @@ -181,7 +199,7 @@ spec: {{- end }} {{- end }} {{- with .Values.nodeSelector }} - nodeSelector: {{- toYaml . | nindent 8 }} + nodeSelector: {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} {{- include "silo.imagePullSecrets" . | indent 6 }} {{- with .Values.affinity }} diff --git a/helm/silo/templates/ingress.yaml b/helm/silo/templates/ingress.yaml index e5422a6ea..4c864f4a2 100644 --- a/helm/silo/templates/ingress.yaml +++ b/helm/silo/templates/ingress.yaml @@ -12,10 +12,13 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- with .Values.ingress.labels }} - {{- toYaml . | nindent 4 }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} {{- with .Values.ingress.annotations }} - annotations: {{- toYaml . | nindent 4 }} + annotations: {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: {{- if .Values.ingress.ingressClassName }} @@ -26,9 +29,9 @@ spec: {{- range .Values.ingress.tls }} - hosts: {{- range .hosts }} - - {{ . | quote }} + - {{ tpl . $ | quote }} {{- end }} - secretName: {{ .secretName }} + secretName: {{ tpl .secretName $ }} {{- end }} {{- end }} rules: diff --git a/helm/silo/templates/networkpolicy.yaml b/helm/silo/templates/networkpolicy.yaml index 5bc822fb1..ad85f19d5 100644 --- a/helm/silo/templates/networkpolicy.yaml +++ b/helm/silo/templates/networkpolicy.yaml @@ -8,6 +8,9 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} spec: podSelector: matchLabels: @@ -19,11 +22,16 @@ spec: protocol: TCP - port: {{ .Values.minioConsolePort }} protocol: TCP - {{- if not .Values.networkPolicy.allowExternal }} + {{- if or (not .Values.networkPolicy.allowExternal) .Values.networkPolicy.allowFrom }} from: + {{- if not .Values.networkPolicy.allowExternal }} - podSelector: matchLabels: {{ template "silo.name" . }}-client: "true" + {{- end }} + {{- with .Values.networkPolicy.allowFrom }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} {{- end }} {{- if .Values.networkPolicy.egress.enabled }} egress: @@ -34,6 +42,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} +{{- if .Values.networkPolicy.egress.enabled }} --- kind: NetworkPolicy apiVersion: {{ template "silo.networkPolicy.apiVersion" . }} @@ -55,12 +64,11 @@ spec: protocol: TCP - port: {{ .Values.minioConsolePort }} protocol: TCP - {{- if .Values.networkPolicy.egress.enabled }} - ports: {{ .Values.networkPolicy.egress.ports | toJson }} {{- with .Values.networkPolicy.egress.to }} to: {{- toYaml . | nindent 12 }} {{- end }} - {{- end }} +{{- end }} {{- end }} diff --git a/helm/silo/templates/poddisruptionbudget.yaml b/helm/silo/templates/poddisruptionbudget.yaml index aebc135f8..5ce5c15b2 100644 --- a/helm/silo/templates/poddisruptionbudget.yaml +++ b/helm/silo/templates/poddisruptionbudget.yaml @@ -9,6 +9,9 @@ metadata: name: {{ template "silo.fullname" . }} labels: app: {{ template "silo.name" . }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} spec: maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} selector: diff --git a/helm/silo/templates/post-job.yaml b/helm/silo/templates/post-job.yaml index 33fda394a..38a8507ed 100644 --- a/helm/silo/templates/post-job.yaml +++ b/helm/silo/templates/post-job.yaml @@ -8,11 +8,14 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} annotations: "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation {{- with .Values.postJob.annotations }} - {{- toYaml . | nindent 4 }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: template: @@ -23,14 +26,17 @@ spec: {{- if .Values.podLabels }} {{- toYaml .Values.podLabels | nindent 8 }} {{- end }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} {{- if .Values.postJob.podAnnotations }} annotations: {{- toYaml .Values.postJob.podAnnotations | nindent 8 }} {{- end }} spec: restartPolicy: OnFailure {{- include "silo.imagePullSecrets" . | indent 6 }} - {{- if .Values.nodeSelector }} - nodeSelector: {{- toYaml .Values.postJob.nodeSelector | nindent 8 }} + {{- if or .Values.nodeSelector .Values.postJob.nodeSelector }} + nodeSelector: {{- tpl (toYaml .Values.postJob.nodeSelector | default .Values.nodeSelector) . | nindent 8 }} {{- end }} {{- with .Values.postJob.affinity }} affinity: {{- toYaml . | nindent 8 }} @@ -39,7 +45,7 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.postJob.securityContext.enabled }} - securityContext: {{ omit .Values.postJob.securityContext "enabled" | toYaml | nindent 12 }} + securityContext: {{ omit .Values.postJob.securityContext "enabled" | toYaml | nindent 8 }} {{- end }} volumes: - name: etc-path @@ -88,9 +94,9 @@ spec: {{- if .Values.policies }} initContainers: - name: silo-make-policy - image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" + image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}" {{- if .Values.makePolicyJob.securityContext.enabled }} - {{- with .Values.makePolicyJob.containerSecurityContext }} + {{- with .Values.makePolicyJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{- end }} @@ -122,9 +128,9 @@ spec: containers: {{- if .Values.buckets }} - name: silo-make-bucket - image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" + image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}" {{- if .Values.makeBucketJob.securityContext.enabled }} - {{- with .Values.makeBucketJob.containerSecurityContext }} + {{- with .Values.makeBucketJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{- end }} @@ -155,9 +161,9 @@ spec: {{- end }} {{- if .Values.users }} - name: silo-make-user - image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" + image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}" {{- if .Values.makeUserJob.securityContext.enabled }} - {{- with .Values.makeUserJob.containerSecurityContext }} + {{- with .Values.makeUserJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{- end }} @@ -188,9 +194,9 @@ spec: {{- end }} {{- if .Values.customCommands }} - name: silo-custom-command - image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" + image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}" {{- if .Values.customCommandJob.securityContext.enabled }} - {{- with .Values.customCommandJob.containerSecurityContext }} + {{- with .Values.customCommandJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{- end }} @@ -224,9 +230,9 @@ spec: {{- end }} {{- if .Values.svcaccts }} - name: silo-make-svcacct - image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" + image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}" {{- if .Values.makeServiceAccountJob.securityContext.enabled }} - {{- with .Values.makeServiceAccountJob.containerSecurityContext }} + {{- with .Values.makeServiceAccountJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{- end }} diff --git a/helm/silo/templates/pvc.yaml b/helm/silo/templates/pvc.yaml index ce8ce895d..c1a688951 100644 --- a/helm/silo/templates/pvc.yaml +++ b/helm/silo/templates/pvc.yaml @@ -9,8 +9,12 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.persistence.annotations }} - annotations: {{- toYaml .Values.persistence.annotations | nindent 4 }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.persistence.annotations }} + annotations: + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: accessModes: @@ -18,11 +22,11 @@ spec: resources: requests: storage: {{ .Values.persistence.size | quote }} - {{- if .Values.persistence.storageClass }} + {{- if or .Values.persistence.storageClass .Values.global.storageClass }} {{- if (eq "-" .Values.persistence.storageClass) }} storageClassName: "" {{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" + storageClassName: "{{ .Values.persistence.storageClass | default .Values.global.storageClass }}" {{- end }} {{- end }} {{- if .Values.persistence.volumeName }} diff --git a/helm/silo/templates/secrets.yaml b/helm/silo/templates/secrets.yaml index ee2b423b7..e12c112ea 100644 --- a/helm/silo/templates/secrets.yaml +++ b/helm/silo/templates/secrets.yaml @@ -8,6 +8,9 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} type: Opaque data: rootUser: {{ include "silo.root.username" . | b64enc | quote }} diff --git a/helm/silo/templates/securitycontextconstraints.yaml b/helm/silo/templates/securitycontextconstraints.yaml index 9ab6fc5eb..e656068f1 100644 --- a/helm/silo/templates/securitycontextconstraints.yaml +++ b/helm/silo/templates/securitycontextconstraints.yaml @@ -8,6 +8,9 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} allowHostDirVolumePlugin: false allowHostIPC: false allowHostNetwork: false diff --git a/helm/silo/templates/service.yaml b/helm/silo/templates/service.yaml index 5f032b447..87901f541 100644 --- a/helm/silo/templates/service.yaml +++ b/helm/silo/templates/service.yaml @@ -9,8 +9,12 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} monitoring: "true" - {{- if .Values.service.annotations }} - annotations: {{- toYaml .Values.service.annotations | nindent 4 }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.service.annotations }} + annotations: + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: type: {{ .Values.service.type }} diff --git a/helm/silo/templates/serviceaccount.yaml b/helm/silo/templates/serviceaccount.yaml index 07840153d..e7086791d 100644 --- a/helm/silo/templates/serviceaccount.yaml +++ b/helm/silo/templates/serviceaccount.yaml @@ -3,4 +3,8 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ .Values.serviceAccount.name | quote }} + {{- with .Values.commonLabels }} + labels: + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} {{- end }} diff --git a/helm/silo/templates/servicemonitor.yaml b/helm/silo/templates/servicemonitor.yaml index 8bd15eb5b..4f0d51020 100644 --- a/helm/silo/templates/servicemonitor.yaml +++ b/helm/silo/templates/servicemonitor.yaml @@ -11,8 +11,11 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.metrics.serviceMonitor.additionalLabels }} - {{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }} + {{- with .Values.metrics.serviceMonitor.additionalLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} {{- if .Values.metrics.serviceMonitor.annotations }} annotations: {{- toYaml .Values.metrics.serviceMonitor.annotations | nindent 4 }} @@ -39,8 +42,8 @@ spec: {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} {{- end }} - {{- if .Values.metrics.serviceMonitor.relabelConfigs }} - {{- toYaml .Values.metrics.serviceMonitor.relabelConfigs | nindent 6 }} + {{- with .Values.metrics.serviceMonitor.relabelConfigs }} + {{- tpl (toYaml .) $ | nindent 6 }} {{- end }} {{- if not .Values.metrics.serviceMonitor.public }} bearerTokenSecret: @@ -55,6 +58,10 @@ spec: app: {{ include "silo.name" . }} release: {{ .Release.Name }} monitoring: "true" + {{- with .Values.metrics.serviceMonitor.targetLabels }} + targetLabels: + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} {{- end }} {{- if .Values.metrics.serviceMonitor.enabled }} --- @@ -70,8 +77,8 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.metrics.serviceMonitor.additionalLabels }} - {{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }} + {{- with .Values.metrics.serviceMonitor.additionalLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: jobName: {{ template "silo.fullname" . }} @@ -91,13 +98,17 @@ spec: {{- else }} scheme: http {{- end }} - {{- if .Values.metrics.serviceMonitor.relabelConfigsCluster }} - {{- toYaml .Values.metrics.serviceMonitor.relabelConfigsCluster | nindent 2 }} + {{- with .Values.metrics.serviceMonitor.relabelConfigsCluster }} + {{- tpl (toYaml .) $ | nindent 2 }} {{- end }} targets: staticConfig: static: - {{ template "silo.fullname" . }}.{{ .Release.Namespace }} + {{- with .Values.metrics.serviceMonitor.probeRelabelingConfigs }} + relabelingConfigs: + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} {{- if not .Values.metrics.serviceMonitor.public }} {{- if .Values.metrics.serviceMonitor.interval }} interval: {{ .Values.metrics.serviceMonitor.interval }} diff --git a/helm/silo/templates/statefulset.yaml b/helm/silo/templates/statefulset.yaml index 0258a7ee3..a730b241b 100644 --- a/helm/silo/templates/statefulset.yaml +++ b/helm/silo/templates/statefulset.yaml @@ -20,6 +20,9 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} spec: publishNotReadyAddresses: true clusterIP: None @@ -41,11 +44,15 @@ metadata: chart: {{ template "silo.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.additionalLabels }} - {{- toYaml .Values.additionalLabels | nindent 4 }} + {{- with .Values.additionalLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} - {{- if .Values.additionalAnnotations }} - annotations: {{- toYaml .Values.additionalAnnotations | nindent 4 }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 4 }} + {{- end }} + {{- with .Values.additionalAnnotations }} + annotations: + {{- tpl (toYaml .) $ | nindent 4 }} {{- end }} spec: updateStrategy: @@ -63,8 +70,11 @@ spec: labels: app: {{ template "silo.name" . }} release: {{ .Release.Name }} - {{- if .Values.podLabels }} - {{- toYaml .Values.podLabels | nindent 8 }} + {{- with .Values.podLabels }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with .Values.commonLabels }} + {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} annotations: {{- if not .Values.ignoreChartChecksums }} @@ -90,7 +100,7 @@ spec: {{- end }} containers: - name: {{ include "silo.name" . }} - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + image: {{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: [ "/bin/sh", diff --git a/helm/silo/values.yaml b/helm/silo/values.yaml index 52d8df3b1..9ee9f33a0 100644 --- a/helm/silo/values.yaml +++ b/helm/silo/values.yaml @@ -37,6 +37,9 @@ additionalLabels: {} ## Additional annotations to include with deployment or statefulset additionalAnnotations: {} +## Common labels applied to all resources +commonLabels: {} + ## Typically the deployment/statefulset includes checksums of secrets/config, ## So that when these change on a subsequent helm install, the deployment/statefulset ## is restarted. This can result in unnecessary restarts under GitOps tooling such as @@ -358,6 +361,7 @@ makePolicyJob: enabled: false runAsUser: 1000 runAsGroup: 1000 + containerSecurityContext: {} resources: requests: memory: 128Mi @@ -388,6 +392,7 @@ makeUserJob: enabled: false runAsUser: 1000 runAsGroup: 1000 + containerSecurityContext: {} resources: requests: memory: 128Mi @@ -428,6 +433,7 @@ makeServiceAccountJob: enabled: false runAsUser: 1000 runAsGroup: 1000 + containerSecurityContext: {} resources: requests: memory: 128Mi @@ -465,6 +471,7 @@ makeBucketJob: enabled: false runAsUser: 1000 runAsGroup: 1000 + containerSecurityContext: {} resources: requests: memory: 128Mi @@ -483,6 +490,7 @@ customCommandJob: enabled: false runAsUser: 1000 runAsGroup: 1000 + containerSecurityContext: {} resources: requests: memory: 128Mi @@ -510,6 +518,7 @@ postJob: runAsUser: 1000 runAsGroup: 1000 fsGroup: 1000 + containerSecurityContext: {} nodeSelector: {} tolerations: [] affinity: {} @@ -532,6 +541,9 @@ extraSecret: ~ oidc: enabled: false configUrl: "https://identity-provider-url/.well-known/openid-configuration" + # Provide existing ConfigMap for the Config URL + existingConfigMapName: "" + existingConfigUrlKey: "" clientId: "silo" clientSecret: "" # Provide existing client secret from the Kubernetes Secret resource, existing secret will have priority over `clientId` and/or `clientSecret`` @@ -540,7 +552,10 @@ oidc: existingClientSecretKey: "" claimName: "policy" scopes: "openid,profile,email" + # Deprecated: Use redirectUrl and set this to `false` or an empty string redirectUri: "https://console-endpoint-url/oauth_callback" + # Use in favor of `redirectUri` to set `MINIO_BROWSER_REDIRECT_URL` + redirectUrl: "https://console-endpoint-url" # Can leave empty claimPrefix: "" comment: "" @@ -553,6 +568,12 @@ networkPolicy: flavor: kubernetes # Allow external access to the Silo API. allowExternal: true + # Additional from values to add to the Ingress + allowFrom: [] + ## E.X. + # - namespaceSelector: + # matchLabels: + # kubernetes.io/metadata.name: prometheus ## @params networkPolicy.egress configuration of the egress traffic egress: ## @param networkPolicy.egress.enabled When enabled, an egress network policy will be @@ -604,6 +625,8 @@ metrics: public: true additionalLabels: {} annotations: {} + # targetLabels for the ServiceMonitor + targetLabels: [] # for node metrics relabelConfigs: {} # for cluster metrics @@ -612,6 +635,8 @@ metrics: # metricRelabelings: # - regex: (server|pod) # action: labeldrop + # Probe relabelingConfigs added to the probe target + probeRelabelingConfigs: [] namespace: ~ # Scrape interval, for example `interval: 30s` interval: ~