|
1 | | ---- bootstrap.sh 2024-04-08 15:32:39 |
2 | | -+++ patched_bootstrap.sh 2024-04-08 15:36:38 |
| 1 | +--- bootstrap.sh 2025-02-11 13:09:53 |
| 2 | ++++ patched_bootstrap.sh 2025-02-11 13:23:06 |
3 | 3 | @@ -150,7 +150,7 @@ |
4 | 4 | API_RETRY_ATTEMPTS="${API_RETRY_ATTEMPTS:-3}" |
5 | 5 | DOCKER_CONFIG_JSON="${DOCKER_CONFIG_JSON:-}" |
|
9 | 9 | CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-$DEFAULT_CONTAINER_RUNTIME}" |
10 | 10 | # from >= 1.27, the cloud-provider will be external |
11 | 11 | CLOUD_PROVIDER="external" |
12 | | -@@ -426,17 +426,28 @@ |
| 12 | +@@ -295,11 +295,15 @@ |
| 13 | + --region=${AWS_DEFAULT_REGION} \ |
| 14 | + --name=${CLUSTER_NAME} |
| 15 | + |
| 16 | ++ # Switch to JSON output to avoid "NoneType" flush bug in text mode. |
| 17 | ++ # Then parse the required fields with jq, output them on a single line. |
| 18 | + aws eks describe-cluster \ |
| 19 | + --region=${AWS_DEFAULT_REGION} \ |
| 20 | + --name=${CLUSTER_NAME} \ |
| 21 | +- --output=text \ |
| 22 | +- --query 'cluster.{certificateAuthorityData: certificateAuthority.data, endpoint: endpoint, serviceIpv4Cidr: kubernetesNetworkConfig.serviceIpv4Cidr, serviceIpv6Cidr: kubernetesNetworkConfig.serviceIpv6Cidr, clusterIpFamily: kubernetesNetworkConfig.ipFamily}' > $DESCRIBE_CLUSTER_RESULT || rc=$? |
| 23 | ++ --output=json \ |
| 24 | ++ | jq -r '.cluster | "\( .certificateAuthority.data ) \( .endpoint ) \( .kubernetesNetworkConfig.serviceIpv4Cidr ) \( .kubernetesNetworkConfig.serviceIpv6Cidr ) \( .kubernetesNetworkConfig.ipFamily )"' \ |
| 25 | ++ > $DESCRIBE_CLUSTER_RESULT || rc=$? |
| 26 | ++ |
| 27 | + if [[ $rc -eq 0 ]]; then |
| 28 | + break |
| 29 | + fi |
| 30 | +@@ -310,13 +314,14 @@ |
| 31 | + sleep_sec="$(( $(( 5 << $((1+$attempt)) )) + $jitter))" |
| 32 | + sleep $sleep_sec |
| 33 | + done |
| 34 | +- B64_CLUSTER_CA=$(cat $DESCRIBE_CLUSTER_RESULT | awk '{print $1}') |
| 35 | +- APISERVER_ENDPOINT=$(cat $DESCRIBE_CLUSTER_RESULT | awk '{print $3}') |
| 36 | +- SERVICE_IPV4_CIDR=$(cat $DESCRIBE_CLUSTER_RESULT | awk '{print $4}') |
| 37 | +- SERVICE_IPV6_CIDR=$(cat $DESCRIBE_CLUSTER_RESULT | awk '{print $5}') |
| 38 | + |
| 39 | ++ # Our jq line puts five fields on one line. Re-map them accordingly. |
| 40 | ++ B64_CLUSTER_CA="$(awk '{print $1}' $DESCRIBE_CLUSTER_RESULT)" |
| 41 | ++ APISERVER_ENDPOINT="$(awk '{print $2}' $DESCRIBE_CLUSTER_RESULT)" |
| 42 | ++ SERVICE_IPV4_CIDR="$(awk '{print $3}' $DESCRIBE_CLUSTER_RESULT)" |
| 43 | ++ SERVICE_IPV6_CIDR="$(awk '{print $4}' $DESCRIBE_CLUSTER_RESULT)" |
| 44 | + if [[ -z "${IP_FAMILY}" ]]; then |
| 45 | +- IP_FAMILY=$(cat $DESCRIBE_CLUSTER_RESULT | awk '{print $2}') |
| 46 | ++ IP_FAMILY="$(awk '{print $5}' $DESCRIBE_CLUSTER_RESULT)" |
| 47 | + fi |
| 48 | + fi |
| 49 | + |
| 50 | +@@ -434,17 +439,28 @@ |
13 | 51 | systemctl restart docker |
14 | 52 | snap set kubelet-eks \ |
15 | 53 | container-runtime=docker |
|
25 | 63 | + --file /etc/crio/crio.conf \ |
26 | 64 | + --selector 'crio.image.pause_image' \ |
27 | 65 | + "${PAUSE_CONTAINER}" |
28 | | - |
| 66 | + |
29 | 67 | elif [[ "$CONTAINER_RUNTIME" = "nvidia-container-runtime" ]]; then |
30 | 68 | - echo "Container runtime is ${CONTAINER_RUNTIME}" |
31 | 69 | - # update config.toml file |
|
37 | 75 | + # see https://github.com/NVIDIA/k8s-device-plugin |
38 | 76 | + cp /usr/local/share/eks/nvidia-runtime-config.toml /etc/containerd/config.toml |
39 | 77 | + systemctl restart containerd |
40 | | - |
| 78 | + |
41 | 79 | else |
42 | 80 | - echo "Container runtime ${CONTAINER_RUNTIME} is not supported." |
43 | 81 | - exit 1 |
|
0 commit comments