Skip to content

Commit

Permalink
Calculate max pods
Browse files Browse the repository at this point in the history
  • Loading branch information
nerahou committed May 17, 2024
1 parent 0378e9e commit c751c2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cluster_connect.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Calculate max pods
if [[ "${use_max_pods}" = "false" ]]; then
KUBELET_CONFIG=/etc/kubernetes/kubelet/kubelet-config.json
set +o pipefail
export CNI_VERSION=$(echo "${cni_version}" | sed 's/^v//')
export CNI_CUSTOM_NETWORKING_ENABLED=true
MAX_PODS=$(/etc/eks/max-pods-calculator.sh --instance-type-from-imds --cni-version $CNI_VERSION --cni-custom-networking-enabled)
set -o pipefail
if [[ -n "$MAX_PODS" ]]; then
echo "$(jq ".maxPods=$MAX_PODS" $KUBELET_CONFIG)" > $KUBELET_CONFIG
else
echo "Not able to determine maxPods for instance. Not setting max pods for kubelet"
fi
fi

/etc/eks/bootstrap.sh ${cluster_name} \
--use-max-pods ${use_max_pods} \
--kubelet-extra-args '--node-labels=${node_labels} --register-with-taints=${node_taints} ${kubelet_extra_args}' \
Expand Down
1 change: 1 addition & 0 deletions node_group_advanced.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ resource "aws_launch_template" "quortex_launch_tpl" {
: "${k}=${v}"]
)
use_max_pods = var.node_use_max_pods
cni_version = try(var.cluster_addons["vpc-cni"].version, "")
}
)
}
Expand Down

0 comments on commit c751c2b

Please sign in to comment.