blob: b13305cd3a3cf6f3bcec6817846755611b1ffecb [file] [log] [blame]
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +02001{{- /*
2Copyright VMware, Inc.
3SPDX-License-Identifier: APACHE-2.0
4*/}}
5
6apiVersion: v1
7kind: Service
8metadata:
9 name: {{ template "common.names.fullname" . }}
10 namespace: {{ include "common.names.namespace" . | quote }}
Mohammed Naser65cda132024-05-02 14:34:08 -040011 labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +020012 app.kubernetes.io/component: keycloak
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +020013 {{- if or .Values.service.annotations .Values.commonAnnotations }}
Mohammed Naser65cda132024-05-02 14:34:08 -040014 {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.service.annotations .Values.commonAnnotations ) "context" . ) }}
15 annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +020016 {{- end }}
17spec:
18 type: {{ .Values.service.type }}
19 {{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
20 clusterIP: {{ .Values.service.clusterIP }}
21 {{- end }}
22 {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
23 externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
24 {{- end }}
25 {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
26 loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
27 {{- end }}
28 {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
29 loadBalancerIP: {{ .Values.service.loadBalancerIP }}
30 {{- end }}
31 {{- if .Values.service.sessionAffinity }}
32 sessionAffinity: {{ .Values.service.sessionAffinity }}
33 {{- end }}
34 {{- if .Values.service.sessionAffinityConfig }}
35 sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
36 {{- end }}
37 ports:
38 {{- if .Values.service.http.enabled }}
39 - name: http
40 port: {{ coalesce .Values.service.ports.http .Values.service.port }}
41 protocol: TCP
42 targetPort: http
43 {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.http))) }}
44 nodePort: {{ .Values.service.nodePorts.http }}
45 {{- else if eq .Values.service.type "ClusterIP" }}
46 nodePort: null
47 {{- end }}
48 {{- end }}
49 {{- if .Values.tls.enabled }}
50 - name: https
51 port: {{ coalesce .Values.service.ports.https .Values.service.httpsPort }}
52 protocol: TCP
53 targetPort: https
54 {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.https))) }}
55 nodePort: {{ .Values.service.nodePorts.https }}
56 {{- else if eq .Values.service.type "ClusterIP" }}
57 nodePort: null
58 {{- end }}
59 {{- end }}
60 {{- if .Values.service.extraPorts }}
61 {{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
62 {{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -040063 {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }}
64 selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +020065 app.kubernetes.io/component: keycloak