Skip to content

Commit d386fd2

Browse files
authored
fix: cleanup contents (#129)
1 parent 313f225 commit d386fd2

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

helm/bento-image-snapshotter/templates/daemonset-systemd.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,24 @@ spec:
5656
etcContainerd=${HOST_MOUNT_DIR}{{ .Values.containerRuntime.containerd.configFile }}
5757
containerd_namespace=k8s.io
5858
59-
# grep -q "# corrupted contents cleaned" $etcContainerd
60-
#
61-
# if [ $? -eq 0 ]; then
62-
# echo "The corrupted containerd images and contants have been cleaned."
63-
# else
64-
# namesapces=$(ctr namespace ls | tail +2 | awk '{print $1}')
65-
#
66-
# echo "Removing all corrupted images and contents in containerd..."
67-
# for namespace in $namesapces
68-
# do
69-
# echo "Removing corrupted images and contents in $namespace"
70-
# ctr -n $namespace image ls | tail +2 | awk '{print $1}' | xargs -I {} sudo ctr -n $namespace image rm {}
71-
# ctr -n $namespace content ls | tail +2 | awk '{print $1}' | xargs -I {} sudo ctr -n $namespace content rm {}
72-
# echo "Removed corrupted images and contents in $namespace"
73-
# done
74-
# echo "Removed all corrupted images and contents in containerd"
75-
# echo "# corrupted contents cleaned" >> $etcContainerd
76-
# fi
59+
grep -q "# corrupted contents cleaned" $etcContainerd
60+
61+
if [ $? -eq 0 ]; then
62+
echo "The corrupted containerd images and contants have been cleaned."
63+
else
64+
namesapces=$(ctr namespace ls | tail +2 | awk '{print $1}')
65+
66+
echo "Removing all corrupted images and contents in containerd..."
67+
for namespace in $namesapces
68+
do
69+
echo "Removing corrupted images and contents in $namespace"
70+
ctr -n $namespace image ls | tail +2 | awk '{print $1}' | xargs -I {} sudo ctr -n $namespace image rm {}
71+
ctr -n $namespace content ls | tail +2 | awk '{print $1}' | xargs -I {} sudo ctr -n $namespace content rm {}
72+
echo "Removed corrupted images and contents in $namespace"
73+
done
74+
echo "Removed all corrupted images and contents in containerd"
75+
echo "# corrupted contents cleaned" >> $etcContainerd
76+
fi
7777
7878
toml set --overwrite $etcContainerd plugins.\"io.containerd.grpc.v1.cri\".containerd.discard_unpacked_layers false
7979
toml set --overwrite $etcContainerd plugins.\"io.containerd.grpc.v1.cri\".containerd.disable_snapshot_annotations false

0 commit comments

Comments
 (0)