{%- set resourceName = kolla_kubernetes.cli.args.resource_name %}
{%- import "services/common/common-lib.yml.j2" as lib with context %}
apiVersion: apps/v1alpha1
kind: PetSet
spec:
  serviceName: "nova"
  replicas: {{ nova_conductor_replicas }}
  template:
    metadata:
      labels:
        service: nova
        type: conductor
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
        pod.alpha.kubernetes.io/init-containers: '[
          {
             "name": "initialize-nova-conductor",
             "image": "{{ kolla_toolbox_image_full }}",
             "command": [
                 "sh",
                 "-ce",
                 "cp -a /config/..data/* /nova/; "],
             "volumeMounts": [
                {
                   "name": "nova-conductor-config",
                   "mountPath": "/config/"
                },
                {
                   "name": "nova-config",
                   "mountPath": "/nova/"
                }
             ]
          }
        ]'
    spec:
      nodeSelector:
{%- set selector = kolla_kubernetes_hostlabel_nova_conductor |
                       default(kolla_kubernetes_hostlabel_controller)
%}
          {{ selector.key }}: {{ selector.value }}
      containers:
        - name: main
          image: "{{ nova_conductor_image_full }}"
          volumeMounts:
{{ lib.common_volume_mounts(indent=12) }}
            - mountPath: {{ container_config_directory }}
              name: nova-config
            - mountPath: /nova
              name: nova-config
          env:
            - name: KOLLA_CONFIG_STRATEGY
              value: {{ config_strategy }}
{{ lib.common_containers(indent=8) }}
      volumes:
{{ lib.common_volumes(indent=8) }}
        - name: nova-conductor-config
          configMap:
            name: nova-conductor
        - name: lib-modules
          hostPath:
            path: /lib/modules
        - name: nova-config
          emptyDir: {}
metadata:
   name: nova-conductor
   namespace: {{ kolla_kubernetes_namespace }}
