blob: c53836d03e8b40ff0d3492aa317040186ce28235 [file] [log] [blame]
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +02001{{- /*
2Copyright VMware, Inc.
3SPDX-License-Identifier: APACHE-2.0
4*/}}
5
6{{- if .Values.networkPolicy.enabled }}
7kind: NetworkPolicy
8apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
9metadata:
10 name: {{ template "common.names.fullname" . }}
11 namespace: {{ include "common.names.namespace" . | quote }}
12 labels: {{- include "common.labels.standard" . | nindent 4 }}
13 app.kubernetes.io/component: keycloak
14 {{- if .Values.commonLabels }}
15 {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
16 {{- end }}
17 {{- if .Values.commonAnnotations }}
18 annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
19 {{- end }}
20spec:
21 podSelector:
22 matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
23 ingress:
24 - ports:
25 - port: {{ .Values.containerPorts.infinispan }}
26 - port: {{ .Values.containerPorts.http }}
27 {{- if .Values.tls.enabled }}
28 - port: {{ .Values.containerPorts.https }}
29 {{- end }}
30 {{- if not .Values.networkPolicy.allowExternal }}
31 from:
32 - podSelector:
33 matchLabels:
34 {{ template "common.names.fullname" . }}-client: "true"
35 - podSelector:
36 matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }}
37 app.kubernetes.io/component: keycloak
38 {{- if .Values.networkPolicy.additionalRules }}
39 {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.additionalRules "context" $) | nindent 8 }}
40 {{- end }}
41 {{- end }}
42{{- end }}