mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-19 07:53:46 +01:00
feat: Fix custom AMI bootstrap (#1580)
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
%{ if length(ami_id) == 0 ~}
|
||||
|
||||
# Allow user supplied pre userdata code
|
||||
${pre_userdata}
|
||||
|
||||
# Set variables directly into bootstrap.sh for default AMI
|
||||
sed -i '/^KUBELET_EXTRA_ARGS=/a KUBELET_EXTRA_ARGS+=" ${kubelet_extra_args}"' /etc/eks/bootstrap.sh
|
||||
%{ if run_bootstrap_script }
|
||||
/etc/eks/bootstrap.sh ${cluster_name}
|
||||
%{ endif }
|
||||
%{else ~}
|
||||
|
||||
# Set variables for custom AMI
|
||||
API_SERVER_URL=${cluster_endpoint}
|
||||
B64_CLUSTER_CA=${cluster_ca}
|
||||
KUBELET_EXTRA_ARGS='--node-labels=eks.amazonaws.com/nodegroup-image=${ami_id},eks.amazonaws.com/capacityType=${capacity_type}${append_labels} ${kubelet_extra_args}'
|
||||
%{endif ~}
|
||||
|
||||
# User supplied pre userdata
|
||||
${pre_userdata}
|
||||
%{ if length(ami_id) > 0 && ami_is_eks_optimized ~}
|
||||
|
||||
# Call bootstrap for EKS optimised custom AMI
|
||||
/etc/eks/bootstrap.sh ${cluster_name} --apiserver-endpoint "$${API_SERVER_URL}" --b64-cluster-ca "$${B64_CLUSTER_CA}" --kubelet-extra-args "$${KUBELET_EXTRA_ARGS}"
|
||||
%{ endif ~}
|
||||
|
||||
Reference in New Issue
Block a user