{{$PROMETHEUS_SCRAPE_KUBE_NETWORK_POLICIES := DefaultParam .PROMETHEUS_SCRAPE_KUBE_NETWORK_POLICIES false}}

{{if $PROMETHEUS_SCRAPE_KUBE_NETWORK_POLICIES}}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  labels:
    k8s-app: kube-network-policies-pods
  name: kube-network-policies-pods
  namespace: monitoring
spec:
  podMetricsEndpoints:
    - interval: 10m
      # see https://github.com/prometheus-operator/prometheus-operator/pull/3078
      targetPort: 9080
  jobLabel: k8s-app
  selector:
    matchLabels:
      k8s-app: kube-network-policies
  namespaceSelector:
    matchNames:
      - kube-system
{{end}}
