{{- if .Values.networkPolicy.enabled }} --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: {{ include "ntfy.fullname" . }} labels: {{- include "ntfy.labels" . | nindent 4 }} spec: podSelector: matchLabels: {{- include "ntfy.selectorLabels" . | nindent 6 }} policyTypes: - Ingress {{- if .Values.networkPolicy.egress.enabled }} - Egress {{- end }} ingress: {{- with .Values.networkPolicy.ingress.http }} - ports: - port: {{ $.Values.service.http.port }} protocol: TCP from: {{- toYaml . | nindent 8 }} {{- end }} {{- if and .Values.ntfy.metrics.enable .Values.networkPolicy.ingress.metrics }} - ports: - port: {{ .Values.ntfy.metrics.port }} protocol: TCP from: {{- toYaml .Values.networkPolicy.ingress.metrics | nindent 8 }} {{- end }} {{- if and .Values.service.smtp.enabled .Values.networkPolicy.ingress.smtp }} - ports: - port: {{ .Values.service.smtp.port }} protocol: TCP from: {{- toYaml .Values.networkPolicy.ingress.smtp | nindent 8 }} {{- end }} {{- with .Values.networkPolicy.egress }} egress: {{- toYaml .extra | nindent 4 }} {{- end }} {{- end }}