---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.rabbitmq.name }}
spec:
  selector:
    matchLabels:
      app:  {{ .Values.rabbitmq.app }}
  replicas: {{ .Values.rabbitmq.replicaCount }}
  template:
    metadata:
      labels:
        app: {{ .Values.rabbitmq.app }}
    spec:
      securityContext:
        {{- toYaml .Values.rabbitmq.podSecurityContext | nindent 8 }}
      containers:
        - image: "{{ .Values.rabbitmq.image}}:{{ .Values.rabbitmq.tag}}"
          securityContext:
            {{- toYaml .Values.rabbitmq.securityContext | nindent 12 }}
          resources:
            {{- toYaml .Values.rabbitmq.resources | nindent 12 }}
          imagePullPolicy: {{ .Values.rabbitmq.imagePullPolicy}}
          name:  {{ .Values.rabbitmq.name }}
          ports:
          - containerPort: 5672
---
apiVersion: v1
kind: Service
metadata:
  name:  {{ .Values.rabbitmq.name }}
spec:
  ports:
    - port: 5672
      targetPort: 5672
      protocol: TCP
  type: ClusterIP
  selector:
    app: {{ .Values.rabbitmq.app }}
---