Skip to content

Commit f4d486c

Browse files
committed
Fix duplicate --max-pods arguments in KUBELET_EXTRA_ARGS
Fixes #7946 by removing existing --max-pods arguments before appending the new value in makeMaxPodsScript. This prevents duplicate --max-pods flags when the AMI bootstrap script already includes one. The fix: - Removes any existing --max-pods=<number> arguments - Cleans up extra spaces - Appends the new --max-pods value Only affects AL2 managed nodegroups. AL2023 uses nodeadm configuration and is not impacted by this change.
1 parent 5f55c80 commit f4d486c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/nodebootstrap/managed_al2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func makeMaxPodsScript(maxPods int) string {
9191
script := `#!/bin/sh
9292
set -ex
9393
`
94-
script += fmt.Sprintf(`sed -i 's/KUBELET_EXTRA_ARGS=$2/KUBELET_EXTRA_ARGS="$2 --max-pods=%d"/' /etc/eks/bootstrap.sh`, maxPods)
94+
script += fmt.Sprintf(`sed -i 's/KUBELET_EXTRA_ARGS=$2/KUBELET_EXTRA_ARGS="$(echo "$2" | sed "s/--max-pods=[0-9]*//" | sed "s/ */ /g" | sed "s/^ *//" | sed "s/ *$//") --max-pods=%d"/' /etc/eks/bootstrap.sh`, maxPods)
9595
return script
9696
}
9797

0 commit comments

Comments
 (0)