# apiVersion: apps/v1
# kind: Deployment
# metadata:
#   name: rabbitmq
# spec:
#   replicas: 1
#   selector:
#     matchLabels:
#       app: rabbitmq
#   template:
#     metadata:
#       labels:
#         app: rabbitmq
#     spec:
#       containers:
#       - name: 'rabbitmqcontainer'
#         image: 'docker.io/bitnami/rabbitmq:3.8-debian-10'
#         imagePullPolicy: IfNotPresent
#         resources:
#           limits:
#             memory: "128Mi"
#             cpu: "256m"
#         ports:
#         - containerPort: 4369
#         - containerPort: 5672
#         - containerPort: 15672
#         - containerPort: 25672

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: rabbitmq
spec:
  replicas: 1
  serviceName: rabbitmq
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:3-management
        env:
        - name: "RABBITMQ_ERLANG_COOKIE"
          value: "1WqgH8N2v1qDBDZDbNy8Bg9IkPWLEpu79m6q+0t36lQ="
        volumeMounts:
        - mountPath: /var/lib/rabbitmq
          name: rabbitmq-data
      volumes:
        - name: rabbitmq-data
          hostPath:
            path: /data/rabbitmq
            type: DirectoryOrCreate