{{- if .Values.networkPolicy.enabled -}}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: {{ include "garage-ui.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "garage-ui.labels" . | nindent 4 }}
spec:
  podSelector:
    matchLabels:
      {{- include "garage-ui.selectorLabels" . | nindent 6 }}
  policyTypes:
    {{- toYaml .Values.networkPolicy.policyTypes | nindent 4 }}
  ingress:
  - from: []
    ports:
    - protocol: TCP
      port: 8080
  egress:
  - to: []
    ports:
    - protocol: TCP
      port: 53
    - protocol: UDP
      port: 53
{{- end }}
