Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix install_cni_chaining not creating CNI conf correctly in some cases #6506

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion build/images/scripts/install_cni_chaining
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ done

# Find the cni conf file with lowest name, which is not installed by us
while true; do
cni_conf_name=$(ls "$HOST_CNI_NET_DIR" | grep -v antrea | head -n1)
# CNI conf file must have an extension of ".conflist", "*.conf", or "*.json".
cni_conf_name=$(ls "$HOST_CNI_NET_DIR" | grep -E "\.conflist$|\.conf$|\.json$" | grep -v antrea | head -n1)
if [[ ! -z $cni_conf_name ]]; then
break
fi
Expand All @@ -69,6 +70,15 @@ cni_conf_sha=""
function update_cni_conf {
log_info "install_cni_chaining" "updating CNI conf file $cni_conf_name -> $cni_conf_name_antrea"

# The CNI conf file may not have been completely written.
while true; do
if [ -s "$cni_conf_path" ] && jq empty "$cni_conf_path" 2>/dev/null; then
break
fi
log_info "install_cni_chaining" "CNI conf file is empty or invalid. Retrying after 2 secs"
sleep 2s
done

# We use the following steps:
# 1. read the input file once and store its contents in a variable
# 2. perform the necessary changes on the variable contents
Expand Down
Loading