fix(helm): preserve upgrade values and validate chart publication

Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
Feng Ruohang
2026-11-25 11:35:05 +08:00
parent 2b96153a61
commit 7226aaf3fc
18 changed files with 257 additions and 172 deletions
+19 -9
View File
@@ -12,19 +12,22 @@ The chart and server are licensed under AGPL-3.0-or-later.
## Install
From GHCR:
From the source checkout:
```bash
helm install silo oci://ghcr.io/pgsty/charts/silo \
helm install silo ./helm/silo \
--namespace silo --create-namespace \
--set rootUser=silo-admin \
--set rootPassword='replace-with-a-long-random-secret'
```
For a version published on GHCR, use `oci://ghcr.io/pgsty/charts/silo` in
place of `./helm/silo` and pass `--version <chart-version>`.
For a disposable standalone installation:
```bash
helm install silo oci://ghcr.io/pgsty/charts/silo \
helm install silo ./helm/silo \
--namespace silo --create-namespace \
--set mode=standalone \
--set replicas=1 \
@@ -64,7 +67,7 @@ helm get values my-release -n my-namespace -a > values.before-silo.yaml
SILO_TAG='<published-silo-release-tag>'
MCLI_TAG='<published-mcli-release-tag>'
helm template my-release oci://ghcr.io/pgsty/charts/silo \
helm template my-release ./helm/silo \
-n my-namespace \
-f values.before-silo.yaml \
--set nameOverride=minio \
@@ -84,7 +87,7 @@ mounts. After review, upgrade the chart and image together:
```bash
SILO_TAG='<published-silo-release-tag>'
MCLI_TAG='<published-mcli-release-tag>'
helm upgrade my-release oci://ghcr.io/pgsty/charts/silo \
helm upgrade my-release ./helm/silo \
-n my-namespace \
-f values.before-silo.yaml \
--set nameOverride=minio \
@@ -122,17 +125,21 @@ When upgrading an existing Silo release to `RELEASE.2026-11-12T00-00-00Z` (chart
## Persistence and TLS
The default PersistentVolumeClaim mounts at `/export`. Use an existing claim
with:
The default PersistentVolumeClaim mounts at `/export`. New claims use
`persistence.storageClass` or inherit `global.storageClass` from a parent chart.
Helm preserves the existing storage class during a connected upgrade when only
the parent supplies a default.
Use an existing claim with:
```bash
helm install silo oci://ghcr.io/pgsty/charts/silo --set persistence.existingClaim=PVC_NAME
helm install silo ./helm/silo --set persistence.existingClaim=PVC_NAME
```
Create a TLS Secret containing `private.key` and `public.crt`, then set:
```bash
helm upgrade --install silo oci://ghcr.io/pgsty/charts/silo \
helm upgrade --install silo ./helm/silo \
--set tls.enabled=true \
--set tls.certSecret=silo-tls
```
@@ -141,6 +148,9 @@ Additional trusted CAs can be supplied through `trustedCertsSecret`.
## Existing Secrets and post-install resources
The chart treats `rootUser` and `rootPassword` as literal values. A parent chart
can opt into evaluating both as Helm templates with `tplRootCredentials: true`.
Set `existingSecret` to a Secret containing `rootUser` and `rootPassword`.
Buckets, users, policies, service accounts, and custom commands can be created
with the existing `buckets`, `users`, `policies`, `svcaccts`, and
@@ -119,5 +119,5 @@ connectToSilo $scheme
{{ $global := . }}
# Create the buckets
{{- range .Values.buckets }}
createBucket {{ tpl .name $global }} {{ tpl .policy $global | default "none" | quote }} {{ .purge | default false }} {{ .versioning | default "" }} {{ .objectlocking | default false }}{{- end }}
createBucket {{ tpl .name $global }} {{ tpl (default "none" .policy) $global | default "none" | quote }} {{ .purge | default false }} {{ ternary .versioning "" (ne .versioning nil) | quote }} {{ .objectlocking | default false }}{{- end }}
{{- end }}
+88 -20
View File
@@ -119,26 +119,34 @@ Properly format optional additional arguments to Silo binary
{{- end -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "silo.imagePullSecrets" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
Also, we can not use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{ tpl (toYaml .Values.global.imagePullSecrets) $ }}
{{- else if .Values.imagePullSecrets }}
imagePullSecrets:
{{ tpl (toYaml .Values.imagePullSecrets) $ }}
{{- with (or (.Values.global | default dict).imagePullSecrets .Values.imagePullSecrets) }}
imagePullSecrets: {{- tpl (toYaml .) $ | nindent 2 }}
{{- end }}
{{- end -}}
{{- else if .Values.imagePullSecrets }}
imagePullSecrets:
{{ tpl (toYaml .Values.imagePullSecrets) $ }}
{{/* Keep the class already chosen for an existing claim when a parent supplies a default. */}}
{{- define "silo.storageClass" -}}
{{- $class := or .Values.persistence.storageClass (.Values.global | default dict).storageClass -}}
{{- if $class -}}
{{- $spec := dict "storageClassName" (ternary "" $class (eq $class "-")) -}}
{{- if and .Release.IsUpgrade (not .Values.persistence.storageClass) -}}
{{- $name := include "silo.fullname" . -}}
{{- if eq .Values.mode "standalone" -}}
{{- with (lookup "v1" "PersistentVolumeClaim" .Release.Namespace $name) -}}
{{- $spec = .spec -}}
{{- end -}}
{{- else -}}
{{- with (lookup "apps/v1" "StatefulSet" .Release.Namespace $name) -}}
{{- with .spec.volumeClaimTemplates -}}
{{- $spec = (first .).spec -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if hasKey $spec "storageClassName" -}}
storageClassName: {{ $spec.storageClassName | quote }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -201,7 +209,11 @@ otherwise it generates a random value.
{{- define "silo.root.username" -}}
{{- if .Values.rootUser }}
{{- tpl .Values.rootUser . | toString }}
{{- if .Values.tplRootCredentials }}
{{- tpl (.Values.rootUser | toString) . }}
{{- else }}
{{- .Values.rootUser | toString }}
{{- end }}
{{- else }}
{{- include "silo.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "silo.fullname" .) "Length" 20 "Key" "rootUser") }}
{{- end }}
@@ -209,8 +221,64 @@ otherwise it generates a random value.
{{- define "silo.root.password" -}}
{{- if .Values.rootPassword }}
{{- tpl .Values.rootPassword . | toString }}
{{- if .Values.tplRootCredentials }}
{{- tpl (.Values.rootPassword | toString) . }}
{{- else }}
{{- .Values.rootPassword | toString }}
{{- end }}
{{- else }}
{{- include "silo.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "silo.fullname" .) "Length" 40 "Key" "rootPassword") }}
{{- end }}
{{- end -}}
{{/* OIDC environment shared by the standalone and distributed workloads. */}}
{{- define "silo.oidcEnv" -}}
{{- $oidc := .Values.oidc -}}
{{- if $oidc.enabled -}}
- name: MINIO_IDENTITY_OPENID_CONFIG_URL
{{- if and $oidc.existingConfigMapName $oidc.existingConfigUrlKey }}
valueFrom:
configMapKeyRef:
name: {{ $oidc.existingConfigMapName | quote }}
key: {{ $oidc.existingConfigUrlKey | quote }}
{{- else }}
value: {{ $oidc.configUrl | quote }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLIENT_ID
{{- if and $oidc.existingClientSecretName $oidc.existingClientIdKey }}
valueFrom:
secretKeyRef:
name: {{ $oidc.existingClientSecretName | quote }}
key: {{ $oidc.existingClientIdKey | quote }}
{{- else }}
value: {{ $oidc.clientId | quote }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLIENT_SECRET
{{- if and $oidc.existingClientSecretName $oidc.existingClientSecretKey }}
valueFrom:
secretKeyRef:
name: {{ $oidc.existingClientSecretName | quote }}
key: {{ $oidc.existingClientSecretKey | quote }}
{{- else }}
value: {{ $oidc.clientSecret | quote }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLAIM_NAME
value: {{ $oidc.claimName | quote }}
- name: MINIO_IDENTITY_OPENID_CLAIM_PREFIX
value: {{ $oidc.claimPrefix | quote }}
- name: MINIO_IDENTITY_OPENID_SCOPES
value: {{ tpl $oidc.scopes . | quote }}
- name: MINIO_IDENTITY_OPENID_COMMENT
value: {{ $oidc.comment | quote }}
{{- with $oidc.redirectUri }}
- name: MINIO_IDENTITY_OPENID_REDIRECT_URI
value: {{ tpl . $ | quote }}
{{- end }}
{{- if and $oidc.redirectUrl (not (hasKey (.Values.environment | default dict) "MINIO_BROWSER_REDIRECT_URL")) }}
- name: MINIO_BROWSER_REDIRECT_URL
value: {{ tpl $oidc.redirectUrl . | quote }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_DISPLAY_NAME
value: {{ $oidc.displayName | quote }}
{{- end }}
{{- end -}}
+3 -1
View File
@@ -31,7 +31,9 @@ spec:
{{- range .hosts }}
- {{ tpl . $ | quote }}
{{- end }}
secretName: {{ tpl .secretName $ }}
{{- with .secretName }}
secretName: {{ tpl . $ | quote }}
{{- end }}
{{- end }}
{{- end }}
rules:
+2 -46
View File
@@ -69,7 +69,7 @@ spec:
{{- end }}
containers:
- name: {{ include "silo.name" . }}
image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . }}"
image: "{{ tpl .Values.image.repository . }}:{{ tpl (.Values.image.tag | toString) . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/sh"
@@ -116,51 +116,7 @@ spec:
- name: MINIO_PROMETHEUS_AUTH_TYPE
value: "public"
{{- 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:
secretKeyRef:
name: {{ .Values.oidc.existingClientSecretName }}
key: {{ .Values.oidc.existingClientIdKey }}
{{- else }}
value: {{ .Values.oidc.clientId }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLIENT_SECRET
{{- if and .Values.oidc.existingClientSecretName .Values.oidc.existingClientSecretKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.oidc.existingClientSecretName }}
key: {{ .Values.oidc.existingClientSecretKey }}
{{- else }}
value: {{ .Values.oidc.clientSecret }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLAIM_NAME
value: {{ .Values.oidc.claimName }}
- name: MINIO_IDENTITY_OPENID_CLAIM_PREFIX
value: {{ .Values.oidc.claimPrefix }}
- name: MINIO_IDENTITY_OPENID_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: {{ 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 }}
{{- include "silo.oidcEnv" . | nindent 12 }}
{{- if .Values.etcd.endpoints }}
- name: MINIO_ETCD_ENDPOINTS
value: {{ join "," .Values.etcd.endpoints | quote }}
+3 -1
View File
@@ -31,7 +31,9 @@ spec:
{{- range .hosts }}
- {{ tpl . $ | quote }}
{{- end }}
secretName: {{ tpl .secretName $ }}
{{- with .secretName }}
secretName: {{ tpl . $ | quote }}
{{- end }}
{{- end }}
{{- end }}
rules:
+3
View File
@@ -53,6 +53,9 @@ metadata:
chart: {{ template "silo.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.commonLabels }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
podSelector:
matchLabels:
+8 -8
View File
@@ -24,7 +24,7 @@ spec:
app: {{ template "silo.name" . }}-job
release: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- tpl (toYaml .Values.podLabels) $ | nindent 8 }}
{{- end }}
{{- with .Values.commonLabels }}
{{- tpl (toYaml .) $ | nindent 8 }}
@@ -35,8 +35,8 @@ spec:
spec:
restartPolicy: OnFailure
{{- include "silo.imagePullSecrets" . | indent 6 }}
{{- if or .Values.nodeSelector .Values.postJob.nodeSelector }}
nodeSelector: {{- tpl (toYaml .Values.postJob.nodeSelector | default .Values.nodeSelector) . | nindent 8 }}
{{- with (.Values.postJob.nodeSelector | default .Values.nodeSelector) }}
nodeSelector: {{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.postJob.affinity }}
affinity: {{- toYaml . | nindent 8 }}
@@ -94,7 +94,7 @@ spec:
{{- if .Values.policies }}
initContainers:
- name: silo-make-policy
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}"
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl (.Values.mcImage.tag | toString) . }}"
{{- if .Values.makePolicyJob.securityContext.enabled }}
{{- with .Values.makePolicyJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }}
securityContext: {{ toYaml . | nindent 12 }}
@@ -128,7 +128,7 @@ spec:
containers:
{{- if .Values.buckets }}
- name: silo-make-bucket
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}"
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl (.Values.mcImage.tag | toString) . }}"
{{- if .Values.makeBucketJob.securityContext.enabled }}
{{- with .Values.makeBucketJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }}
securityContext: {{ toYaml . | nindent 12 }}
@@ -161,7 +161,7 @@ spec:
{{- end }}
{{- if .Values.users }}
- name: silo-make-user
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}"
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl (.Values.mcImage.tag | toString) . }}"
{{- if .Values.makeUserJob.securityContext.enabled }}
{{- with .Values.makeUserJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }}
securityContext: {{ toYaml . | nindent 12 }}
@@ -194,7 +194,7 @@ spec:
{{- end }}
{{- if .Values.customCommands }}
- name: silo-custom-command
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}"
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl (.Values.mcImage.tag | toString) . }}"
{{- if .Values.customCommandJob.securityContext.enabled }}
{{- with .Values.customCommandJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }}
securityContext: {{ toYaml . | nindent 12 }}
@@ -230,7 +230,7 @@ spec:
{{- end }}
{{- if .Values.svcaccts }}
- name: silo-make-svcacct
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl .Values.mcImage.tag . }}"
image: "{{ tpl .Values.mcImage.repository . }}:{{ tpl (.Values.mcImage.tag | toString) . }}"
{{- if .Values.makeServiceAccountJob.securityContext.enabled }}
{{- with .Values.makeServiceAccountJob.containerSecurityContext | default .Values.postJob.containerSecurityContext }}
securityContext: {{ toYaml . | nindent 12 }}
+2 -6
View File
@@ -22,12 +22,8 @@ spec:
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if or .Values.persistence.storageClass .Values.global.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass | default .Values.global.storageClass }}"
{{- end }}
{{- with (include "silo.storageClass" .) }}
{{- . | nindent 2 }}
{{- end }}
{{- if .Values.persistence.volumeName }}
volumeName: "{{ .Values.persistence.volumeName }}"
+3
View File
@@ -80,6 +80,9 @@ metadata:
{{- with .Values.metrics.serviceMonitor.additionalLabels }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- with .Values.commonLabels }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
jobName: {{ template "silo.fullname" . }}
{{- if .Values.tls.enabled }}
+8 -41
View File
@@ -9,7 +9,6 @@
{{ $subPath := .Values.persistence.subPath }}
{{ $penabled := .Values.persistence.enabled }}
{{ $accessMode := .Values.persistence.accessMode }}
{{ $storageClass := .Values.persistence.storageClass }}
{{ $psize := .Values.persistence.size }}
apiVersion: v1
kind: Service
@@ -100,7 +99,7 @@ spec:
{{- end }}
containers:
- name: {{ include "silo.name" . }}
image: {{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . }}
image: {{ tpl .Values.image.repository . }}:{{ tpl (.Values.image.tag | toString) . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: [
"/bin/sh",
@@ -157,40 +156,7 @@ spec:
- name: MINIO_PROMETHEUS_AUTH_TYPE
value: "public"
{{- end }}
{{- if .Values.oidc.enabled }}
- name: MINIO_IDENTITY_OPENID_CONFIG_URL
value: {{ .Values.oidc.configUrl }}
- name: MINIO_IDENTITY_OPENID_CLIENT_ID
{{- if and .Values.oidc.existingClientSecretName .Values.oidc.existingClientIdKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.oidc.existingClientSecretName }}
key: {{ .Values.oidc.existingClientIdKey }}
{{- else }}
value: {{ .Values.oidc.clientId }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLIENT_SECRET
{{- if and .Values.oidc.existingClientSecretName .Values.oidc.existingClientSecretKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.oidc.existingClientSecretName }}
key: {{ .Values.oidc.existingClientSecretKey }}
{{- else }}
value: {{ .Values.oidc.clientSecret }}
{{- end }}
- name: MINIO_IDENTITY_OPENID_CLAIM_NAME
value: {{ .Values.oidc.claimName }}
- name: MINIO_IDENTITY_OPENID_CLAIM_PREFIX
value: {{ .Values.oidc.claimPrefix }}
- name: MINIO_IDENTITY_OPENID_SCOPES
value: {{ .Values.oidc.scopes }}
- name: MINIO_IDENTITY_OPENID_COMMENT
value: {{ .Values.oidc.comment }}
- name: MINIO_IDENTITY_OPENID_REDIRECT_URI
value: {{ .Values.oidc.redirectUri }}
- name: MINIO_IDENTITY_OPENID_DISPLAY_NAME
value: {{ .Values.oidc.displayName }}
{{- end }}
{{- include "silo.oidcEnv" . | nindent 12 }}
{{- range $key, $val := .Values.environment }}
- name: {{ $key }}
value: {{ tpl $val $ | quote }}
@@ -209,7 +175,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 }}
@@ -237,6 +203,7 @@ spec:
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
{{- $storageClass := include "silo.storageClass" . }}
volumeClaimTemplates:
{{- if gt $drivesPerNode 1 }}
{{- range $diskId := until $drivesPerNode}}
@@ -249,8 +216,8 @@ spec:
{{- end }}
spec:
accessModes: [ {{ $accessMode | quote }} ]
{{- if $storageClass }}
storageClassName: {{ $storageClass }}
{{- with $storageClass }}
{{- . | nindent 8 }}
{{- end }}
resources:
requests:
@@ -266,8 +233,8 @@ spec:
{{- end }}
spec:
accessModes: [ {{ $accessMode | quote }} ]
{{- if $storageClass }}
storageClassName: {{ $storageClass }}
{{- with $storageClass }}
{{- . | nindent 8 }}
{{- end }}
resources:
requests:
+8 -6
View File
@@ -95,6 +95,8 @@ runtimeClassName: ""
##
rootUser: ""
rootPassword: ""
## Evaluate rootUser and rootPassword as Helm templates when explicitly enabled.
tplRootCredentials: false
## Use existing Secret that store following variables:
##
@@ -160,8 +162,8 @@ persistence:
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
## Storage class of PV to bind. By default it looks for standard storage class.
## If the PV uses a different storage class, specify that here.
## An unset value inherits global.storageClass for new claims. During upgrade,
## existing claims retain their provisioned class.
storageClass: ""
volumeName: ""
accessMode: ReadWriteOnce
@@ -552,10 +554,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"
# Legacy callback URL, including /oauth_callback, for existing installations.
redirectUri: ""
# Public Console base URL. An explicit environment.MINIO_BROWSER_REDIRECT_URL takes priority.
redirectUrl: ""
# Can leave empty
claimPrefix: ""
comment: ""