* 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
90 lines
3.1 KiB
YAML
90 lines
3.1 KiB
YAML
{{- if .Values.allInOne.enabled }}
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ include "seaweedfs.componentName" (list . "all-in-one") }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
|
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/component: seaweedfs-all-in-one
|
|
{{- if .Values.allInOne.service.annotations }}
|
|
annotations:
|
|
{{- toYaml .Values.allInOne.service.annotations | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
type: {{ .Values.allInOne.service.type | default "ClusterIP" }}
|
|
internalTrafficPolicy: {{ .Values.allInOne.service.internalTrafficPolicy | default "Cluster" }}
|
|
{{- if and (semverCompare ">=1.31-0" .Capabilities.KubeVersion.GitVersion) .Values.allInOne.s3.trafficDistribution }}
|
|
trafficDistribution: {{ include "seaweedfs.trafficDistribution" (dict "value" .Values.allInOne.s3.trafficDistribution "Capabilities" .Capabilities) }}
|
|
{{- end }}
|
|
ports:
|
|
# Master ports
|
|
- name: "swfs-master"
|
|
port: {{ .Values.master.port }}
|
|
targetPort: {{ .Values.master.port }}
|
|
protocol: TCP
|
|
- name: "swfs-master-grpc"
|
|
port: {{ .Values.master.grpcPort }}
|
|
targetPort: {{ .Values.master.grpcPort }}
|
|
protocol: TCP
|
|
|
|
# Volume ports
|
|
- name: "swfs-volume"
|
|
port: {{ .Values.volume.port }}
|
|
targetPort: {{ .Values.volume.port }}
|
|
protocol: TCP
|
|
- name: "swfs-volume-grpc"
|
|
port: {{ .Values.volume.grpcPort }}
|
|
targetPort: {{ .Values.volume.grpcPort }}
|
|
protocol: TCP
|
|
|
|
# Filer ports
|
|
- name: "swfs-filer"
|
|
port: {{ .Values.filer.port }}
|
|
targetPort: {{ .Values.filer.port }}
|
|
protocol: TCP
|
|
- name: "swfs-filer-grpc"
|
|
port: {{ .Values.filer.grpcPort }}
|
|
targetPort: {{ .Values.filer.grpcPort }}
|
|
protocol: TCP
|
|
|
|
# S3 ports (if enabled)
|
|
{{- if .Values.allInOne.s3.enabled }}
|
|
- name: "swfs-s3"
|
|
port: {{ .Values.allInOne.s3.port | default .Values.s3.port }}
|
|
targetPort: {{ .Values.allInOne.s3.port | default .Values.s3.port }}
|
|
protocol: TCP
|
|
{{- $httpsPort := .Values.allInOne.s3.httpsPort | default .Values.s3.httpsPort }}
|
|
{{- if $httpsPort }}
|
|
- name: "swfs-s3-tls"
|
|
port: {{ $httpsPort }}
|
|
targetPort: {{ $httpsPort }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
# SFTP ports (if enabled)
|
|
{{- if .Values.allInOne.sftp.enabled }}
|
|
- name: "swfs-sftp"
|
|
port: {{ .Values.allInOne.sftp.port | default .Values.sftp.port }}
|
|
targetPort: {{ .Values.allInOne.sftp.port | default .Values.sftp.port }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
|
|
# Server metrics port (single metrics endpoint for all services)
|
|
{{- if .Values.allInOne.metricsPort }}
|
|
- name: "server-metrics"
|
|
port: {{ .Values.allInOne.metricsPort }}
|
|
targetPort: {{ .Values.allInOne.metricsPort }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
|
|
selector:
|
|
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/component: seaweedfs-all-in-one
|
|
{{- end }}
|