Skip to content

Commit 1a53e4d

Browse files
committed
fix: use calico v3.27.5
1 parent 3ace122 commit 1a53e4d

File tree

2 files changed

+50
-14
lines changed

2 files changed

+50
-14
lines changed

onecloud/roles/primary-master-node/setup_k3s/templates/calico.yaml.j2

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# FROM: https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/calico.yaml
1+
# FROM: https://raw.githubusercontent.com/projectcalico/calico/v3.27.5/manifests/calico.yaml
22
---
33
# Source: calico/templates/calico-kube-controllers.yaml
44
# This manifest creates a Pod Disruption Budget for Controller to allow K8s Cluster Autoscaler to evict
@@ -1118,6 +1118,13 @@ spec:
11181118
Loose]'
11191119
pattern: ^(?i)(Disabled|Strict|Loose)?$
11201120
type: string
1121+
bpfExcludeCIDRsFromNAT:
1122+
description: BPFExcludeCIDRsFromNAT is a list of CIDRs that are to
1123+
be excluded from NAT resolution so that host can handle them. A
1124+
typical usecase is node local DNS cache.
1125+
items:
1126+
type: string
1127+
type: array
11211128
bpfExtToServiceConnmark:
11221129
description: 'BPFExtToServiceConnmark in BPF mode, control a 32bit
11231130
mark that is set on connections from an external client to a local
@@ -4831,7 +4838,7 @@ spec:
48314838
# It can be deleted if this is a fresh installation, or if you have already
48324839
# upgraded to use calico-ipam.
48334840
- name: upgrade-ipam
4834-
image: {{ image_repository }}/calico-cni:v3.27.0
4841+
image: {{ image_repository }}/calico-cni:v3.27.5
48354842
imagePullPolicy: IfNotPresent
48364843
command: ["/opt/cni/bin/calico-ipam", "-upgrade"]
48374844
envFrom:
@@ -4859,7 +4866,7 @@ spec:
48594866
# This container installs the CNI binaries
48604867
# and CNI network config file on each node.
48614868
- name: install-cni
4862-
image: {{ image_repository }}/calico-cni:v3.27.0
4869+
image: {{ image_repository }}/calico-cni:v3.27.5
48634870
imagePullPolicy: IfNotPresent
48644871
command: ["/opt/cni/bin/install"]
48654872
envFrom:
@@ -4902,7 +4909,7 @@ spec:
49024909
# i.e. bpf at /sys/fs/bpf and cgroup2 at /run/calico/cgroup. Calico-node initialisation is executed
49034910
# in best effort fashion, i.e. no failure for errors, to not disrupt pod creation in iptable mode.
49044911
- name: "mount-bpffs"
4905-
image: {{ image_repository }}/calico-node:v3.27.0
4912+
image: {{ image_repository }}/calico-node:v3.27.5
49064913
imagePullPolicy: IfNotPresent
49074914
command: ["calico-node", "-init", "-best-effort"]
49084915
volumeMounts:
@@ -4928,7 +4935,7 @@ spec:
49284935
# container programs network policy and routes on each
49294936
# host.
49304937
- name: calico-node
4931-
image: {{ image_repository }}/calico-node:v3.27.0
4938+
image: {{ image_repository }}/calico-node:v3.27.5
49324939
imagePullPolicy: IfNotPresent
49334940
envFrom:
49344941
- configMapRef:
@@ -5231,9 +5238,11 @@ spec:
52315238
- name: var-run-calico
52325239
hostPath:
52335240
path: /var/run/calico
5241+
type: DirectoryOrCreate
52345242
- name: var-lib-calico
52355243
hostPath:
52365244
path: /var/lib/calico
5245+
type: DirectoryOrCreate
52375246
- name: xtables-lock
52385247
hostPath:
52395248
path: /run/xtables.lock
@@ -5254,6 +5263,7 @@ spec:
52545263
- name: cni-bin-dir
52555264
hostPath:
52565265
path: /opt/cni/bin
5266+
type: DirectoryOrCreate
52575267
- name: cni-net-dir
52585268
hostPath:
52595269
path: /etc/cni/net.d
@@ -5320,7 +5330,7 @@ spec:
53205330
priorityClassName: system-cluster-critical
53215331
containers:
53225332
- name: calico-kube-controllers
5323-
image: {{ image_repository }}/calico-kube-controllers:v3.27.0
5333+
image: {{ image_repository }}/calico-kube-controllers:v3.27.5
53245334
imagePullPolicy: IfNotPresent
53255335
env:
53265336
# Choose which controllers to run.

scripts/sync-image.sh

100644100755
Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,42 @@
11
#!/bin/bash
22

3-
TARGET_REGISTRY=registry.cn-beijing.aliyuncs.com/yunion
3+
# Version configuration (can be overridden by environment variables)
4+
TARGET_REGISTRY=${TARGET_REGISTRY:-"registry.cn-beijing.aliyuncs.com/yunion"}
5+
CALICO_VERSION=${CALICO_VERSION:-"v3.27.5"}
46

57
# skopeo login --username $USERNAME $TARGET_REGISTRY
68

79
SKOPEO_COPY_CMD='skopeo copy --override-os linux --multi-arch all'
810

9-
# calico
10-
$SKOPEO_COPY_CMD docker://docker.io/calico/cni:v3.27.0 docker://$TARGET_REGISTRY/calico-cni:v3.27.0
11-
$SKOPEO_COPY_CMD docker://docker.io/calico/node:v3.27.0 docker://$TARGET_REGISTRY/calico-node:v3.27.0
12-
$SKOPEO_COPY_CMD docker://docker.io/calico/kube-controllers:v3.27.0 docker://$TARGET_REGISTRY/calico-kube-controllers:v3.27.0
11+
# Function: Copy image from source to target registry
12+
copy_image() {
13+
local source_image=$1
14+
local target_name=$2
15+
local target_image="${TARGET_REGISTRY}/${target_name}"
16+
17+
echo "Copying ${source_image} to ${target_image}..."
18+
$SKOPEO_COPY_CMD docker://${source_image} docker://${target_image}
19+
}
1320

14-
### k3s ###
15-
$SKOPEO_COPY_CMD docker://docker.io/rancher/mirrored-library-traefik:2.10.5 docker://$TARGET_REGISTRY/traefik:2.10.5
16-
$SKOPEO_COPY_CMD docker://docker.io/rancher/mirrored-coredns-coredns:1.10.1 docker://$TARGET_REGISTRY/coredns:1.10.1
21+
# Function: Add calico images to the copy list
22+
add_calico_images() {
23+
local version=$1
24+
IMAGES["calico-cni:${version}"]="docker.io/calico/cni:${version}"
25+
IMAGES["calico-node:${version}"]="docker.io/calico/node:${version}"
26+
IMAGES["calico-kube-controllers:${version}"]="docker.io/calico/kube-controllers:${version}"
27+
}
28+
29+
# Define images to be copied
30+
declare -A IMAGES=()
31+
32+
# Add calico images
33+
add_calico_images "${CALICO_VERSION}"
34+
35+
# Add other images
36+
IMAGES["traefik:2.10.5"]="docker.io/rancher/mirrored-library-traefik:2.10.5"
37+
IMAGES["coredns:1.10.1"]="docker.io/rancher/mirrored-coredns-coredns:1.10.1"
38+
39+
# Copy all images
40+
for target_name in "${!IMAGES[@]}"; do
41+
copy_image "${IMAGES[$target_name]}" "${target_name}"
42+
done

0 commit comments

Comments
 (0)