diff --git a/charts/keycloakx/templates/networkpolicy-egress.yaml b/charts/keycloakx/templates/networkpolicy-egress.yaml deleted file mode 100644 index 016939b2..00000000 --- a/charts/keycloakx/templates/networkpolicy-egress.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if and .Values.networkPolicy.enabled .Values.networkPolicy.egress }} -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - name: {{ include "keycloak.fullname" . }}-egress - namespace: {{ .Release.Namespace }} - labels: - {{- include "keycloak.labels" . | nindent 4 }} - {{- range $key, $value := .Values.networkPolicy.labels }} - {{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }} - {{- end }} -spec: - policyTypes: - - Egress - podSelector: - matchLabels: - {{- include "keycloak.selectorLabels" . | nindent 6 }} - egress: - {{- .Values.networkPolicy.egress | toYaml | nindent 4 }} -{{- end }} diff --git a/charts/keycloakx/templates/networkpolicy.yaml b/charts/keycloakx/templates/networkpolicy.yaml index d311cc44..f375327f 100644 --- a/charts/keycloakx/templates/networkpolicy.yaml +++ b/charts/keycloakx/templates/networkpolicy.yaml @@ -12,6 +12,9 @@ metadata: spec: policyTypes: - Ingress + {{- if .Values.networkPolicy.egress }} + - Egress + {{- end}} podSelector: matchLabels: {{- include "keycloak.selectorLabels" . | nindent 6 }} @@ -42,4 +45,8 @@ spec: - protocol: {{ default "TCP" .protocol }} port: {{ .containerPort }} {{- end }} + {{- if .Values.networkPolicy.egress }} + egress: + {{- .Values.networkPolicy.egress | toYaml | nindent 4 }} + {{- end }} {{- end }}