mirror of
https://github.com/dredx/prole.git
synced 2026-09-27 04:34:30 +00:00
Prefer infra-managed manifests for bootstrap; reconcile CNPG instances based on Ready+schedulable labeled db nodes; update manifests to use node-role affinity + anti-affinity; add policy/tests and config touch-ups (incl. prole.cfg).
38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
---
|
|
|
|
- name: Unit test - optional workloads policy evaluation
|
|
hosts: localhost
|
|
gather_facts: false
|
|
|
|
vars:
|
|
_k3s_nodes_list:
|
|
stdout_lines:
|
|
- "node-a Ready"
|
|
- "node-b Ready,SchedulingDisabled"
|
|
- "node-c NotReady"
|
|
|
|
tasks:
|
|
- name: Evaluate with min_required=2 (should be false)
|
|
ansible.builtin.include_tasks: "{{ playbook_dir }}/../tasks/optional_workloads_policy_eval.yml"
|
|
vars:
|
|
k3s_optional_workloads_min_nodes_cfg: "2"
|
|
|
|
- name: Assert optional_workloads_allowed is false when only one schedulable node is Ready
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ready_schedulable_nodes == 1
|
|
- optional_workloads_min_ready_schedulable_nodes == 2
|
|
- not (optional_workloads_allowed | bool)
|
|
|
|
- name: Evaluate with min_required=1 (should be true)
|
|
ansible.builtin.include_tasks: "{{ playbook_dir }}/../tasks/optional_workloads_policy_eval.yml"
|
|
vars:
|
|
k3s_optional_workloads_min_nodes_cfg: "1"
|
|
|
|
- name: Assert optional_workloads_allowed is true when min_required is satisfied
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ready_schedulable_nodes == 1
|
|
- optional_workloads_min_ready_schedulable_nodes == 1
|
|
- optional_workloads_allowed | bool
|