{{- if .Values.statefulset.enabled }} apiVersion: v1 kind: Service metadata: annotations: # 1.13 以前版本 #service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" name: {{ printf "%s-headless" (include "common.names.fullname" .) }} namespace: {{ .Release.Namespace }} labels: {{- include "common.labels.standard" . | nindent 4 }} spec: type: ClusterIP clusterIP: None # 1.13 以后版本 publishNotReadyAddresses: true ports: {{- range $key, $value := .Values.service.ports }} - name: {{ $key }} targetPort: {{ $key }} {{- toYaml $value | nindent 6 }} {{- end }} selector: {{- include "common.labels.matchLabels" . | nindent 4 }} {{- end -}}