Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your inventory doesn't match the current cluster configuration - Calico checks against inventory does not always work as expected #8119

Closed
juliohm1978 opened this issue Oct 23, 2021 · 0 comments · Fixed by #8120
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@juliohm1978
Copy link
Contributor

  • Version of Ansible (ansible --version): Tested with 2.9.18 and 2.10.12
ansible 2.9.18
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/juliohm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/juliohm/.virtualenvs/ansible2.9.18/lib/python3.9/site-packages/ansible
  executable location = /home/juliohm/.virtualenvs/ansible2.9.18/bin/ansible
  python version = 3.9.7 (default, Oct 10 2021, 15:13:22) [GCC 11.1.0]
ansible 2.10.12
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/juliohm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/juliohm/.virtualenvs/ansible/lib/python3.9/site-packages/ansible
  executable location = /home/juliohm/.virtualenvs/ansible/bin/ansible
  python version = 3.9.7 (default, Oct 10 2021, 15:13:22) [GCC 11.1.0]
  • Version of Python (python --version): 3.9.7

Kubespray version (commit) (git rev-parse --short HEAD): b83e8b0

Tested with v1.15.x and v1.17.x

Network plugin used: Calico

Command used to invoke ansible:

ansible-playbook --become -i myinventory/inventory.ini -Kk cluster.yml -e kube_network_node_prefix=26

Output of ansible run:

TASK [network_plugin/calico : Check if inventory match current cluster configuration] *********************************************************************************************
fatal: [k8s-master01-lab-20190604.dis.tjpr.jus.br]: FAILED! => {
    "assertion": "calico_pool_conf.spec.blockSize == (calico_pool_blocksize | default(kube_network_node_prefix))",
    "changed": false,
    "evaluated_to": false,
    "msg": "Your inventory doesn't match the current cluster configuration"
}

Anything else do we need to know:
In our particular scenario, Calico's pool blockSize varies from the default 24. Initially, the playbook fails because of the different values. But as we pass -e kube_network_node_prefix=26 to the command line, the playbook also fails.

Debugging further, I found the assertion being made does not match, even when both values in the boolean equation are 26.

calico_pool_conf.spec.blockSize == (calico_pool_blocksize | default(kube_network_node_prefix))

As a downside of Yaml parsing, one these values is a string and the other is an integer. Ansible needs to compare them with equal types. The workaround I found is to change the assertion to

calico_pool_conf.spec.blockSize|string == (calico_pool_blocksize | default(kube_network_node_prefix | string))
@juliohm1978 juliohm1978 added the kind/bug Categorizes issue or PR as related to a bug. label Oct 23, 2021
@juliohm1978 juliohm1978 changed the title Your inventory doesn't match the current cluster configuration - Calico checks against inventory do not work as expected Your inventory doesn't match the current cluster configuration - Calico checks against inventory does not always work as expected Oct 23, 2021
k8s-ci-robot pushed a commit that referenced this issue Oct 24, 2021
sakuraiyuta pushed a commit to sakuraiyuta/kubespray that referenced this issue Apr 16, 2022
LuckySB pushed a commit to southbridgeio/kubespray that referenced this issue Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant