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 | {{- if .Values.networkPolicy.enabled }} |
| 7 | kind: NetworkPolicy |
| 8 | apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} |
| 9 | metadata: |
| 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 }} |
| 20 | spec: |
| 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 }} |