-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3162 from damdo/BZ2084450-2
Bug 2084450: Add unit/file for AWS to compute instance provider-id and pass it to the kubelet
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
templates/common/aws/files/usr-local-bin-aws-kubelet-providerid.yaml
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
mode: 0755 | ||
path: "/usr/local/bin/aws-kubelet-providerid" | ||
contents: | ||
inline: | | ||
#!/bin/bash | ||
set -e -o pipefail | ||
NODECONF=/etc/systemd/system/kubelet.service.d/20-aws-providerid.conf | ||
if [ -e "${NODECONF}" ]; then | ||
echo "Not replacing existing ${NODECONF}" | ||
exit 0 | ||
fi | ||
# Due to a potential mismatch between Hostname and PrivateDNSName with clusters that use custom DHCP Option Sets | ||
# which can cause issues in cloud controller manager node syncing | ||
# (see: https://github.com/kubernetes/cloud-provider-aws/issues/384), | ||
# set KUBELET_PROVIDERID to be a fully qualified AWS instace provider id. | ||
# This new variable is later used to populate the kubelet's `provider-id` flag, later set on the Node .spec | ||
# and used by the cloud controller manager's node controller to retrieve the Node's backing instance. | ||
# This is obtained by using afterburn service variables, in turn obtained from metadata retrival. | ||
# See respective systemd unit metadata related afterburn doc: https://coreos.github.io/afterburn/usage/attributes/ | ||
cat > "${NODECONF}" <<EOF | ||
[Service] | ||
Environment="KUBELET_PROVIDERID=aws://${AFTERBURN_AWS_AVAILABILITY_ZONE}/${AFTERBURN_AWS_INSTANCE_ID}" | ||
EOF |
23 changes: 23 additions & 0 deletions
23
templates/common/aws/units/aws-kubelet-providerid.service.yaml
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: aws-kubelet-providerid.service | ||
enabled: true | ||
contents: | | ||
[Unit] | ||
Description=Fetch kubelet provider id from AWS Metadata | ||
# Run afterburn service for collect info from metadata server | ||
# see: https://coreos.github.io/afterburn/usage/attributes/ | ||
Requires=afterburn.service | ||
After=afterburn.service | ||
# Wait for NetworkManager to report it's online | ||
After=NetworkManager-wait-online.service | ||
# Run before kubelet | ||
Before=kubelet.service | ||
[Service] | ||
EnvironmentFile=/run/metadata/afterburn | ||
ExecStart=/usr/local/bin/aws-kubelet-providerid | ||
Type=oneshot | ||
[Install] | ||
WantedBy=network-online.target |
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
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