Skip to content

Commit a69bc00

Browse files
authored
fix: Remove unused bridge network (#183)
1 parent 6ac47f5 commit a69bc00

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

parts/k8s/cloud-init/artifacts/cse_config.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,21 @@ ensureContainerd() {
334334
systemctlEnableAndStart containerd || exit {{GetCSEErrorCode "ERR_SYSTEMCTL_START_FAIL"}}
335335
enableCRISystemdMonitor
336336
}
337+
338+
ensureNoBridgeDocker0 () {
339+
# Define the name of the bridge you want to check and potentially delete
340+
BRIDGE_NAME="docker0"
341+
# Check if the bridge exists
342+
if ip link show "$BRIDGE_NAME" &> /dev/null; then
343+
# The bridge exists, so delete it
344+
echo "Deleting bridge network $BRIDGE_NAME"
345+
retrycmd 120 5 25 ip link delete "$BRIDGE_NAME" type bridge || exit {{GetCSEErrorCode "ERR_REMOVE_DOCKER_BRIDGE_FAIL"}}
346+
else
347+
# The bridge does not exist
348+
echo "Bridge network $BRIDGE_NAME does not exist"
349+
fi
350+
}
351+
337352
{{end}}
338353
{{- if IsDockerContainerRuntime}}
339354
ensureDocker() {

parts/k8s/cloud-init/artifacts/cse_main.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ else
314314
fi
315315
fi
316316

317+
{{- if NeedsContainerd}}
318+
ensureNoBridgeDocker0
319+
{{end}}
320+
317321
echo "CSE finished successfully"
318322
echo $(date),$(hostname), endcustomscript >>/opt/m
319323
mkdir -p /opt/azure/containers && touch /opt/azure/containers/provision.complete

pkg/engine/cse.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ var cseErrorCodes = map[string]int{
8080
"ERR_DEB_DOWNLOAD_TIMEOUT": 184,
8181
"ERR_DEB_PKG_ADD_FAIL": 185,
8282
"ERR_VHD_FILE_NOT_FOUND": 186,
83+
"ERR_REMOVE_DOCKER_BRIDGE_FAIL": 187,
8384
}
8485

8586
func GetCSEErrorCode(errorType string) int {

pkg/engine/templates_generated.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)