# version: '3.7'
# # k8s namespace network
---
apiVersion: v1
kind: Service
metadata:
  name: rabbitmq
  namespace: edoc2
  labels:
    app: rabbitmq
spec:
  ports:
  - name: mqport
    port: 5672
    targetPort: 5672
    protocol: TCP
  - name: webport
    port: 15672
    targetPort: 15672
    protocol: TCP
  selector:
    app: rabbitmq
  type: ClusterIP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: rabbitmq
  namespace: edoc2
  labels:
    app: rabbitmq
    k8s-app: rabbitmq
spec:
  selector:
    matchLabels:
      app: rabbitmq
  serviceName: rabbitmq
  replicas: 1
  revisionHistoryLimit: 5
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      terminationGracePeriodSeconds: 30
      containers:
      - name: mq-container
        image: registry.edoc2.com:5000/edoc2v5/rabbitmq:v3.7.17.2
        imagePullPolicy: IfNotPresent
        envFrom:
        - configMapRef:
            name: menvfile
        env:
        - name: MODE
          value: "standalone"
        volumeMounts:
          - mountPath: /var/lib/rabbitmq
            name: owner-mq-volume
        ports:
        - containerPort: 5672
          name: mqport
          protocol: TCP
        - containerPort: 15672
          name: webport
          protocol: TCP
      restartPolicy: Always
      volumes:
        - name: owner-mq-volume
          hostPath:
            path: /home/data/rabbitmq
            type: DirectoryOrCreate
      nodeSelector:
        "node.labels.nodelabels": Middleware
        # nodetype: InDrive
