Skip to content

Commit

Permalink
Use calico_pool_blocksize from cluster when existing (kubernetes-sigs…
Browse files Browse the repository at this point in the history
…#10516)

The blockSize attribute from Calico IPPool resources cannot be changed
once set [1]. Consequently, we use the one currently defined when
configuring the existing IPPool, avoiding upgrade errors by trying to
change it.

In particular, this can be useful when calico_pool_blocksize default
changes in kubespray, which would otherwise force users to add an
explicit setting to their inventories.

[1]: https://docs.tigera.io/calico/latest/reference/resources/ippool#spec
  • Loading branch information
VannTen authored and guy.gold committed Oct 30, 2023
1 parent 773d707 commit abc7b61
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions roles/network_plugin/calico/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,20 @@
}
- name: Calico | Process calico network pool
set_fact:
_calico_pool: "{{ _calico_pool_cmd.stdout | from_json | combine(_calico_pool, recursive=True) }}"
when:
- _calico_pool_cmd is success
block:
- name: Calico | Get current calico network pool blocksize
set_fact:
_calico_blocksize: >
{
"spec": {
"blockSize": {{ (_calico_pool_cmd.stdout | from_json).spec.blockSize }}
}
}
- name: Calico | Merge calico network pool
set_fact:
_calico_pool: "{{ _calico_pool_cmd.stdout | from_json | combine(_calico_pool, _calico_blocksize, recursive=True) }}"

- name: Calico | Configure calico network pool
command:
Expand Down Expand Up @@ -273,10 +283,20 @@
}
- name: Calico | Process calico ipv6 network pool
set_fact:
_calico_pool_ipv6: "{{ _calico_pool_ipv6_cmd.stdout | from_json | combine(_calico_pool_ipv6, recursive=True) }}"
when:
- _calico_pool_ipv6_cmd is success
block:
- name: Calico | Get current calico ipv6 network pool blocksize
set_fact:
_calico_blocksize_ipv6: >
{
"spec": {
"blockSize": {{ (_calico_pool_ipv6_cmd.stdout | from_json).spec.blockSize }}
}
}
- name: Calico | Merge calico ipv6 network pool
set_fact:
_calico_pool_ipv6: "{{ _calico_pool_ipv6_cmd.stdout | from_json | combine(_calico_pool_ipv6, _calico_blocksize_ipv6, recursive=True) }}"

- name: Calico | Configure calico ipv6 network pool
command:
Expand Down

0 comments on commit abc7b61

Please sign in to comment.