Skip to content

[release-4.18] OCPBUGS-55383: Leverage shared node.env for both AWS providerID and hostname units #5008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release-4.18
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contents:
exit 0
fi

if [ -e "${NODEENV}" ]; then
if [ -e "${NODEENV}" ] && grep -Fq "KUBELET_NODE_NAME" ${NODEENV}; then
echo "Not replacing existing ${NODEENV}"
exit 0
fi
Expand Down Expand Up @@ -54,6 +54,6 @@ contents:

# For compatibility with the AWS in-tree provider
# Set node name to be instance FQDN instead of the default hostname
cat > "${NODEENV}" <<EOF
cat >> "${NODEENV}" <<EOF
KUBELET_NODE_NAME=${HOSTNAME}
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ contents:
#!/bin/bash
set -e -o pipefail

NODECONF=/etc/systemd/system/kubelet.service.d/20-aws-providerid.conf
NODEENV=/etc/kubernetes/node.env

if [ -e "${NODECONF}" ]; then
echo "Not replacing existing ${NODECONF}"
if [ -e "${NODEENV}" ] && grep -Fq "KUBELET_PROVIDERID" ${NODEENV}; then
echo "Not replacing existing ${NODEENV}"
exit 0
fi

Expand All @@ -34,7 +34,14 @@ contents:
# 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.
cat > "${NODECONF}" <<EOF
[Service]
Environment="KUBELET_PROVIDERID=aws:///${AVAILABILITY_ZONE}/${INSTANCE_ID}"
cat >> "${NODEENV}" <<EOF
KUBELET_PROVIDERID=aws:///${AVAILABILITY_ZONE}/${INSTANCE_ID}
EOF

# Remove the legacy node conf once we've written out the new file
LEGACY_NODECONF=NODECONF=/etc/systemd/system/kubelet.service.d/20-aws-providerid.conf

if [ -e "${LEGACY_NODECONF}" ]; then
rm -f ${LEGACY_NODECONF}
echo "Removed legacy ${LEGACY_NODECONF}"
fi