Skip to content
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

Fix ManagedNodeGroup taints being wrongly set in userdata #1441

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

flostadler
Copy link
Contributor

@flostadler flostadler commented Oct 14, 2024

The taints for the ManagedNodeGroup component were being wrongly calculated when using custom userdata.
That was the case because the EKS service uses different capitalization for the taint effect enum than the kubernetes API(e.g. NO_SCHEDULE vs NoSchedule).
When building the custom userdata we need to map the EKS style enums to kubernetes style enums, otherwise it doesn't work.

Fixing this also revealed that taint values being absent aren't correctly handled either. The change fixes that as well.

While this was found during the v3 beta testing (see), it's a bug on v2 as well. The bug fix is targeting v3 anyways because the node group and user data logic was heavily rewritten during the development of v3. Back porting that to v2 would be too big of an effort given that v3 is right around the corner.

@flostadler flostadler requested review from t0yv0, rquitales, corymhall and a team October 14, 2024 13:09
@flostadler flostadler self-assigned this Oct 14, 2024
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@flostadler flostadler force-pushed the flostadler/bottlerocket-mng-fix branch from 18fbcaa to d0e7a0d Compare October 14, 2024 14:01
@@ -449,7 +454,8 @@ function createBottlerocketUserData(
if (args.taints) {
const taints = {};
const records = Object.entries(args.taints).map(([key, taint]) => {
return { [key]: `${taint.value}:${taint.effect}` };
// empty taint values are represented as an empty string, see https://github.com/bottlerocket-os/bottlerocket/pull/1406
return { [key]: `${taint.value ?? ""}:${taint.effect}` };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

coredns = eks.Addon(
f"{project_name}-cluster3-coredns",
cluster=cluster3,
addon_name="coredns",
addon_version="v1.11.1-eksbuild.9",
addon_version=coredns_version.version,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated fix looks like.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But great! I was fixing this again as port of ops, your solution is more robust.

@flostadler flostadler merged commit 4f30a8d into release-3.x.x Oct 15, 2024
34 checks passed
@flostadler flostadler deleted the flostadler/bottlerocket-mng-fix branch October 15, 2024 12:04
flostadler added a commit that referenced this pull request Oct 17, 2024
The taints for the `ManagedNodeGroup` component were being wrongly
calculated when using custom userdata.
That was the case because the EKS service uses different capitalization
for the taint effect enum than the kubernetes API(e.g. `NO_SCHEDULE` vs
`NoSchedule`).
When building the custom userdata we need to map the EKS style enums to
kubernetes style enums, otherwise it doesn't work.

Fixing this also revealed that taint values being absent aren't
correctly handled either. The change fixes that as well.
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.0.0-beta.2.

flostadler added a commit that referenced this pull request Oct 17, 2024
The taints for the `ManagedNodeGroup` component were being wrongly
calculated when using custom userdata.
That was the case because the EKS service uses different capitalization
for the taint effect enum than the kubernetes API(e.g. `NO_SCHEDULE` vs
`NoSchedule`).
When building the custom userdata we need to map the EKS style enums to
kubernetes style enums, otherwise it doesn't work.

Fixing this also revealed that taint values being absent aren't
correctly handled either. The change fixes that as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants