{{- if .Values.networkPolicy.enabled }} apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: {{ include "uptime-kuma.fullname" . }} labels: {{- include "uptime-kuma.labels" . | nindent 4 }} spec: podSelector: matchLabels: {{- include "uptime-kuma.selectorLabels" . | nindent 6 }} policyTypes: {{- if .Values.networkPolicy.ingress }} - Ingress {{- end }} {{- if .Values.networkPolicy.egress }} - Egress {{- end }} egress: - {} {{- if .Values.networkPolicy.ingress }} ingress: - ports: - port: {{ include "uptime-kuma.port" . }} protocol: TCP {{- if not .Values.networkPolicy.allowExternal }} from: - podSelector: matchLabels: {{ include "uptime-kuma.fullname" . }}-client: "true" {{- with .Values.networkPolicy.namespaceSelector }} - namespaceSelector: {{- toYaml . | nindent 10 }} {{- end }} {{- end }} {{- end }} {{- end }}