{{- if .Values.clusterConfig.cilium.enabled }}
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-opencost-scrape
  namespace: prometheus
spec:
  description: Allow OpenCost scrape
  endpointSelector:
    matchLabels:
      app.kubernetes.io/name: prometheus
  ingress:
    - fromEndpoints:
        - matchLabels:
            app.kubernetes.io/name: opencost
            io.kubernetes.pod.namespace: opencost
    - toPorts:
        - ports:
            - port: "9090"
              protocol: TCP
{{- end }}
