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

Update flannel use install-cni-plugin to fit upstream #8714

Merged
merged 3 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 11 additions & 25 deletions roles/download/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ kubelet_download_url: "https://storage.googleapis.com/kubernetes-release/release
kubectl_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kube_version }}/bin/linux/{{ image_arch }}/kubectl"
kubeadm_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kubeadm_version }}/bin/linux/{{ image_arch }}/kubeadm"
etcd_download_url: "https://github.com/etcd-io/etcd/releases/download/{{ etcd_version }}/etcd-{{ etcd_version }}-linux-{{ image_arch }}.tar.gz"
flannel_cni_download_url: "https://github.com/flannel-io/cni-plugin/releases/download/{{ flannel_cni_version }}/flannel-{{ image_arch }}"
cni_download_url: "https://github.com/containernetworking/plugins/releases/download/{{ cni_version }}/cni-plugins-linux-{{ image_arch }}-{{ cni_version }}.tgz"
calicoctl_download_url: "https://github.com/projectcalico/calicoctl/releases/download/{{ calico_ctl_version }}/calicoctl-linux-{{ image_arch }}"
calicoctl_alternate_download_url: "https://github.com/projectcalico/calico/releases/download/{{ calico_ctl_version }}/calicoctl-linux-{{ image_arch }}"
Expand Down Expand Up @@ -528,16 +527,6 @@ etcd_binary_checksums:
v3.5.1: 4c2598f43c1565428f8b645e741739a1e84300d5f2af3e4b335982862c98dc6f
v3.5.2: 3d37187b042a32b7234a1e2a4612374db50c9a50e0cdd63baaa0d52d91335186

flannel_cni_binary_checksums:
arm:
v1.0.0: bd36adccabf9974c0a9f9a09bfe35558ddeb83636efefa94bc260ef267e14671
arm64:
v1.0.0: eb7183498b5d1ae4034dde6184e4396270e29ed88482b295f81b93eb3120c61c
amd64:
v1.0.0: 22dc9152571167f30d59d1e512bb7f4b4978175ddd46a30b24ad247c8c843dd7
ppc64le:
v1.0.0: 994d206a84013b050677d3e09b53485faaa9e769a43065cf4674efb52fafb18c

cni_binary_checksums:
arm:
v1.0.1: d35e3e9fd71687fc7e165f7dc7b1e35654b8012995bbfd937946b0681926d62d
Expand Down Expand Up @@ -797,7 +786,6 @@ containerd_archive_checksums:
1.6.2: 0

etcd_binary_checksum: "{{ etcd_binary_checksums[image_arch][etcd_version] }}"
flannel_cni_binary_checksum: "{{ flannel_cni_binary_checksums[image_arch][flannel_cni_version] }}"
cni_binary_checksum: "{{ cni_binary_checksums[image_arch][cni_version] }}"
kubelet_binary_checksum: "{{ kubelet_checksums[image_arch][kube_version] }}"
kubectl_binary_checksum: "{{ kubectl_checksums[image_arch][kube_version] }}"
Expand Down Expand Up @@ -830,6 +818,8 @@ etcd_image_repo: "{{ quay_image_repo }}/coreos/etcd"
etcd_image_tag: "{{ etcd_version }}{%- if image_arch != 'amd64' -%}-{{ image_arch }}{%- endif -%}"
flannel_image_repo: "{{ quay_image_repo }}/coreos/flannel"
flannel_image_tag: "{{ flannel_version }}-{{ image_arch }}"
flannel_init_image_repo: "{{ docker_image_repo }}/flannelcni/flannel-cni-plugin"
flannel_init_image_tag: "{{ flannel_cni_version }}"
calico_node_image_repo: "{{ quay_image_repo }}/calico/node"
calico_node_image_tag: "{{ calico_version }}{%- if image_arch != 'amd64' -%}-{{ image_arch }}{%- endif -%}"
calico_cni_image_repo: "{{ quay_image_repo }}/calico/cni"
Expand Down Expand Up @@ -1016,19 +1006,6 @@ downloads:
groups:
- etcd

flannel_cni:
enabled: "{{ kube_network_plugin == 'flannel' }}"
file: true
version: "{{ flannel_cni_version }}"
dest: "{{ local_release_dir }}/flannel-{{ flannel_cni_version }}-{{ image_arch }}"
sha256: "{{ flannel_cni_binary_checksum }}"
url: "{{ flannel_cni_download_url }}"
unarchive: false
owner: "root"
mode: "0755"
groups:
- k8s_cluster

cni:
enabled: true
file: true
Expand Down Expand Up @@ -1256,6 +1233,15 @@ downloads:
groups:
- k8s_cluster

flannel_init:
enabled: "{{ kube_network_plugin == 'flannel' or kube_network_plugin == 'canal' }}"
container: true
repo: "{{ flannel_init_image_repo }}"
tag: "{{ flannel_init_image_tag }}"
sha256: "{{ flannel_init_digest_checksum|default(None) }}"
groups:
- k8s_cluster

calicoctl:
enabled: "{{ kube_network_plugin == 'calico' or kube_network_plugin == 'canal' }}"
file: true
Expand Down
12 changes: 0 additions & 12 deletions roles/network_plugin/flannel/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
---
- name: runc | Download flannel binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.flannel_cni) }}"

- name: Copy flannel binary from download dir
copy:
src: "{{ downloads.flannel_cni.dest }}"
dest: "/opt/cni/bin/flannel"
mode: 0755
remote_src: true

- name: Flannel | Create Flannel manifests
template:
src: "{{ item.file }}.j2"
Expand Down
13 changes: 12 additions & 1 deletion roles/network_plugin/flannel/templates/cni-flannel.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ spec:
values:
- {{ arch }}
initContainers:
- name: install-cni-plugin
image: {{ flannel_init_image_repo }}:{{ flannel_init_image_tag }}
command:
- cp
args:
- -f
- /flannel
- /opt/cni/bin/flannel
volumeMounts:
- name: cni-plugin
mountPath: /opt/cni/bin
- name: install-cni
image: {{ flannel_image_repo }}:{{ flannel_image_tag | regex_replace(image_arch,'') }}{{ arch }}
command:
Expand Down Expand Up @@ -135,7 +146,7 @@ spec:
- name: flannel-cfg
configMap:
name: kube-flannel-cfg
- name: host-cni-bin
- name: cni-plugin
hostPath:
path: /opt/cni/bin
updateStrategy:
Expand Down