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