Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #196 from orange-cloudfoundry/feature-backport-wra…
Browse files Browse the repository at this point in the history
…pper-fixes

Feature backport wrapper fixes
  • Loading branch information
gberche-orange authored Jan 30, 2024
2 parents de25d86 + f5a2591 commit 862be03
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .final_builds/jobs/k3s-agent/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ builds:
version: 8983b337bc586123de5a47ac712a7aa23b8dc4d89a687889d3932b680d1b0381
blobstore_id: 1151d4a3-75cf-4a88-7741-88f453fa9dc6
sha1: sha256:5f2de8465476707159dbd115ada9bf7f81ceeaf9cfe29601d7d3d85f17a6e565
89b33fef3abb20e5c7494fb84e295092e545086c05b4ac66f765daa1e6afd944:
version: 89b33fef3abb20e5c7494fb84e295092e545086c05b4ac66f765daa1e6afd944
blobstore_id: 88a7565f-a024-4d1c-657b-e919c23e7312
sha1: sha256:83f44c9f2ceef6a7c522c6235a8af9d393c7d224f94c0488d0d05a663db3b05f
9973ad9cba58269ee6e1d1b92d8c5005f4d9e7ceea37123b285eefd057b59476:
version: 9973ad9cba58269ee6e1d1b92d8c5005f4d9e7ceea37123b285eefd057b59476
blobstore_id: 38c6cd21-68fc-471d-671c-ec38c4559fdb
Expand Down
4 changes: 4 additions & 0 deletions .final_builds/jobs/k3s-server/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ builds:
version: 68ef93b0ca643f4eff4170f83a91cd8624ba14daed9b2b89dcf1443b255a80f2
blobstore_id: f3b074d1-5408-438b-4051-ca2121378ec6
sha1: sha256:8685832196cc4f5bbef715a5f8d930b311644a873db55e4a5a8405a3da049595
6bb4438fc82ee9b8380ae30e7d6877af0f7dcfef97e643a844b0e68191e986cf:
version: 6bb4438fc82ee9b8380ae30e7d6877af0f7dcfef97e643a844b0e68191e986cf
blobstore_id: ae567094-915b-4bc2-6199-6aab093f12b8
sha1: sha256:d48ba14c7f60ab6beeea146bafb0452d256c4f0c57531a454ebe8068254560b7
79b692c882652e365bbfa888161dddeec62452fe9ec3cea6b53071e25ef0fd9a:
version: 79b692c882652e365bbfa888161dddeec62452fe9ec3cea6b53071e25ef0fd9a
blobstore_id: a0ed5add-7ca3-4a98-6ead-a1f8ab9b2e4b
Expand Down
2 changes: 1 addition & 1 deletion jobs/k3s-agent/spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ templates:
config/registries.yaml.erb: config/registries.yaml
config/registry.ca.erb: config/registry.ca
config/registry.cert.erb: config/registry.cert
config/registry.key.erb: config/registry.key
config/registry.key.erb: config/registry.key
config/token.csv.erb: config/token.csv

config/kubelet-config.yaml.erb: config/kubelet-config.yaml
Expand Down
51 changes: 36 additions & 15 deletions jobs/k3s-agent/templates/bin/k3s-killall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@ killtree() {
) 2>/dev/null
}

remove_interfaces() {
# Delete network interface(s) that match 'master cni0' and ' lxc'
ip link show 2>/dev/null | grep -E "master cni0| lxc" | while read ignore iface ignore; do
iface=${iface%%@*}
[ -z "$iface" ] || ip link delete $iface
done

# Delete cni related interfaces
ip link delete cilium_host #--- cilium
ip link delete cilium_net #--- cilium
ip link delete cilium_vxlan #--- cilium
ip link delete cni0
ip link delete flannel.1
ip link delete flannel-v6.1
ip link delete kube-ipvs0
ip link delete flannel-wg
ip link delete flannel-wg-v6

# Restart tailscale
if [ -n "$(command -v tailscale)" ]; then
tailscale set --advertise-routes=
fi
}

getshims() {
ps -e -o pid= -o args= | sed -e 's/^ *//; s/\s\s*/\t/;' | grep -w 'k3s/data/[^/]*/bin/containerd-shim' | cut -f1
}
Expand All @@ -49,28 +73,25 @@ do_unmount_and_remove() {
set +x
while read -r _ path _; do
case "$path" in $1*) echo "$path" ;; esac
done < /proc/self/mounts | sort -r | xargs -r -t -n 1 sh -c 'umount "$0" && rm -rf "$0"'
done < /proc/self/mounts | sort -r | xargs -r -t -n 1 sh -c 'umount -f "$0" && rm -rf "$0"'
set -x
}

do_unmount_and_remove '/run/k3s'
do_unmount_and_remove '/var/lib/rancher/k3s'
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/pods' #bosh fs layout adaptation
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/plugins'
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/plugins/kubernetes.io/csi' #bosh fs adaptation for csi mount (eg: longhorn)
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/pods' #--- bosh fs layout adaptation
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/plugins' #--- bosh fs layout adaptation
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/plugins/kubernetes.io/csi' #--- bosh fs adaptation for csi mount (eg: longhorn)
do_unmount_and_remove '/run/netns/cni-'

# Remove CNI namespaces
ip netns show 2>/dev/null | grep cni- | xargs -r -t -n 1 ip netns delete

# Delete network interface(s) that match 'master cni0'
ip link show 2>/dev/null | grep 'master cni0' | while read ignore iface ignore; do
iface=${iface%%@*}
[ -z "$iface" ] || ip link delete $iface
done
#ip link delete cni0
#ip link delete flannel.1
#ip link delete flannel-v6.1
#rm -rf /var/lib/cni/
#iptables-save | grep -v KUBE- | grep -v CNI- | iptables-restore
#ip6tables-save | grep -v KUBE- | grep -v CNI- | ip6tables-restore
# Remove CNI network interfaces
remove_interfaces

rm -rf /var/lib/cni/

# Clean k3s iptables rules
iptables-save | grep -v KUBE- | grep -v CNI- | grep -iv flannel | grep -iv cilium | iptables-restore
ip6tables-save | grep -v KUBE- | grep -v CNI- | grep -iv flannel | grep -iv cilium | ip6tables-restore
1 change: 1 addition & 0 deletions jobs/k3s-server/spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ templates:
bin/pre-start.erb: bin/pre-start
bin/post-start.erb: bin/post-start
bin/pre-stop.erb: bin/pre-stop
bin/post-stop.erb: bin/post-stop
bin/post-deploy.erb: bin/post-deploy
bin/drain.erb: bin/drain
bin/ctl.erb: bin/ctl
Expand Down
51 changes: 36 additions & 15 deletions jobs/k3s-server/templates/bin/k3s-killall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@ killtree() {
) 2>/dev/null
}

remove_interfaces() {
# Delete network interface(s) that match 'master cni0' and ' lxc'
ip link show 2>/dev/null | grep -E "master cni0| lxc" | while read ignore iface ignore; do
iface=${iface%%@*}
[ -z "$iface" ] || ip link delete $iface
done

# Delete cni related interfaces
ip link delete cilium_host #--- cilium
ip link delete cilium_net #--- cilium
ip link delete cilium_vxlan #--- cilium
ip link delete cni0
ip link delete flannel.1
ip link delete flannel-v6.1
ip link delete kube-ipvs0
ip link delete flannel-wg
ip link delete flannel-wg-v6

# Restart tailscale
if [ -n "$(command -v tailscale)" ]; then
tailscale set --advertise-routes=
fi
}

getshims() {
ps -e -o pid= -o args= | sed -e 's/^ *//; s/\s\s*/\t/;' | grep -w 'k3s/data/[^/]*/bin/containerd-shim' | cut -f1
}
Expand All @@ -49,28 +73,25 @@ do_unmount_and_remove() {
set +x
while read -r _ path _; do
case "$path" in $1*) echo "$path" ;; esac
done < /proc/self/mounts | sort -r | xargs -r -t -n 1 sh -c 'umount "$0" && rm -rf "$0"'
done < /proc/self/mounts | sort -r | xargs -r -t -n 1 sh -c 'umount -f "$0" && rm -rf "$0"'
set -x
}

do_unmount_and_remove '/run/k3s'
do_unmount_and_remove '/var/lib/rancher/k3s'
do_unmount_and_remove '/var/vcap/data/k3s-server/kubelet/pods' #bosh fs layout adaptation
do_unmount_and_remove '/var/vcap/data/k3s-server/kubelet/plugins'
do_unmount_and_remove '/var/vcap/data/k3s-server/kubelet/plugins/kubernetes.io/csi' #bosh fs adaptation for csi mount (eg: longhorn)
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/pods' #--- bosh fs layout adaptation
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/plugins' #--- bosh fs layout adaptation
do_unmount_and_remove '/var/vcap/data/k3s-agent/kubelet/plugins/kubernetes.io/csi' #--- bosh fs adaptation for csi mount (eg: longhorn)
do_unmount_and_remove '/run/netns/cni-'

# Remove CNI namespaces
ip netns show 2>/dev/null | grep cni- | xargs -r -t -n 1 ip netns delete

# Delete network interface(s) that match 'master cni0'
ip link show 2>/dev/null | grep 'master cni0' | while read ignore iface ignore; do
iface=${iface%%@*}
[ -z "$iface" ] || ip link delete $iface
done
#ip link delete cni0
#ip link delete flannel.1
#ip link delete flannel-v6.1
#rm -rf /var/lib/cni/
#iptables-save | grep -v KUBE- | grep -v CNI- | iptables-restore
#ip6tables-save | grep -v KUBE- | grep -v CNI- | ip6tables-restore
# Remove CNI network interfaces
remove_interfaces

rm -rf /var/lib/cni/

# Clean k3s iptables rules
iptables-save | grep -v KUBE- | grep -v CNI- | grep -iv flannel | grep -iv cilium | iptables-restore
ip6tables-save | grep -v KUBE- | grep -v CNI- | grep -iv flannel | grep -iv cilium | ip6tables-restore
2 changes: 1 addition & 1 deletion jobs/k3s-server/templates/bin/post-stop.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo "post-stop: SKIP k3s-killall.sh"
exit 0
<% else %>
echo "post-stop: k3s-killall.sh to clean the host"
/var/vcap/jobs/k3s-agent/bin/k3s-killall.sh
/var/vcap/jobs/k3s-server/bin/k3s-killall.sh
exit 0
<% end %>
<% end %>
2 changes: 2 additions & 0 deletions releases/k3s/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ builds:
version: "123"
d465033d-b0d3-4d55-5ad0-a57940fec5c9:
version: "14"
f2228634-586b-4925-77a7-60e4e3fff0de:
version: "124.15"
fa2e4492-8da7-42b7-7ed5-5f0c0fe0a50c:
version: "123.5"
format-version: "2"
65 changes: 65 additions & 0 deletions releases/k3s/k3s-124.15.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: k3s
version: "124.15"
commit_hash: 2730f6a
uncommitted_changes: false
jobs:
- name: k3s-agent
version: 89b33fef3abb20e5c7494fb84e295092e545086c05b4ac66f765daa1e6afd944
fingerprint: 89b33fef3abb20e5c7494fb84e295092e545086c05b4ac66f765daa1e6afd944
sha1: sha256:83f44c9f2ceef6a7c522c6235a8af9d393c7d224f94c0488d0d05a663db3b05f
packages:
- k3s
- kubectl-k3s
- k3s-images
- nerdctl
- name: k3s-agent-airgaped-images
version: dac8160deeef67d642c67065cdb584c53ca84807717f4b7abb3e748badb97313
fingerprint: dac8160deeef67d642c67065cdb584c53ca84807717f4b7abb3e748badb97313
sha1: sha256:56989c04162b348ce691ad78d9ceaefc4b46338df95ebe87fda1e5ce0a30d429
packages:
- k3s-images
- name: k3s-server
version: 6bb4438fc82ee9b8380ae30e7d6877af0f7dcfef97e643a844b0e68191e986cf
fingerprint: 6bb4438fc82ee9b8380ae30e7d6877af0f7dcfef97e643a844b0e68191e986cf
sha1: sha256:d48ba14c7f60ab6beeea146bafb0452d256c4f0c57531a454ebe8068254560b7
packages:
- k3s
- k9s
- kubectl-k3s
- nerdctl
- name: k3s-server-airgaped-images
version: 3e8cc00744f582f54235a554c9a5a1bcbc16c8848330d8b17fbe1ab270f7d2ef
fingerprint: 3e8cc00744f582f54235a554c9a5a1bcbc16c8848330d8b17fbe1ab270f7d2ef
sha1: sha256:fbae88a6d6e06d8ac29288b73a971832e77d2483978c56481844e1c7f8e77c78
packages:
- k3s-images
packages:
- name: k3s
version: 68ae280a60d525fde827d29f607ded3cba04b62ab7d8a0f823a982214a601ef3
fingerprint: 68ae280a60d525fde827d29f607ded3cba04b62ab7d8a0f823a982214a601ef3
sha1: sha256:579cfa090faeed6a6063c592b149538d6d9732dbeb33d0cf222035d96a46ba1f
dependencies: []
- name: k3s-images
version: ee54d82c584dc843cc3d741749812b26b8b654cdfeb14a50a4bc841cd38c890b
fingerprint: ee54d82c584dc843cc3d741749812b26b8b654cdfeb14a50a4bc841cd38c890b
sha1: sha256:63e77a6226b02ec64d6dc44b3fc5796a76e40d4056d72d4710c759c00e098b3d
dependencies: []
- name: k9s
version: 5950fdb3fe5cf31d54de992dd8dfdb17bc43eca03901b375c7e54ed89203966b
fingerprint: 5950fdb3fe5cf31d54de992dd8dfdb17bc43eca03901b375c7e54ed89203966b
sha1: sha256:d0ad55e5c5f85d986c15346247d9dec6f5b2712a5a81ebb8af80c9b5676c23a4
dependencies: []
- name: kubectl-k3s
version: 7ad3a6f1733dd6068d1f380ffff2daeaec2d7bbefdc297873854c55eec287f86
fingerprint: 7ad3a6f1733dd6068d1f380ffff2daeaec2d7bbefdc297873854c55eec287f86
sha1: sha256:0325c1d22e341d13c91abf7df05c31c3df8effa6da3c3d0bca3920e26edca721
dependencies: []
- name: nerdctl
version: 3ef7aaf0a97b5ea75f13913f2c73609b90e9fb46695d743c2acedd5d0d9e4eb4
fingerprint: 3ef7aaf0a97b5ea75f13913f2c73609b90e9fb46695d743c2acedd5d0d9e4eb4
sha1: sha256:beb08f27a3f548472c8c0edee96e813fba538d7e4b2229325e5262cc30aa7d30
dependencies: []
license:
version: cf0ca1fe65dee9607c7bb9460a3f20835e582cbb7f5b2c3625fba2e21d7e91b9
fingerprint: cf0ca1fe65dee9607c7bb9460a3f20835e582cbb7f5b2c3625fba2e21d7e91b9
sha1: sha256:cbe3175489dfaec91e9f392399fbfb68e008885feb91a3b8d493a35d2fc5a8fa

0 comments on commit 862be03

Please sign in to comment.