Skip to content

Commit

Permalink
fixed cni and containerd binaries path (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpiyush17 authored Sep 30, 2024
1 parent 05e4d76 commit 02cf3bb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions scripts/import.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/bash -x

CONTENT_PATH=$1
ROOT_PATH=$2

# find all tar files recursively
for tarfile in $(find $CONTENT_PATH -name "*.tar" -type f)
do
# try to import the tar file into containerd up to ten times
for i in {1..10}
do
if [ "$ROOT_PATH" = "/" ]; then
/opt/bin/ctr -n k8s.io image import "$tarfile" --all-platforms
if [ -S /run/spectro/containerd/containerd.sock ]; then
/opt/bin/ctr -n k8s.io --address /run/spectro/containerd/containerd.sock image import "$tarfile" --all-platforms
else
"$ROOT_PATH"/opt/spectro/bin/ctr -n k8s.io --address /run/spectro/containerd/containerd.sock image import "$tarfile" --all-platforms
/opt/bin/ctr -n k8s.io image import "$tarfile" --all-platforms
fi
if [ $? -eq 0 ]; then
echo "Import successful: $tarfile (attempt $i)"
Expand Down
2 changes: 1 addition & 1 deletion scripts/kube-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ do_kubeadm_reset() {
fi

iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X && rm -rf /etc/kubernetes/etcd /etc/kubernetes/manifests /etc/kubernetes/pki
rm -rf "$root_path"/opt/spectro/cni/net.d
rm -rf "$root_path"/etc/cni/net.d
systemctl daemon-reload
if systemctl cat spectro-containerd >/dev/null 2<&1; then
systemctl restart spectro-containerd
Expand Down
2 changes: 1 addition & 1 deletion scripts/kube-join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ do_kubeadm_reset() {
kubeadm reset -f --cleanup-tmp-dir
fi
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X && rm -rf /etc/kubernetes/etcd /etc/kubernetes/manifests /etc/kubernetes/pki
rm -rf "$root_path"/opt/spectro/cni/net.d
rm -rf "$root_path"/etc/cni/net.d
systemctl daemon-reload
if systemctl cat spectro-containerd >/dev/null 2<&1; then
systemctl restart spectro-containerd
Expand Down
4 changes: 2 additions & 2 deletions scripts/kube-pre-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ systemctl daemon-reload
systemctl enable kubelet && systemctl start kubelet

if systemctl cat spectro-containerd >/dev/null 2<&1; then
systemctl enable spectro-containerd && systemctl start spectro-containerd
systemctl enable spectro-containerd && systemctl restart spectro-containerd
fi

if systemctl cat containerd >/dev/null 2<&1; then
systemctl enable containerd && systemctl start containerd
systemctl enable containerd && systemctl restart containerd
fi

if [ ! -f "$root_path"/opt/sentinel_kubeadmversion ]; then
Expand Down
2 changes: 1 addition & 1 deletion stages/pre.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func GetPreKubeadmImportCoreK8sImageStage(rootPath string) yip.Stage {
Name: "Run Load Kube Images",
Commands: []string{
fmt.Sprintf("chmod +x %s", filepath.Join(rootPath, helperScriptPath, "import.sh")),
fmt.Sprintf("/bin/sh %s %s %s > /var/log/import-kube-images.log", filepath.Join(rootPath, helperScriptPath, "import.sh"), filepath.Join(rootPath, "opt/kube-images"), rootPath),
fmt.Sprintf("/bin/sh %s %s > /var/log/import-kube-images.log", filepath.Join(rootPath, helperScriptPath, "import.sh"), filepath.Join(rootPath, "opt/kube-images")),
},
}
}

0 comments on commit 02cf3bb

Please sign in to comment.