Skip to content

Commit

Permalink
add hostname-override for external aws cloud provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kinarashah committed Oct 16, 2023
1 parent 8533806 commit a82a711
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ fi
# In case of AWS cloud provider being configured, RKE will not set `hostname-override` flag because it needs to match the node/instance name in AWS.
# This will query EC2 metadata and use the value for setting `hostname-override` to match the node/instance name.
# RKE pull request: https://github.com/rancher/rke/pull/2803
if [ "$1" = "kube-proxy" ]; then
if [ "$1" = "kube-proxy" ] | [ "$1" = "kubelet" ]; then
if echo ${@} | grep -v "hostname-override"; then
hostname=$(curl "http://169.254.169.254/latest/meta-data/hostname")
if [ -z "$hostname" ]; then
hostname=$(hostname -f)
fi
set ${@} --hostname-override=$hostname
fi
fi
Expand Down

0 comments on commit a82a711

Please sign in to comment.