{%- 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_scheduler_replicas }}
  template:
    metadata:
      labels:
        service: nova
        type: scheduler
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
        pod.alpha.kubernetes.io/init-containers: '[
          {
             "name": "initialize-nova-scheduler",
             "image": "{{ kolla_toolbox_image_full }}",
             "command": [
                 "sh",
                 "-c",
                 "cp -a /config/..data/* /nova/; "],
             "volumeMounts": [
                {
                   "name": "nova-scheduler-config",
                   "mountPath": "/config/"
                },
                {
                   "name": "nova-config",
                   "mountPath": "/nova/"
                }
             ]
          }
        ]'
    spec:
      nodeSelector:
{%- set selector = kolla_kubernetes_hostlabel_nova_scheduler |
                       default(kolla_kubernetes_hostlabel_controller)
%}
          {{ selector.key }}: {{ selector.value }}
      containers:
        - name: main
          image: "{{ nova_scheduler_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 }}
          securityContext:
            privileged: true
{{ lib.common_containers(indent=8) }}
      volumes:
{{ lib.common_volumes(indent=8) }}
        - name: nova-scheduler-config
          configMap:
            name: nova-scheduler
        - name: lib-modules
          hostPath:
            path: /lib/modules
        - name: nova-config
          emptyDir: {}
metadata:
   name: nova-scheduler
   namespace: {{ kolla_kubernetes_namespace }}
