apiVersion: v1 kind: Service metadata: {{- if .Values.service.annotations }} annotations: {{ toYaml .Values.service.annotations | indent 4 }} {{- end }} name: {{ template "openldap.fullname" . }} namespace: {{ .Release.Namespace }} labels: app: {{ template "openldap.fullname" . }} chart: {{ template "openldap.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- if .Values.extraLabels }} {{ toYaml .Values.extraLabels | indent 4 }} {{- end }} spec: type: {{ .Values.service.type }} {{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} {{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }} {{- end }} ports: - name: ldap-port protocol: TCP port: {{ .Values.service.ldapPort }} targetPort: ldap-port {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort)) }} nodePort: {{ .Values.service.ldapPortNodePort }} {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} - name: ssl-ldap-port protocol: TCP port: {{ .Values.service.sslLdapPort }} targetPort: ssl-ldap-port {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort)) }} nodePort: {{ .Values.service.sslLdapPortNodePort }} {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} selector: app: {{ template "openldap.fullname" . }} release: {{ .Release.Name }}