Skip to content

Failed to remove or reset node when number of etcd hosts is not divisible by 2 #12268

@tyeung-harmonicinc

Description

@tyeung-harmonicinc

What happened?

In a cluster with 7 etcd hosts, I removed an etcd host using remove_node.yml playbook. Then when I tried to remove another etcd host using remove_node.yml playbook, it failed at:

TASK [validate_inventory : Stop if even number of etcd hosts] ******************
fatal: [test-rm-c1]: FAILED! => {
    "assertion": "groups.get('etcd', groups.kube_control_plane) | length is not divisibleby 2",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"
}

Running reset.yml also failed at the same place.

Issue is introduced by commit 1b99195 where validate_inventory role is added to boilerplate.yml playbook.

What did you expect to happen?

I can remove a node from a cluster with even number of etcd hosts (e.g. to make the cluster with odd number of etcd hosts).

I should also be able to reset a cluster with even number of etcd hosts.

How can we reproduce it (as minimally and precisely as possible)?

Run the remove_node.yml and reset.yml playbooks with even number of etcd hosts.

OS

RHEL 8

Version of Ansible

core 2.16.14

Version of Python

3.12.8

Version of Kubespray (commit)

v2.28.0

Network plugin used

flannel

Full inventory with variables

Command used to invoke ansible

Output of ansible run

Anything else we need to know

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    RHEL 8kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions