blob: d22e16dbdfff449f47c6d9c7b655815b1384cc5f [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 }}
11 labels: {{- include "common.labels.standard" . | nindent 4 }}
12 app.kubernetes.io/component: keycloak
13 {{- if .Values.commonLabels }}
14 {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15 {{- end }}
16 {{- if or .Values.service.annotations .Values.commonAnnotations }}
17 annotations:
18 {{- if .Values.service.annotations }}
19 {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
20 {{- end }}
21 {{- if .Values.commonAnnotations }}
22 {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
23 {{- end }}
24 {{- end }}
25spec:
26 type: {{ .Values.service.type }}
27 {{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
28 clusterIP: {{ .Values.service.clusterIP }}
29 {{- end }}
30 {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
31 externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
32 {{- end }}
33 {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
34 loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
35 {{- end }}
36 {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
37 loadBalancerIP: {{ .Values.service.loadBalancerIP }}
38 {{- end }}
39 {{- if .Values.service.sessionAffinity }}
40 sessionAffinity: {{ .Values.service.sessionAffinity }}
41 {{- end }}
42 {{- if .Values.service.sessionAffinityConfig }}
43 sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
44 {{- end }}
45 ports:
46 {{- if .Values.service.http.enabled }}
47 - name: http
48 port: {{ coalesce .Values.service.ports.http .Values.service.port }}
49 protocol: TCP
50 targetPort: http
51 {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.http))) }}
52 nodePort: {{ .Values.service.nodePorts.http }}
53 {{- else if eq .Values.service.type "ClusterIP" }}
54 nodePort: null
55 {{- end }}
56 {{- end }}
57 {{- if .Values.tls.enabled }}
58 - name: https
59 port: {{ coalesce .Values.service.ports.https .Values.service.httpsPort }}
60 protocol: TCP
61 targetPort: https
62 {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.https))) }}
63 nodePort: {{ .Values.service.nodePorts.https }}
64 {{- else if eq .Values.service.type "ClusterIP" }}
65 nodePort: null
66 {{- end }}
67 {{- end }}
68 {{- if .Values.service.extraPorts }}
69 {{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
70 {{- end }}
71 selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
72 app.kubernetes.io/component: keycloak