-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update start script to wait for ipamd health
Wait for the ipamd health check to be SERVING before copying in the CNI binary and config file. #282
- Loading branch information
Showing
1 changed file
with
39 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,42 @@ | ||
#!/usr/bin/env bash | ||
echo "===== Starting installing AWS-CNI =========" | ||
sed -i s/__VETHPREFIX__/${AWS_VPC_K8S_CNI_VETHPREFIX:-"eni"}/g /app/10-aws.conflist | ||
cp /app/aws-cni /host/opt/cni/bin/ | ||
cp /app/portmap /host/opt/cni/bin/ | ||
cp /app/aws-cni-support.sh /host/opt/cni/bin/ | ||
cp /app/10-aws.conflist /host/etc/cni/net.d/ | ||
|
||
if [[ -f /host/etc/cni/net.d/aws.conf ]]; then | ||
|
||
grpcHealthCheck () { | ||
/app/grpc_health_probe -addr 127.0.0.1:50051 | ||
} | ||
|
||
waitIPamDServing () { | ||
until grpcHealthCheck; do | ||
echo "Waiting for ipamd health check"; | ||
sleep 1; | ||
done | ||
} | ||
|
||
main () { | ||
# Remove old config files that might have been baked into older AMIs | ||
if [[ -f /host/etc/cni/net.d/aws.conf ]]; then | ||
rm /host/etc/cni/net.d/aws.conf | ||
fi | ||
fi | ||
|
||
# Copy standard files | ||
cp /app/aws-cni-support.sh /host/opt/cni/bin/ | ||
cp /app/portmap /host/opt/cni/bin/ | ||
|
||
echo "===== Starting amazon-k8s-agent ===========" | ||
/app/aws-k8s-agent & | ||
|
||
# Check ipamd health | ||
echo "Checking if ipamd is serving" | ||
waitIPamDServing | ||
|
||
echo "===== Copying AWS CNI plugin and config =========" | ||
sed -i s/__VETHPREFIX__/"${AWS_VPC_K8S_CNI_VETHPREFIX:-"eni"}"/g /app/10-aws.conflist | ||
cp /app/aws-cni /host/opt/cni/bin/ | ||
cp /app/10-aws.conflist /host/etc/cni/net.d/ | ||
|
||
# Check that ipamd is healthy, exit if the check fails | ||
while grpcHealthCheck; do | ||
sleep 10; | ||
done | ||
} | ||
|
||
echo "===== Starting amazon-k8s-agent ===========" | ||
/app/aws-k8s-agent | ||
main |