descheduler-cronjob.yaml.j2 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. apiVersion: batch/v1beta1
  2. kind: CronJob
  3. metadata:
  4. name: "{{ openshift_descheduler_cronjob_name }}"
  5. namespace: openshift-descheduler
  6. spec:
  7. schedule: "{{ openshift_descheduler_cronjob_schedule }}"
  8. jobTemplate:
  9. spec:
  10. template:
  11. metadata:
  12. annotations:
  13. scheduler.alpha.kubernetes.io/critical-pod: ''
  14. name: "{{ openshift_descheduler_cronjob_name }}"
  15. spec:
  16. containers:
  17. - name: descheduler
  18. image: "{{ openshift_descheduler_image_prefix }}descheduler:{{ openshift_descheduler_image_version }}"
  19. volumeMounts:
  20. - mountPath: /policy-dir
  21. name: policy-volume
  22. command:
  23. - /bin/descheduler
  24. args:
  25. - --policy-config-file=/policy-dir/policy.yaml
  26. - --v={{ openshift_descheduler_debug_level }}
  27. {% if openshift_descheduler_dry_run_mode is defined and (openshift_descheduler_dry_run_mode | bool) %}
  28. - --dry-run
  29. {% endif %}
  30. {% if openshift_descheduler_node_selectors is defined and openshift_descheduler_node_selectors is not none %}
  31. - --node-selector="{{ openshift_descheduler_node_selectors }}"
  32. {% endif %}
  33. restartPolicy: "Never"
  34. {% if openshift_descheduler_cronjob_node_selector is iterable and openshift_descheduler_cronjob_node_selector | length > 0 %}
  35. nodeSelector:
  36. {% for key, value in openshift_descheduler_cronjob_node_selector.items() %}
  37. {{ key }}: "{{ value }}"
  38. {% endfor %}
  39. {% endif %}
  40. serviceAccountName: "{{ openshift_descheduler_service_account }}"
  41. volumes:
  42. - name: policy-volume
  43. configMap:
  44. name: "{{ openshift_descheduler_policy_configmap_name }}"