apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: oase
  name: rabbitmq
  labels:
    name: rabbitmq
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      name: rabbitmq
  template:
    metadata:
      labels:
        name: rabbitmq
    spec:
      hostname: rabbitmq
      containers:
        - name: rabbitmq
          image: rabbitmq:3.9.8-management
          imagePullPolicy: IfNotPresent
          resources: {}
          env:
            - name: RABBITMQ_DEFAULT_USER
              valueFrom:
                secretKeyRef:
                  name: mq-secret
                  key: mq-user
            - name: RABBITMQ_DEFAULT_PASS
              valueFrom:
                secretKeyRef:
                  name: mq-secret
                  key: mq-password
          ports:
            - containerPort: 5672
              name: amqp
            - containerPort: 15672
              name: management
          volumeMounts:
            - mountPath: "/var/lib/rabbitmq/mnesia"
              name: rabbitmq-data
              readOnly: false
          securityContext:
            capabilities: {}
            privileged: false
      volumes:
        - name: rabbitmq-data
          persistentVolumeClaim:
            claimName: rabbitmq-data-pvc
