From 8a14de9abfee64589c4911a567cd8aff9520487d Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Sat, 27 Jun 2026 21:59:56 +0300 Subject: [PATCH] fix(seaweedfs): point S3 consumers at the reachable S3 service The s3-service-name.patch renamed the S3 Service to -s3 (seaweedfs-s3), but several consumers still resolved it through componentName -> -s3. name and fullname only coincide when the release name equals the chart name; the shipped release is seaweedfs-system, so they pointed at seaweedfs-system-s3 while the real service stayed seaweedfs-s3: - the S3 ingress backend and the iceberg ingress backend, which left ingress-nginx returning 503 on the external S3 endpoint. The COSI provisioner in-cluster ENDPOINT was wrong on the same axis and also on the port. Both the s3-gateway branch and the filer-S3 branch rendered a portless URL that defaults to 443, while the s3 service only listens on the S3 port (8333); the filer branch additionally targeted the filer service, which serves no S3. Both in-cluster branches now resolve seaweedfs-s3 on the configured S3 port. The default path (s3.ingress.enabled=true) is repaired by the ingress fix; the COSI in-cluster paths are latent until an operator disables the ingress. Resolve every consumer through the same name helper the Service uses, and pin the contract with unittests rendered under the production release name so the mismatch cannot recur. Assisted-By: Claude Signed-off-by: Aleksei Sviridkin --- packages/system/seaweedfs/Makefile | 1 + .../templates/cosi/cosi-deployment.yaml | 4 +- .../templates/s3/s3-iceberg-ingress.yaml | 4 +- .../seaweedfs/templates/s3/s3-ingress.yaml | 2 +- .../patches/s3-service-name-consumers.patch | 47 ++++++++ .../tests/s3_service_name_consumers_test.yaml | 100 ++++++++++++++++++ 6 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 packages/system/seaweedfs/patches/s3-service-name-consumers.patch create mode 100644 packages/system/seaweedfs/tests/s3_service_name_consumers_test.yaml diff --git a/packages/system/seaweedfs/Makefile b/packages/system/seaweedfs/Makefile index cf43956f2..af7c7b327 100644 --- a/packages/system/seaweedfs/Makefile +++ b/packages/system/seaweedfs/Makefile @@ -18,5 +18,6 @@ update: patch --no-backup-if-mismatch -p4 < patches/cosi-provisioner-sa-name.patch patch --no-backup-if-mismatch -p4 < patches/cosi-bucket-class-lock-readonly.patch patch --no-backup-if-mismatch -p4 < patches/s3-service-name.patch + patch --no-backup-if-mismatch -p4 < patches/s3-service-name-consumers.patch #patch --no-backup-if-mismatch -p4 < patches/retention-policy-delete.yaml diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml index d485e0678..d581b085d 100644 --- a/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml +++ b/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml @@ -79,9 +79,9 @@ spec: {{- else if .Values.s3.ingress.enabled }} value: "{{ printf "https://%s" .Values.s3.ingress.host }}" {{- else if .Values.s3.enabled }} - value: "{{ printf "https://%s.%s.svc" (include "seaweedfs.componentName" (list . "s3")) .Release.Namespace }}" + value: "{{ printf "https://%s-s3.%s.svc:%v" (include "seaweedfs.name" .) .Release.Namespace .Values.s3.port }}" {{- else }} - value: "{{ printf "https://%s.%s.svc" (include "seaweedfs.componentName" (list . "filer")) .Release.Namespace }}" + value: "{{ printf "https://%s-s3.%s.svc:%v" (include "seaweedfs.name" .) .Release.Namespace .Values.filer.s3.port }}" {{- end }} {{- with .Values.cosi.region }} - name: REGION diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml index 5a760d7e9..68db538dc 100644 --- a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml +++ b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml @@ -5,11 +5,11 @@ paths: backend: {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} service: - name: {{ include "seaweedfs.componentName" (list . "s3") }} + name: {{ template "seaweedfs.name" . }}-s3 port: number: {{ .Values.s3.icebergPort }} {{- else }} - serviceName: {{ include "seaweedfs.componentName" (list . "s3") }} + serviceName: {{ template "seaweedfs.name" . }}-s3 servicePort: {{ .Values.s3.icebergPort }} {{- end }} {{- end -}} diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml index bc4eee164..c92063f8c 100644 --- a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml +++ b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml @@ -2,7 +2,7 @@ {{- $s3Enabled := or .Values.s3.enabled (and .Values.filer.s3.enabled (not .Values.allInOne.enabled)) (and .Values.allInOne.enabled .Values.allInOne.s3.enabled) }} {{- if and $s3Enabled .Values.s3.ingress.enabled }} {{- /* Determine service name based on deployment mode */}} -{{- $serviceName := ternary (include "seaweedfs.componentName" (list . "all-in-one")) (include "seaweedfs.componentName" (list . "s3")) .Values.allInOne.enabled }} +{{- $serviceName := ternary (include "seaweedfs.componentName" (list . "all-in-one")) (printf "%s-s3" (include "seaweedfs.name" .)) .Values.allInOne.enabled }} {{- $s3Port := .Values.allInOne.s3.port | default .Values.s3.port }} {{- /* Build hosts list - support both legacy .host (string) and new .hosts (array) for backwards compatibility */}} {{- $hosts := list }} diff --git a/packages/system/seaweedfs/patches/s3-service-name-consumers.patch b/packages/system/seaweedfs/patches/s3-service-name-consumers.patch new file mode 100644 index 000000000..73b09dc15 --- /dev/null +++ b/packages/system/seaweedfs/patches/s3-service-name-consumers.patch @@ -0,0 +1,47 @@ +diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml +index d485e0678..d581b085d 100644 +--- a/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml ++++ b/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml +@@ -79,9 +79,9 @@ spec: + {{- else if .Values.s3.ingress.enabled }} + value: "{{ printf "https://%s" .Values.s3.ingress.host }}" + {{- else if .Values.s3.enabled }} +- value: "{{ printf "https://%s.%s.svc" (include "seaweedfs.componentName" (list . "s3")) .Release.Namespace }}" ++ value: "{{ printf "https://%s-s3.%s.svc:%v" (include "seaweedfs.name" .) .Release.Namespace .Values.s3.port }}" + {{- else }} +- value: "{{ printf "https://%s.%s.svc" (include "seaweedfs.componentName" (list . "filer")) .Release.Namespace }}" ++ value: "{{ printf "https://%s-s3.%s.svc:%v" (include "seaweedfs.name" .) .Release.Namespace .Values.filer.s3.port }}" + {{- end }} + {{- with .Values.cosi.region }} + - name: REGION +diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml +index 5a760d7e9..68db538dc 100644 +--- a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml ++++ b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml +@@ -5,11 +5,11 @@ paths: + backend: + {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + service: +- name: {{ include "seaweedfs.componentName" (list . "s3") }} ++ name: {{ template "seaweedfs.name" . }}-s3 + port: + number: {{ .Values.s3.icebergPort }} + {{- else }} +- serviceName: {{ include "seaweedfs.componentName" (list . "s3") }} ++ serviceName: {{ template "seaweedfs.name" . }}-s3 + servicePort: {{ .Values.s3.icebergPort }} + {{- end }} + {{- end -}} +diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml +index bc4eee164..c92063f8c 100644 +--- a/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml ++++ b/packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-ingress.yaml +@@ -2,7 +2,7 @@ + {{- $s3Enabled := or .Values.s3.enabled (and .Values.filer.s3.enabled (not .Values.allInOne.enabled)) (and .Values.allInOne.enabled .Values.allInOne.s3.enabled) }} + {{- if and $s3Enabled .Values.s3.ingress.enabled }} + {{- /* Determine service name based on deployment mode */}} +-{{- $serviceName := ternary (include "seaweedfs.componentName" (list . "all-in-one")) (include "seaweedfs.componentName" (list . "s3")) .Values.allInOne.enabled }} ++{{- $serviceName := ternary (include "seaweedfs.componentName" (list . "all-in-one")) (printf "%s-s3" (include "seaweedfs.name" .)) .Values.allInOne.enabled }} + {{- $s3Port := .Values.allInOne.s3.port | default .Values.s3.port }} + {{- /* Build hosts list - support both legacy .host (string) and new .hosts (array) for backwards compatibility */}} + {{- $hosts := list }} diff --git a/packages/system/seaweedfs/tests/s3_service_name_consumers_test.yaml b/packages/system/seaweedfs/tests/s3_service_name_consumers_test.yaml new file mode 100644 index 000000000..628d2713b --- /dev/null +++ b/packages/system/seaweedfs/tests/s3_service_name_consumers_test.yaml @@ -0,0 +1,100 @@ +suite: seaweedfs s3 consumers resolve the renamed s3 service + +# Pins the regression where consumers of the S3 service 503 / fail to connect +# because they still resolve a service name that no longer exists. +# +# The s3-service-name.patch renamed the S3 Service to `-s3` (seaweedfs-s3), +# but several consumers still resolved it via componentName -> `-s3`: +# - the S3 ingress backend, +# - the iceberg ingress backend, +# - the COSI provisioner ENDPOINT (in-cluster, s3.ingress.enabled=false path). +# name and fullname only coincide when the release name equals the chart name; +# the shipped release is `seaweedfs-system`, so those consumers pointed at +# `seaweedfs-system-s3` while the real service is `seaweedfs-s3`. With no +# matching endpoints, ingress-nginx returns 503 and COSI cannot reach S3. +# +# All tests render under the real release name so name != fullname, the exact +# condition that exposes the bug. The all-in-one case documents the other +# ternary branch, which is unchanged and correct. + +templates: + - charts/seaweedfs/templates/s3/s3-service.yaml + - charts/seaweedfs/templates/s3/s3-ingress.yaml + - charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml + - charts/seaweedfs/templates/cosi/cosi-deployment.yaml + +release: + name: seaweedfs-system + namespace: cozy-seaweedfs + +tests: + - it: s3 service is named with the name helper, not componentName + template: charts/seaweedfs/templates/s3/s3-service.yaml + set: + seaweedfs.s3.enabled: true + asserts: + - equal: + path: metadata.name + value: seaweedfs-s3 + + - it: s3 ingress backend points at the s3 service, not a fullname-derived name + template: charts/seaweedfs/templates/s3/s3-ingress.yaml + set: + seaweedfs.s3.enabled: true + seaweedfs.s3.ingress.enabled: true + seaweedfs.s3.ingress.host: s3.example.com + asserts: + - equal: + path: spec.rules[0].http.paths[0].backend.service.name + value: seaweedfs-s3 + + - it: all-in-one ingress backend still resolves to the all-in-one service + template: charts/seaweedfs/templates/s3/s3-ingress.yaml + set: + seaweedfs.allInOne.enabled: true + seaweedfs.allInOne.s3.enabled: true + seaweedfs.s3.ingress.enabled: true + seaweedfs.s3.ingress.host: s3.example.com + asserts: + - equal: + path: spec.rules[0].http.paths[0].backend.service.name + value: seaweedfs-system-all-in-one + + - it: iceberg ingress backend points at the s3 service too + template: charts/seaweedfs/templates/s3/s3-iceberg-ingress.yaml + set: + seaweedfs.s3.enabled: true + seaweedfs.s3.icebergPort: 8334 + seaweedfs.s3.icebergIngress.enabled: true + seaweedfs.s3.icebergIngress.host: iceberg.example.com + asserts: + - equal: + path: spec.rules[0].http.paths[0].backend.service.name + value: seaweedfs-s3 + + - it: COSI in-cluster ENDPOINT resolves the s3 service when ingress is disabled + template: charts/seaweedfs/templates/cosi/cosi-deployment.yaml + set: + seaweedfs.cosi.enabled: true + seaweedfs.s3.enabled: true + seaweedfs.s3.ingress.enabled: false + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: ENDPOINT + value: https://seaweedfs-s3.cozy-seaweedfs.svc:8333 + + - it: COSI in-cluster ENDPOINT (filer S3 mode) targets the s3 service on the filer s3 port + template: charts/seaweedfs/templates/cosi/cosi-deployment.yaml + set: + seaweedfs.cosi.enabled: true + seaweedfs.s3.enabled: false + seaweedfs.filer.s3.enabled: true + seaweedfs.s3.ingress.enabled: false + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: ENDPOINT + value: https://seaweedfs-s3.cozy-seaweedfs.svc:8333