{{- if .Values.clusterConfig.cilium.enabled }}
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-inter-node-traffic
  namespace: rabbitmq
spec:
  description: Allow communication between nodes int the RabbitMQ cluster
  egress:
    - toEndpoints:
        - matchLabels:
            app.kubernetes.io/component: rabbitmq
      toPorts:
        - ports:
            - port: "4369"
            - endPort: 6500
              port: "6000"
            - port: "25672"
            - port: "35672"
            - port: "35673"
            - port: "35674"
            - port: "35675"
            - port: "35676"
            - port: "35677"
            - port: "35678"
            - port: "35679"
            - port: "35680"
            - port: "35681"
            - port: "35682"
  endpointSelector:
    matchLabels:
      app.kubernetes.io/component: rabbitmq
  ingress:
    - fromEndpoints:
        - matchLabels:
            app.kubernetes.io/component: rabbitmq
      toPorts:
        - ports:
            - port: "4369"
            - endPort: 6500
              port: "6000"
            - port: "25672"
            - port: "35672"
            - port: "35673"
            - port: "35674"
            - port: "35675"
            - port: "35676"
            - port: "35677"
            - port: "35678"
            - port: "35679"
            - port: "35680"
            - port: "35681"
            - port: "35682"
{{- end }}
