Compare commits

..

2 Commits

Author SHA1 Message Date
Feng Ruohang b7fc202ad9 fix(helm): use node health endpoints and preserve probe upgrade defaults
Share the built-in and custom probe rendering across both server workloads. Check live during startup and for restarts, and ready for Service traffic. Set the transport from the server TLS setting and target its API port.

An older release can supply none of the new defaults during --reuse-values. Omit inactive probes and supply the timing defaults when just an enabled flag is set. Cover both values paths and custom overrides in the Helm migration check.

Refs #288, #283.

Signed-off-by: Feng Ruohang <rh@vonng.com>
2026-12-03 16:43:59 +08:00
HaveFun83 70211f30ba add option to enable kubernetes probes
(cherry picked from commit 9650175a68)

Signed-off-by: HaveFun83 <38665716+HaveFun83@users.noreply.github.com>
Signed-off-by: Feng Ruohang <rh@vonng.com>
2026-12-03 16:30:58 +08:00
15 changed files with 130 additions and 116 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ RUN mkdir -p /prep/data && chmod 0777 /prep/data
# Debian's bundle in distroless still trusts the roots the classic image # Debian's bundle in distroless still trusts the roots the classic image
# blocklists. Build the same bundle as Dockerfile.goreleaser so both variants # blocklists. Build the same bundle as Dockerfile.goreleaser so both variants
# trust the same roots; it is architecture-neutral, so build it natively. # trust the same roots; it is architecture-neutral, so build it natively.
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/ubi:latest@sha256:1e9f0ed9fceafb40878bc1705ff124aa150e3fed873f18c42cdc2dded319e0a8 AS certs FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/ubi:latest@sha256:8b212f75a0e5a156ac28b1c5c030d2e8a07715254e19d522286118279399af81 AS certs
# Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012 # Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012
RUN dnf -y install ca-certificates && \ RUN dnf -y install ca-certificates && \
if [ -d /etc/pki/ca-trust/source/blocklist ]; then \ if [ -d /etc/pki/ca-trust/source/blocklist ]; then \
+2 -2
View File
@@ -69,7 +69,7 @@ RUN apk add -U --no-cache \
mkdir -p /go/share/mcli && \ mkdir -p /go/share/mcli && \
cp /tmp/mcli-extract/LICENSE /tmp/mcli-extract/NOTICE /tmp/mcli-extract/CREDITS /go/share/mcli/ cp /tmp/mcli-extract/LICENSE /tmp/mcli-extract/NOTICE /tmp/mcli-extract/CREDITS /go/share/mcli/
FROM registry.access.redhat.com/ubi9/ubi:latest@sha256:1e9f0ed9fceafb40878bc1705ff124aa150e3fed873f18c42cdc2dded319e0a8 AS certs FROM registry.access.redhat.com/ubi9/ubi:latest@sha256:8b212f75a0e5a156ac28b1c5c030d2e8a07715254e19d522286118279399af81 AS certs
# Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012 # Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012
RUN dnf -y install ca-certificates && \ RUN dnf -y install ca-certificates && \
if [ -d /etc/pki/ca-trust/source/blocklist ]; then \ if [ -d /etc/pki/ca-trust/source/blocklist ]; then \
@@ -88,7 +88,7 @@ RUN dnf -y install ca-certificates && \
dnf clean all && \ dnf clean all && \
rm -rf /var/cache/dnf rm -rf /var/cache/dnf
FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:dbd325b96bcd432dd42816d31412bdf1dc0fb973b79ed310344bc23c76c068db FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:b59ac4f291d86027c2681f7a7b1cbf7448972fc55a6cb8e25cab5aa5eef5ce5f
LABEL org.opencontainers.image.title="Silo" \ LABEL org.opencontainers.image.title="Silo" \
org.opencontainers.image.description="S3-Interface Libre Object Storage" \ org.opencontainers.image.description="S3-Interface Libre Object Storage" \
@@ -30,3 +30,9 @@ oidc:
imagePullSecrets: imagePullSecrets:
- name: primary-pull - name: primary-pull
- name: '{{ .Release.Name }}-pull' - name: '{{ .Release.Name }}-pull'
startupProbe:
enabled: true
livenessProbe:
enabled: true
readinessProbe:
enabled: true
+31 -2
View File
@@ -55,14 +55,23 @@ helm_run lint "${new_chart}"
helm_run template silo "${new_chart}" \ helm_run template silo "${new_chart}" \
--namespace silo \ --namespace silo \
--set rootUser=silo-admin \ --set rootUser=silo-admin \
--set rootPassword=test-password-123456 >/dev/null --set rootPassword=test-password-123456 >"${work_dir}/default-distributed.yaml"
helm_run template silo "${new_chart}" \ helm_run template silo "${new_chart}" \
--namespace silo \ --namespace silo \
--set mode=standalone \ --set mode=standalone \
--set replicas=1 \ --set replicas=1 \
--set persistence.enabled=false \ --set persistence.enabled=false \
--set rootUser=silo-admin \ --set rootUser=silo-admin \
--set rootPassword=test-password-123456 >/dev/null --set rootPassword=test-password-123456 >"${work_dir}/default-standalone.yaml"
if grep -Eq '^[[:space:]]+(liveness|readiness|startup)Probe:' "${work_dir}"/default-*.yaml; then
echo "default workload unexpectedly enables a server probe" >&2
exit 1
fi
# --reuse-values renders new templates with the old release's coalesced defaults.
# Passing -f old/values.yaml alone would fill missing keys with new defaults.
cp -R helm/silo "${work_dir}/reuse"
git show RELEASE.2026-11-12T00-00-00Z:helm/silo/values.yaml >"${work_dir}/reuse/values.yaml"
# Exercise the persisted standalone PVC, optional legacy values, and OIDC in both workloads. # Exercise the persisted standalone PVC, optional legacy values, and OIDC in both workloads.
cp buildscripts/helm-migration-guard/testdata/optional-values.yaml "${work_dir}/optional-values.yaml" cp buildscripts/helm-migration-guard/testdata/optional-values.yaml "${work_dir}/optional-values.yaml"
@@ -72,6 +81,12 @@ for mode in standalone distributed; do
-f "${output_dir}/optional-values.yaml" --set "mode=${mode}" >"${render}" -f "${output_dir}/optional-values.yaml" --set "mode=${mode}" >"${render}"
expect_rendered "${render}" \ expect_rendered "${render}" \
'createBucket chart-test "none" false "" false' \ 'createBucket chart-test "none" false "" false' \
'startupProbe:' 'livenessProbe:' 'readinessProbe:' \
'path: /minio/health/live' \
'path: /minio/health/ready' \
'scheme: HTTPS' \
'periodSeconds: 30' \
'failureThreshold: 60' \
'name: "chart-oidc"' \ 'name: "chart-oidc"' \
'key: "discovery"' \ 'key: "discovery"' \
'value: "https://console.example.test/oauth_callback"' \ 'value: "https://console.example.test/oauth_callback"' \
@@ -80,6 +95,20 @@ for mode in standalone distributed; do
echo "${mode} sets a browser redirect without a configured URL" >&2 echo "${mode} sets a browser redirect without a configured URL" >&2
exit 1 exit 1
fi fi
render="${work_dir}/${mode}-reuse.yaml"
helm_run template silo-reuse "${output_dir}/reuse" --is-upgrade \
--set "mode=${mode}" --set minioAPIPort=9443 \
--set readinessProbe.enabled=true,startupProbe.enabled=true \
--set customStartupProbe.tcpSocket.port=9444 >"${render}"
expect_rendered "${render}" \
'path: /minio/health/ready' 'port: 9443' 'scheme: HTTP' \
'periodSeconds: 15' 'failureThreshold: 3' 'timeoutSeconds: 5' \
'startupProbe:' 'tcpSocket:' 'port: 9444'
if grep -Eq 'livenessProbe:|path: /minio/health/live' "${render}"; then
echo "${mode} rendered a disabled or overridden built-in probe" >&2
exit 1
fi
done done
# Existing values commonly address the historical myminio target. Render the # Existing values commonly address the historical myminio target. Render the
+1 -5
View File
@@ -370,11 +370,7 @@ func trimAwsChunkedContentEncoding(contentEnc string) (trimmedContentEnc string)
} }
var newEncs []string var newEncs []string
for enc := range strings.SplitSeq(contentEnc, ",") { for enc := range strings.SplitSeq(contentEnc, ",") {
// Content-Encoding is a comma separated list with optional if enc != streamingContentEncoding {
// whitespace around each coding, and coding names are
// case-insensitive, e.g. "gzip, aws-chunked".
enc = strings.TrimSpace(enc)
if !strings.EqualFold(enc, streamingContentEncoding) {
newEncs = append(newEncs, enc) newEncs = append(newEncs, enc)
} }
} }
-27
View File
@@ -392,30 +392,3 @@ func TestGetResource(t *testing.T) {
} }
} }
} }
// Test trimAwsChunkedContentEncoding() removes the aws-chunked coding wherever
// it appears in the Content-Encoding list, regardless of the optional
// whitespace after the commas or the case of the coding name.
func TestTrimAwsChunkedContentEncoding(t *testing.T) {
testCases := []struct {
in string
expected string
}{
{"", ""},
{"aws-chunked", ""},
{"aws-chunked,gzip", "gzip"},
{"gzip,aws-chunked", "gzip"},
{"aws-chunked, gzip", "gzip"},
{"gzip, aws-chunked", "gzip"},
{"gzip , aws-chunked", "gzip"},
{"AWS-Chunked", ""},
{"gzip, AWS-Chunked", "gzip"},
{"gzip", "gzip"},
{"gzip, br", "gzip,br"},
}
for i, test := range testCases {
if got := trimAwsChunkedContentEncoding(test.in); got != test.expected {
t.Errorf("test %d: input %q: expected %q got %q", i+1, test.in, test.expected, got)
}
}
}
+3 -2
View File
@@ -26,8 +26,9 @@ func TestExtractReplicationMetadataPreservesNormalizedMetadata(t *testing.T) {
{name: "gzip", wire: []string{"gzip"}, want: "gzip"}, {name: "gzip", wire: []string{"gzip"}, want: "gzip"},
{name: "transport-last", wire: []string{"gzip,aws-chunked"}, want: "gzip"}, {name: "transport-last", wire: []string{"gzip,aws-chunked"}, want: "gzip"},
{name: "multiple-values", wire: []string{"aws-chunked", "gzip"}, want: "gzip"}, {name: "multiple-values", wire: []string{"aws-chunked", "gzip"}, want: "gzip"},
{name: "space-before-gzip", wire: []string{"aws-chunked, gzip"}, want: "gzip"}, // Preserve the existing exact-token grammar; whitespace is not normalized here.
{name: "space-before-transport", wire: []string{"gzip, aws-chunked"}, want: "gzip"}, {name: "space-before-gzip", wire: []string{"aws-chunked, gzip"}, want: " gzip"},
{name: "space-before-transport", wire: []string{"gzip, aws-chunked"}, want: "gzip, aws-chunked"},
} { } {
for _, lowercase := range []bool{false, true} { for _, lowercase := range []bool{false, true} {
name := tc.name + "/canonical" name := tc.name + "/canonical"
+1 -1
View File
@@ -3366,7 +3366,7 @@ func (s *xlStorage) CleanAbandonedData(ctx context.Context, volume string, path
newBuf, err := xl.AppendTo(metaDataPoolGet()) newBuf, err := xl.AppendTo(metaDataPoolGet())
if err == nil { if err == nil {
defer metaDataPoolPut(newBuf) defer metaDataPoolPut(newBuf)
return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), newBuf) return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf)
} }
} }
return nil return nil
-75
View File
@@ -1643,81 +1643,6 @@ func TestXLStorageRenameFile(t *testing.T) {
} }
} }
func TestXLStorageCleanAbandonedInlineData(t *testing.T) {
disk, _, err := newXLStorageTestSetup(t)
if err != nil {
t.Fatal(err)
}
defer disk.Close()
ctx := t.Context()
const volume, object = "test-bucket", "inline-object"
if err := disk.MakeVol(ctx, volume); err != nil {
t.Fatal(err)
}
versions := []struct {
id, body string
legacy bool
}{
{nullVersionID, "null version", false},
{mustGetUUID(), "named version", false},
{mustGetUUID(), "legacy data-dir key", true},
}
var meta xlMetaV2
for _, v := range versions {
fi := newFileInfo(object, 2, 2)
fi.VersionID = v.id
fi.DataDir = mustGetUUID()
fi.Erasure.Index = 1
fi.ModTime = UTCNow()
fi.Data = []byte(v.body)
fi.Size = int64(len(fi.Data))
fi.AddObjectPart(1, "", fi.Size, fi.Size, fi.ModTime, nil, nil)
if !v.legacy {
fi.SetInlineData()
}
if err := meta.AddVersion(fi); err != nil {
t.Fatal(err)
}
if v.legacy && !meta.data.rename(v.id, fi.DataDir) {
t.Fatal("failed to store legacy inline data by data directory")
}
}
orphan := mustGetUUID()
meta.data.replace(orphan, []byte("abandoned data"))
buf, err := meta.AppendTo(nil)
if err != nil {
t.Fatal(err)
}
metaPath := pathJoin(object, xlStorageFormatFile)
if err := disk.WriteAll(ctx, volume, metaPath, buf); err != nil {
t.Fatal(err)
}
for pass := 1; pass <= 2; pass++ {
if err := disk.CleanAbandonedData(ctx, volume, object); err != nil {
t.Fatalf("cleanup %d: %v", pass, err)
}
raw, err := disk.ReadAll(ctx, volume, metaPath)
if err != nil {
t.Fatal(err)
}
var saved xlMetaV2
if err := saved.Load(raw); err != nil {
t.Fatal(err)
}
if saved.data.find(orphan) != nil {
t.Fatalf("cleanup %d left orphan %s in xl.meta", pass, orphan)
}
for _, v := range versions {
fi, err := disk.ReadVersion(ctx, "", volume, object, v.id, ReadOptions{ReadData: true})
if err != nil || string(fi.Data) != v.body {
t.Fatalf("after cleanup %d, read version %s: got %q, %v; want %q", pass, v.id, fi.Data, err, v.body)
}
}
}
}
// TestXLStorageDeleteVersion will test if version deletes and bulk deletes work as expected. // TestXLStorageDeleteVersion will test if version deletes and bulk deletes work as expected.
func TestXLStorageDeleteVersion(t *testing.T) { func TestXLStorageDeleteVersion(t *testing.T) {
// create xlStorage test setup // create xlStorage test setup
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
description: S3-Interface Libre Object Storage description: S3-Interface Libre Object Storage
name: silo name: silo
version: 7.1.0 version: 7.2.0
appVersion: RELEASE.2026-11-12T00-00-00Z appVersion: RELEASE.2026-11-12T00-00-00Z
keywords: keywords:
- silo - silo
+38
View File
@@ -146,6 +146,44 @@ helm upgrade --install silo ./helm/silo \
Additional trusted CAs can be supplied through `trustedCertsSecret`. Additional trusted CAs can be supplied through `trustedCertsSecret`.
## Kubernetes health probes
Enable each probe independently for the server container in either mode.
```yaml
startupProbe:
enabled: true
livenessProbe:
enabled: true
readinessProbe:
enabled: true
```
| Probe | Pod endpoint | Default action after consecutive failures |
| --- | --- | --- |
| Startup | `/minio/health/live` | Restart after 60 checks at 5-second intervals. The first success releases the liveness and readiness checks. |
| Liveness | `/minio/health/live` | Restart after 3 checks at 30-second intervals. A saturated request queue can fail this check. |
| Readiness | `/minio/health/ready` | Stop routing new Service traffic to the Pod after 3 checks at 15-second intervals. Resume traffic on recovery. |
Enable startup alongside liveness when a cold start may exceed the liveness
failure window. Built-in probes use `minioAPIPort` and switch to HTTPS with
`tls.enabled`.
Kubelet skips certificate verification for HTTPS probes. Readiness includes
configured KMS and etcd checks. Both endpoints can succeed while storage or IAM
is loading. The distributed headless Service publishes peer addresses during
bootstrap. Use cluster quorum checks for monitoring and a signed S3 write and
readback when an application needs to verify object access.
[Health check guide](https://silo.pgsty.com/operations/monitoring/healthcheck-probe/)
All three probes default to disabled, including on upgrades with `--reuse-values`
from charts that predate these settings. A chart version change updates the
Pod template checksums for the ConfigMap and Secret by default and can trigger
a rollout even with all probes disabled. Set timing fields on each probe, for
example `--set startupProbe.failureThreshold=120` for a ten-minute startup budget.
A nonempty `customStartupProbe`, `customLivenessProbe`, or `customReadinessProbe`
supplies the complete Kubernetes probe even when its built-in is disabled.
Custom probe fields are passed through literally.
## Existing Secrets and post-install resources ## Existing Secrets and post-install resources
The chart treats `rootUser` and `rootPassword` as literal values. A parent chart The chart treats `rootUser` and `rootPassword` as literal values. A parent chart
+22
View File
@@ -282,3 +282,25 @@ otherwise it generates a random value.
value: {{ $oidc.displayName | quote }} value: {{ $oidc.displayName | quote }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}
{{/* Old releases can lack all probe settings on helm upgrade --reuse-values. */}}
{{- define "silo.probes" -}}
{{- range $name, $period := dict "startupProbe" 5 "livenessProbe" 30 "readinessProbe" 15 }}
{{- $settings := index $.Values $name | default dict }}
{{- $custom := index $.Values (printf "custom%s" (title $name)) }}
{{- if $custom }}
{{ $name }}: {{- toYaml $custom | nindent 2 }}
{{- else if $settings.enabled }}
{{ $name }}:
httpGet:
path: {{ ternary "/minio/health/ready" "/minio/health/live" (eq $name "readinessProbe") }}
port: {{ $.Values.minioAPIPort }}
scheme: {{ ternary "HTTPS" "HTTP" $.Values.tls.enabled }}
initialDelaySeconds: {{ $settings.initialDelaySeconds | default 0 | toJson }}
periodSeconds: {{ $settings.periodSeconds | default $period | toJson }}
timeoutSeconds: {{ $settings.timeoutSeconds | default 5 | toJson }}
successThreshold: {{ $settings.successThreshold | default 1 | toJson }}
failureThreshold: {{ $settings.failureThreshold | default (ternary 60 3 (eq $name "startupProbe")) | toJson }}
{{- end }}
{{- end }}
{{- end -}}
+1
View File
@@ -147,6 +147,7 @@ spec:
securityContext: {{ toYaml . | nindent 12}} securityContext: {{ toYaml . | nindent 12}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- include "silo.probes" . | nindent 10 }}
{{- with .Values.extraContainers }} {{- with .Values.extraContainers }}
{{- if eq (typeOf .) "string" }} {{- if eq (typeOf .) "string" }}
{{- tpl . $ | nindent 8 }} {{- tpl . $ | nindent 8 }}
+1
View File
@@ -167,6 +167,7 @@ spec:
securityContext: {{ toYaml . | nindent 12}} securityContext: {{ toYaml . | nindent 12}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- include "silo.probes" . | nindent 10 }}
{{- with .Values.extraContainers }} {{- with .Values.extraContainers }}
{{- if eq (typeOf .) "string" }} {{- if eq (typeOf .) "string" }}
{{- tpl . $ | nindent 8 }} {{- tpl . $ | nindent 8 }}
+22
View File
@@ -301,6 +301,28 @@ resources:
requests: requests:
memory: 16Gi memory: 16Gi
## Each built-in probe uses the S3 API port and follows tls.enabled.
## All three accept initialDelaySeconds (default 0), timeoutSeconds (5),
## successThreshold (1), periodSeconds and failureThreshold.
startupProbe:
enabled: false
periodSeconds: 5
failureThreshold: 60
livenessProbe:
enabled: false
periodSeconds: 30
failureThreshold: 3
readinessProbe:
enabled: false
periodSeconds: 15
failureThreshold: 3
## A nonempty custom probe supplies the complete Kubernetes Probe and takes
## precedence over the corresponding built-in, including its enabled flag.
customStartupProbe: {}
customLivenessProbe: {}
customReadinessProbe: {}
## Policies to create after installing Silo. ## Policies to create after installing Silo.
## ##
## In addition to default policies [readonly|readwrite|writeonly|consoleAdmin|diagnostics] ## In addition to default policies [readonly|readwrite|writeonly|consoleAdmin|diagnostics]