{%- set podTypeBootstrap = "yes" %}
{%- set resourceName = kolla_kubernetes.cli.args.resource_name %}
{%- import "services/common/common-lib.yml.j2" as lib with context %}
apiVersion: batch/v1
kind: Job
spec:
  template:
    spec:
      nodeSelector:
{%- set selector = kolla_kubernetes_hostlabel_controller %}
          {{ selector.key }}: {{ selector.value }}
      containers:
        - image: "{{ rabbitmq_image_full }}"
          name: main
          volumeMounts:
{{ lib.common_volume_mounts(indent=12) }}
            - mountPath: {{ container_config_directory }}
              name: rabbitmq-config
            - mountPath: /var/lib/rabbitmq
              name: rabbitmq-persistent-storage
          env:
            - name: KOLLA_BOOTSTRAP
              value: ""
            - name: KOLLA_CONFIG_STRATEGY
              value: {{ config_strategy }}
            - name: RABBITMQ_CLUSTER_COOKIE
              value: {{ rabbitmq_cluster_cookie }}
      volumes:
{{ lib.common_volumes(indent=8) }}
        - name: rabbitmq-config
          configMap:
            name: rabbitmq
        - name: rabbitmq-persistent-storage
          persistentVolumeClaim:
            claimName: {{ kolla_kubernetes.template.vars.pvc_name }}
      restartPolicy: OnFailure
metadata:
  name: rabbitmq-bootstrap
  namespace: {{ kolla_kubernetes_namespace }}
