Skip to content

Commit

Permalink
fix: change cni bin directory t0 /opt/cni/bin #1248
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Apr 16, 2023
1 parent 54bae28 commit e2bd948
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 28 deletions.
2 changes: 1 addition & 1 deletion roles/calico/templates/calico-v3.19.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ spec:
# Used to install CNI.
- name: cni-bin-dir
hostPath:
path: {{ bin_dir }}
path: /opt/cni/bin
- name: cni-net-dir
hostPath:
path: /etc/cni/net.d
Expand Down
2 changes: 1 addition & 1 deletion roles/calico/templates/calico-v3.23.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ spec:
# Used to install CNI.
- name: cni-bin-dir
hostPath:
path: {{ bin_dir }}
path: /opt/cni/bin
- name: cni-net-dir
hostPath:
path: /etc/cni/net.d
Expand Down
2 changes: 1 addition & 1 deletion roles/calico/templates/calico-v3.24.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ spec:
# Used to install CNI.
- name: cni-bin-dir
hostPath:
path: {{ bin_dir }}
path: /opt/cni/bin
- name: cni-net-dir
hostPath:
path: /etc/cni/net.d
Expand Down
2 changes: 1 addition & 1 deletion roles/cilium/templates/values.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resources:
memory: 512Mi

cni:
binPath: {{ bin_dir }}
binPath: /opt/cni/bin

containerRuntime:
integration: containerd
Expand Down
2 changes: 1 addition & 1 deletion roles/containerd/templates/config.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ version = 2
unset_seccomp_profile = ""

[plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "{{ bin_dir }}"
bin_dir = "/opt/cni/bin"
conf_dir = "/etc/cni/net.d"
conf_template = "/etc/cni/net.d/10-default.conf"
max_conf_num = 1
Expand Down
8 changes: 0 additions & 8 deletions roles/flannel/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
- name: 下载cni plugins
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items:
- bridge
- host-local
- loopback
- portmap

- name: 配置 flannel DaemonSet yaml文件
template: src=kube-flannel.yaml.j2 dest={{ cluster_dir }}/yml/flannel.yaml
run_once: true
Expand Down
2 changes: 1 addition & 1 deletion roles/flannel/templates/kube-flannel.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ spec:
path: /run/flannel
- name: cni-plugin
hostPath:
path: {{ bin_dir }}
path: /opt/cni/bin
- name: cni
hostPath:
path: /etc/cni/net.d
Expand Down
12 changes: 8 additions & 4 deletions roles/kube-node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
with_items:
- /var/lib/kubelet
- /var/lib/kube-proxy
- /etc/cni/net.d
- /opt/cni/bin

- name: 下载 kubelet,kube-proxy 二进制和基础 cni plugins
- name: 下载 kubelet,kube-proxy 二进制
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items:
- kubectl
- kubelet
- kube-proxy
- bridge
- host-local
- loopback
tags: upgrade_k8s

- name: 下载 cni plugins 二进制文件
copy: src={{ item }} dest=/opt/cni/bin/ mode=0755
with_fileglob:
- {{ base_dir }}/bin/cni-bin/*

- name: 添加 kubectl 自动补全
lineinfile:
dest: ~/.bashrc
Expand Down
2 changes: 1 addition & 1 deletion roles/kube-ovn/templates/kube-ovn.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ spec:
path: /etc/cni/net.d
- name: cni-bin
hostPath:
path: {{ bin_dir }}
path: /opt/cni/bin
- name: host-ns
hostPath:
path: /var/run/netns
Expand Down
8 changes: 0 additions & 8 deletions roles/kube-router/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
- name: 下载cni plugins
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items:
- bridge
- host-local
- loopback
- portmap

- name: 准备配置 kube-router DaemonSet (without IPVS)
template: src=kuberouter.yaml.j2 dest={{ cluster_dir }}/yml/kube-router.yaml
run_once: true
Expand Down
1 change: 0 additions & 1 deletion roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- "{{ bin_dir }}"
- "{{ ca_dir }}"
- /root/.kube
- /etc/cni/net.d

# 某些系统没有/usr/bin/python,需要配置一个软链接,否则connection: local的任务会失败
# 如果仍旧出现任务失败,重新执行一遍即可 https://github.com/ansible/ansible/issues/64903
Expand Down

0 comments on commit e2bd948

Please sign in to comment.