Use role to copy CNI bin (#5953)

This commit is contained in:
Maxime Guyot 2020-04-16 19:06:45 +02:00 committed by GitHub
parent 065292f8a4
commit 0924c2510c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 22 additions and 136 deletions

View file

@ -1,14 +0,0 @@
---
- name: CNI | make sure /opt/cni/bin exists
file:
path: /opt/cni/bin
state: directory
mode: 0755
owner: root
group: root
- name: CNI | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes

View file

@ -25,11 +25,6 @@ dependencies:
tags: tags:
- contiv - contiv
- role: kubernetes-apps/network_plugin/cni
when: kube_network_plugin == 'cni'
tags:
- cni
- role: kubernetes-apps/network_plugin/kube-ovn - role: kubernetes-apps/network_plugin/kube-ovn
when: kube_network_plugin == 'kube-ovn' when: kube_network_plugin == 'kube-ovn'
tags: tags:

View file

@ -0,0 +1,3 @@
---
dependencies:
- role: network_plugin/cni

View file

@ -40,23 +40,6 @@
when: when:
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
- name: Cilium | Set CNI directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
register: cni_bin_dir
- name: Cilium | Copy CNI plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
when: cilium_enable_portmap
- name: Cilium | Enable portmap addon - name: Cilium | Enable portmap addon
template: template:
src: 000-cilium-portmap.conflist.j2 src: 000-cilium-portmap.conflist.j2

View file

@ -1,15 +0,0 @@
---
- name: Cloud | Set cni directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: "u=rwX,g-rwx,o-rwx"
- name: Canal | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes

View file

@ -4,8 +4,9 @@
path: /opt/cni/bin path: /opt/cni/bin
state: directory state: directory
mode: 0755 mode: 0755
owner: root owner: kube
group: root recurse: true
- name: CNI | Copy cni plugins - name: CNI | Copy cni plugins
unarchive: unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz" src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"

View file

@ -0,0 +1,3 @@
---
dependencies:
- role: network_plugin/cni

View file

@ -144,21 +144,6 @@
- contiv_enable_api_proxy - contiv_enable_api_proxy
- contiv_generate_certificate - contiv_generate_certificate
- name: Contiv | Set cni directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
- name: Contiv | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Contiv | Copy netctl binary from docker container - name: Contiv | Copy netctl binary from docker container
command: sh -c "{{ docker_bin_dir }}/docker rm -f netctl-binarycopy; command: sh -c "{{ docker_bin_dir }}/docker rm -f netctl-binarycopy;
{{ docker_bin_dir }}/docker create --name netctl-binarycopy {{ contiv_image_repo }}:{{ contiv_image_tag }} && {{ docker_bin_dir }}/docker create --name netctl-binarycopy {{ contiv_image_repo }}:{{ contiv_image_tag }} &&

View file

@ -0,0 +1,3 @@
---
dependencies:
- role: network_plugin/cni

View file

@ -9,19 +9,3 @@
register: flannel_node_manifests register: flannel_node_manifests
when: when:
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
- name: Flannel | Set CNI directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
register: cni_bin_dir
- name: Flannel | Copy CNI plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes

View file

@ -0,0 +1,3 @@
---
dependencies:
- role: network_plugin/cni

View file

@ -3,22 +3,6 @@
include: annotate.yml include: annotate.yml
tags: annotate tags: annotate
- name: kube-router | Set cni directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
- name: kube-router | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
owner: kube
remote_src: yes
- name: kube-router | Create config directory - name: kube-router | Create config directory
file: file:
path: /var/lib/kube-router path: /var/lib/kube-router

View file

@ -0,0 +1,3 @@
---
dependencies:
- role: network_plugin/cni

View file

@ -1,20 +1,4 @@
--- ---
- name: Macvlan | Set cni directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
- name: Macvlan | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Macvlan | Retrieve Pod Cidr - name: Macvlan | Retrieve Pod Cidr
command: "{{ bin_dir }}/kubectl get nodes {{ kube_override_hostname | default(inventory_hostname) }} -o jsonpath='{.spec.podCIDR}'" command: "{{ bin_dir }}/kubectl get nodes {{ kube_override_hostname | default(inventory_hostname) }} -o jsonpath='{.spec.podCIDR}'"
register: node_pod_cidr_cmd register: node_pod_cidr_cmd

View file

@ -26,7 +26,7 @@ dependencies:
- canal - canal
- role: network_plugin/cni - role: network_plugin/cni
when: kube_network_plugin == 'cni' when: kube_network_plugin in ['cni', 'cloud']
tags: tags:
- cni - cni
@ -50,9 +50,6 @@ dependencies:
tags: tags:
- kube-router - kube-router
- role: network_plugin/cloud
when: kube_network_plugin == 'cloud'
- role: network_plugin/multus - role: network_plugin/multus
when: kube_network_plugin_multus when: kube_network_plugin_multus
tags: tags:

View file

@ -0,0 +1,3 @@
---
dependencies:
- role: network_plugin/cni

View file

@ -1,20 +1,4 @@
--- ---
- name: Weave | Set cni directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
- name: Weave | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Weave | Create manifest - name: Weave | Create manifest
template: template:
src: weave-net.yml.j2 src: weave-net.yml.j2