Files
rustfs/helm/rustfs/templates/service.yaml
T
2026-02-14 10:25:13 +08:00

70 lines
2.2 KiB
YAML

{{- if .Values.mode.distributed.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "rustfs.fullname" . }}-headless
namespace: {{ .Release.Namespace }}
labels:
{{- include "rustfs.labels" . | nindent 4 }}
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- /* headless service */}}
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: endpoint
port: {{ .Values.service.endpoint.port }}
- name: console
port: {{ .Values.service.console.port }}
selector:
{{- include "rustfs.selectorLabels" . | nindent 4 }}
{{- end }}
---
{{- $serviceType := .Values.service.type }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "rustfs.fullname" . }}-svc
namespace: {{ .Release.Namespace }}
{{- if and .Values.mode.distributed.enabled (eq .Values.ingress.className "traefik")}}
annotations:
{{- toYaml .Values.ingress.traefikAnnotations | nindent 4 }}
{{- if and .Values.mtls.enabled (eq .Values.ingress.className "traefik") }}
traefik.ingress.kubernetes.io/service.serversscheme: https
traefik.ingress.kubernetes.io/service.serverstransport: {{ .Release.Namespace }}-{{ include "rustfs.fullname" . }}-transport@kubernetescrd
{{- end }}
{{- end }}
labels:
{{- include "rustfs.labels" . | nindent 4 }}
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if eq $serviceType "ClusterIP" }}
type: ClusterIP
{{- else if eq $serviceType "NodePort" }}
type: NodePort
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
{{- end }}
ports:
- name: endpoint
port: {{ .Values.service.endpoint.port }}
targetPort: {{ .Values.service.endpoint.port }}
{{- if eq $serviceType "NodePort" }}
nodePort: {{ .Values.service.endpoint.nodePort }}
{{- end }}
- name: console
port: {{ .Values.service.console.port }}
targetPort: {{ .Values.service.console.port }}
{{- if eq $serviceType "NodePort" }}
nodePort: {{ .Values.service.console.nodePort }}
{{- end }}
selector:
{{- include "rustfs.selectorLabels" . | nindent 4 }}