{{- if .Values.networkPolicy.enabled }} kind: NetworkPolicy apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} metadata: name: {{ template "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: keycloak {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: podSelector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} ingress: - ports: - port: {{ .Values.containerPorts.http }} {{- if .Values.tls.enabled }} - port: {{ .Values.containerPorts.https }} {{- end }} {{- if not .Values.networkPolicy.allowExternal }} from: - podSelector: matchLabels: {{ template "common.names.fullname" . }}-client: "true" - podSelector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} app.kubernetes.io/component: keycloak {{- if .Values.networkPolicy.additionalRules }} {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.additionalRules "context" $) | nindent 8 }} {{- end }} {{- end }} {{- end }}