Skip to content

Commit

Permalink
Calculate MaxPods when not present in eni-max-pods.txt (#888)
Browse files Browse the repository at this point in the history
* Calculate MaxPods when not present in eni-max-pods.txt

* Fixing path
  • Loading branch information
suket22 authored Mar 29, 2022
1 parent 60550f3 commit 917c621
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions files/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,11 @@ set +o pipefail
MAX_PODS=$(cat $MAX_PODS_FILE | awk "/^${INSTANCE_TYPE:-unset}/"' { print $2 }')
set -o pipefail
if [ -z "$MAX_PODS" ] || [ -z "$INSTANCE_TYPE" ]; then
echo "No entry for type '$INSTANCE_TYPE' in $MAX_PODS_FILE"
exit 1
echo "No entry for type '$INSTANCE_TYPE' in $MAX_PODS_FILE. Will attempt to auto-discover value."
# When determining the value of maxPods, we're using the legacy calculation by default since it's more restrictive than
# the PrefixDelegation based alternative and is likely to be in-use by more customers.
# The legacy numbers also maintain backwards compatibility when used to calculate `kubeReserved.memory`
MAX_PODS=$(/etc/eks/max-pods-calculator.sh --instance-type-from-imds --cni-version 1.10.0 --show-max-allowed)
fi

# calculates the amount of each resource to reserve
Expand Down Expand Up @@ -463,7 +466,7 @@ fi
if [[ "$CONTAINER_RUNTIME" = "containerd" ]]; then
sudo mkdir -p /etc/containerd
sudo mkdir -p /etc/cni/net.d
sudo sed -i s,SANDBOX_IMAGE,$PAUSE_CONTAINER,g /etc/eks/containerd/containerd-config.toml
sudo sed -i s,SANDBOX_IMAGE,$PAUSE_CONTAINER,g /etc/eks/containerd/containerd-config.toml
sudo mv /etc/eks/containerd/containerd-config.toml /etc/containerd/config.toml
sudo mv /etc/eks/containerd/sandbox-image.service /etc/systemd/system/sandbox-image.service
sudo mv /etc/eks/containerd/kubelet-containerd.service /etc/systemd/system/kubelet.service
Expand All @@ -475,7 +478,7 @@ if [[ "$CONTAINER_RUNTIME" = "containerd" ]]; then
systemctl restart containerd
systemctl enable sandbox-image
systemctl start sandbox-image

elif [[ "$CONTAINER_RUNTIME" = "dockerd" ]]; then
mkdir -p /etc/docker
bash -c "/sbin/iptables-save > /etc/sysconfig/iptables"
Expand Down

0 comments on commit 917c621

Please sign in to comment.