{{- if .Values.clusterConfig.cilium.enabled }}
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-promtail-to-api-server
  namespace: loki
spec:
  description: Promtail needs to reach kube-apiserver
  egress:
    - toEntities:
        - kube-apiserver
      toPorts:
        - ports:
            - port: "6443"
              protocol: TCP
  endpointSelector:
    matchLabels:
      app.kubernetes.io/instance: promtail
{{- end }}
