Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 1 | {{- /* |
| 2 | Copyright VMware, Inc. |
| 3 | SPDX-License-Identifier: APACHE-2.0 |
| 4 | */}} |
| 5 | |
| 6 | apiVersion: v1 |
| 7 | kind: Service |
| 8 | metadata: |
| 9 | name: {{ template "common.names.fullname" . }} |
| 10 | namespace: {{ include "common.names.namespace" . | quote }} |
Mohammed Naser | 65cda13 | 2024-05-02 14:34:08 -0400 | [diff] [blame] | 11 | labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 12 | app.kubernetes.io/component: keycloak |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 13 | {{- if or .Values.service.annotations .Values.commonAnnotations }} |
Mohammed Naser | 65cda13 | 2024-05-02 14:34:08 -0400 | [diff] [blame] | 14 | {{- $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 Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 16 | {{- end }} |
| 17 | spec: |
| 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 Naser | 65cda13 | 2024-05-02 14:34:08 -0400 | [diff] [blame] | 63 | {{- $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 Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 65 | app.kubernetes.io/component: keycloak |