* fix(helm): use componentName for all service names to fix truncation mismatch (#8610) PR #8143 updated statefulsets and deployments to use the componentName helper (which truncates the fullname before appending the suffix), but left service definitions using the old `printf + trunc 63` pattern. When release names are long enough, these two strategies produce different names, causing DNS resolution failures (e.g., S3 cannot find the filer-client service and falls back to localhost:8888). Unify all service name definitions and cluster address helpers to use the componentName helper consistently. * refactor(helm): simplify cluster address helpers with ternary * test(helm): add regression test for service name truncation with long release names Renders the chart with a >63-char fullname in both normal and all-in-one modes, then asserts that Service metadata.name values match the hostnames produced by cluster.masterAddress, cluster.filerAddress, and the S3 deployment's -filer= argument. Prevents future truncation/DNS mismatch regressions like #8610. * fix(helm-ci): limit S3_FILER_HOST extraction to first match
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
{{ $volumes := deepCopy .Values.volumes | mergeOverwrite (dict "" .Values.volume) }}
|
|
{{- range $vname, $volume := $volumes }}
|
|
{{- $volumeName := trimSuffix "-" (printf "volume-%s" $vname) }}
|
|
{{- $volume := mergeOverwrite (deepCopy $.Values.volume) (dict "enabled" true) $volume }}
|
|
|
|
{{- if $volume.enabled }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ include "seaweedfs.componentName" (list $ $volumeName) }}
|
|
namespace: {{ $.Release.Namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
|
app.kubernetes.io/instance: {{ $.Release.Name }}
|
|
app.kubernetes.io/component: {{ $volumeName }}
|
|
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
|
|
app.kubernetes.io/managed-by: {{ $.Release.Service }}
|
|
{{- if $volume.annotations }}
|
|
annotations:
|
|
{{- toYaml $volume.annotations | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
clusterIP: None
|
|
internalTrafficPolicy: {{ $volume.internalTrafficPolicy | default "Cluster" }}
|
|
ports:
|
|
- name: "swfs-volume"
|
|
port: {{ $volume.port }}
|
|
targetPort: {{ $volume.port }}
|
|
protocol: TCP
|
|
- name: "swfs-volume-18080"
|
|
port: {{ $volume.grpcPort }}
|
|
targetPort: {{ $volume.grpcPort }}
|
|
protocol: TCP
|
|
{{- if $volume.metricsPort }}
|
|
- name: "metrics"
|
|
port: {{ $volume.metricsPort }}
|
|
targetPort: {{ $volume.metricsPort }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
selector:
|
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
|
app.kubernetes.io/instance: {{ $.Release.Name }}
|
|
app.kubernetes.io/component: {{ $volumeName }}
|
|
{{- end }}
|
|
{{- end }}
|