45 lines
1.7 KiB
YAML
45 lines
1.7 KiB
YAML
{{- /*
|
|
Copyright VMware, Inc.
|
|
SPDX-License-Identifier: APACHE-2.0
|
|
*/}}
|
|
|
|
{{- if .Values.networkPolicy.enabled }}
|
|
kind: NetworkPolicy
|
|
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
|
|
metadata:
|
|
name: {{ include "common.names.fullname" . }}
|
|
namespace: {{ template "zookeeper.namespace" . }}
|
|
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- $podLabels := merge .Values.podLabels .Values.commonLabels }}
|
|
podSelector:
|
|
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
# Allow inbound connections to ZooKeeper
|
|
- ports:
|
|
- port: {{ .Values.containerPorts.client }}
|
|
{{- if .Values.metrics.enabled }}
|
|
- port: {{ .Values.metrics.containerPort }}
|
|
{{- end }}
|
|
{{- if not .Values.networkPolicy.allowExternal }}
|
|
from:
|
|
- podSelector:
|
|
matchLabels:
|
|
{{ include "common.names.fullname" . }}-client: "true"
|
|
- podSelector:
|
|
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
|
|
{{- end }}
|
|
# Allow internal communications between nodes
|
|
- ports:
|
|
- port: {{ .Values.containerPorts.follower }}
|
|
- port: {{ .Values.containerPorts.election }}
|
|
from:
|
|
- podSelector:
|
|
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
|
|
{{- end }}
|