apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq-deployment
  namespace: rabbitmq
spec:
  replicas: 1  # You can adjust the number of replicas as needed
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: private-repo:5000/rabbitmq:3.12.9  # Use the desired RabbitMQ Docker image
        ports:
        - containerPort: 5672
        - containerPort: 15672  # Ensure this port matches the management UI port
        env:
        - name: RABBITMQ_DEFAULT_USER
          value: rabbitmq
        - name: RABBITMQ_DEFAULT_PASS
          value: rabbitmq
        volumeMounts:
        - mountPath: "/var/lib/rabbitmq"
          name: rabbitmq-pv-volume
        lifecycle:
          postStart:
            exec:
              command:
              - "/bin/sh"
              - "-c"
              - |
                rabbitmq-plugins enable rabbitmq_management
      volumes:
        - name: rabbitmq-pv-volume
          persistentVolumeClaim:
            claimName: rabbitmq-pv-claim
      nodeSelector:
        name: node-1
          
