{{- if .Values.dex.enabled }} apiVersion: v1 kind: Service metadata: name: {{ include "argocd.dex" . }} namespace: {{ .Release.Namespace | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: dex {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} {{- if or .Values.commonAnnotations .Values.dex.service.annotations }} annotations: {{- if .Values.commonAnnotations }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.dex.service.annotations }} {{- include "common.tplvalues.render" ( dict "value" .Values.dex.service.annotations "context" $ ) | nindent 4 }} {{- end }} {{- end }} spec: type: {{ .Values.dex.service.type }} {{- if and .Values.dex.service.clusterIP (eq .Values.dex.service.type "ClusterIP") }} clusterIP: {{ .Values.dex.service.clusterIP }} {{- end }} {{- if (or (eq .Values.dex.service.type "LoadBalancer") (eq .Values.dex.service.type "NodePort")) }} externalTrafficPolicy: {{ .Values.dex.service.externalTrafficPolicy | quote }} {{- end }} {{- if eq .Values.dex.service.type "LoadBalancer" }} loadBalancerSourceRanges: {{ .Values.dex.service.loadBalancerSourceRanges }} {{- end }} {{- if (and (eq .Values.dex.service.type "LoadBalancer") (not (empty .Values.dex.service.loadBalancerIP))) }} loadBalancerIP: {{ .Values.dex.service.loadBalancerIP }} {{- end }} {{- if .Values.dex.service.sessionAffinity }} sessionAffinity: {{ .Values.dex.service.sessionAffinity }} {{- end }} {{- if .Values.dex.service.sessionAffinityConfig }} sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.dex.service.sessionAffinityConfig "context" $) | nindent 4 }} {{- end }} ports: - name: http port: {{ .Values.dex.service.ports.http }} targetPort: http protocol: TCP {{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.service.nodePorts.http))) }} nodePort: {{ .Values.dex.service.nodePorts.http }} {{- else if eq .Values.dex.service.type "ClusterIP" }} nodePort: null {{- end }} - name: grpc port: {{ .Values.dex.service.ports.grpc }} targetPort: grpc protocol: TCP {{- if (and (or (eq .Values.dex.service.type "NodePort") (eq .Values.dex.service.type "LoadBalancer")) (not (empty .Values.dex.service.nodePorts.grpc))) }} nodePort: {{ .Values.dex.service.nodePorts.grpc }} {{- else if eq .Values.dex.service.type "ClusterIP" }} nodePort: null {{- end }} {{- if .Values.dex.service.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.dex.service.extraPorts "context" $) | nindent 4 }} {{- end }} selector: {{- include "common.labels.matchLabels" . | nindent 4 }} app.kubernetes.io/component: dex {{- end }}