{{- if .Values.rke2IngressNginx.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  annotations:
    np.rke2.io/ingress: resolved
  name: rke2-ingress-network-policy
  namespace: {{ include "rke2-ingress-nginx.namespace" . }}
spec:
  ingress:
    - ports:
        - port: {{ .Values.rke2IngressNginx.metricsPort }}
          protocol: TCP
  podSelector:
    matchLabels:
      app.kubernetes.io/name: rke2-ingress-nginx
  policyTypes:
    - Ingress
  {{- end }}
