Skip to content

Commit

Permalink
Apply workaround for NetworkManager and calico (kubernetes-sigs#5230)
Browse files Browse the repository at this point in the history
Change-Id: I5cb2bdf1a57707c1b8da3e5ac0c80e5c353480a4
  • Loading branch information
mattymo authored and k8s-ci-robot committed Oct 2, 2019
1 parent a43e0d3 commit fb591bf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ skip_list:
# These either still need to be corrected in the repository and the rules re-enabled or documented why they are skipped on purpose.
- '301'
- '302'
- '303'
- '305'
- '306'
- '404'
Expand Down
6 changes: 6 additions & 0 deletions roles/network_plugin/calico/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
- name: containerd | delete calico-node containers
shell: 'crictl pods --name calico-node-* -q | xargs -I% --no-run-if-empty bash -c "crictl stopp % && crictl rmp %"'
when: container_manager in ["crio", "containerd"]

- name: Calico | Reload NetworkManager
service:
name: NetworkManager
state: reloaded
when: '"running" in nm_check.stdout'
22 changes: 22 additions & 0 deletions roles/network_plugin/calico/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@
mode: 0755
remote_src: yes

- name: Calico | Check if host has NetworkManager
command: systemctl show NetworkManager
register: nm_check
failed_when: false
changed_when: false

- name: Calico | Ensure NetworkManager conf.d dir
file:
path: "/etc/NetworkManager/conf.d"
state: directory
recurse: yes
when: nm_check.rc == 0

- name: Calico | Prevent NetworkManager from managing Calico interfaces
copy:
content: |
[keyfile]
unmanaged-devices=interface-name:cali*;interface-name:tunl*
dest: /etc/NetworkManager/conf.d/calico.conf
when: nm_check.rc == 0
notify: Calico | Reload NetworkManager

- name: Calico | Write Calico cni config
template:
src: "cni-calico.conflist.j2"
Expand Down

0 comments on commit fb591bf

Please sign in to comment.