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 marshaling of taints, so an empty slice is preserved #7161

Merged

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Sep 2, 2022

Signed-off-by: Stefan Büringer [email protected]

What this PR does / why we need it:
This changes the marshalling behavior of taints to make it possible to create control plane machines without taints.

Before:

// * nil => omitted from the marshalled JSON
// * [] => omitted from the marshalled JSON
// * [regular-array] => rendered as usual

After

// * nil => omitted from the marshalled JSON
// * [] => rendered as empty array (`[]`) (<< changed)
// * [regular-array] => rendered as usual

For more details please see the issue (#7149 (comment)).

I think this is a bugfix considering the godoc:

	// Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process
	// it will be defaulted to []v1.Taint{'node-role.kubernetes.io/master=""'}. If you don't want to taint your control-plane node, set this field to an
	// empty slice, i.e. `taints: []` in the YAML file. This field is solely used for Node registration.
	// +optional

Essentially after this PR it's possible to persist and passthrough an empty slice to kubeadm. Before, it was just dropped by our defaulting webhook.

Tested with classy and non-classy cluster. See: https://gist.github.com/sbueringer/5e0ca4417efb22c412155b73bf1bfc32

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #7149

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 2, 2022
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

@sbueringer sbueringer force-pushed the pr-poc-taints-marshalling branch from 6a7f9d9 to f2fad23 Compare September 2, 2022 17:20
@sbueringer sbueringer changed the title [WIP] 🐛 Fix marshaling of taints, so an empty slice is preserved [POC] 🐛 Fix marshaling of taints, so an empty slice is preserved Sep 21, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 21, 2022
@sbueringer sbueringer force-pushed the pr-poc-taints-marshalling branch 2 times, most recently from edeea25 to 5d30b5d Compare October 5, 2022 13:41
@sbueringer sbueringer changed the title [POC] 🐛 Fix marshaling of taints, so an empty slice is preserved 🐛 Fix marshaling of taints, so an empty slice is preserved Oct 5, 2022
@sbueringer
Copy link
Member Author

/retest
/test pull-cluster-api-e2e-full-main

@sbueringer sbueringer force-pushed the pr-poc-taints-marshalling branch from 5d30b5d to 447947c Compare October 5, 2022 13:50
@sbueringer
Copy link
Member Author

sbueringer commented Oct 5, 2022

/test pull-cluster-api-e2e-full-main

EDIT: looks like Prow has some issues, let's re-test later

@sbueringer
Copy link
Member Author

sbueringer commented Oct 5, 2022

@chrischdi I think I tested all relevant variants (see gist linked in the PR description). Maybe you can do some additional smoke test if you have some time. I would really appreciate it!

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 5, 2022
@sbueringer
Copy link
Member Author

/assign @vincepri @fabriziopandini

@sbueringer sbueringer changed the title 🐛 Fix marshaling of taints, so an empty slice is preserved [WIP] 🐛 Fix marshaling of taints, so an empty slice is preserved Oct 5, 2022
@sbueringer
Copy link
Member Author

/hold

Worked a bit with Vince on it, here's a better alternative: #7347

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 5, 2022
@sbueringer
Copy link
Member Author

Closing for now to avoid confusion between the 2 PRs

/close

@k8s-ci-robot
Copy link
Contributor

@sbueringer: Closed this PR.

In response to this:

Closing for now to avoid confusion between the 2 PRs

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer
Copy link
Member Author

/reopen

#7347 (comment)

@k8s-ci-robot k8s-ci-robot reopened this Oct 5, 2022
@k8s-ci-robot
Copy link
Contributor

@sbueringer: Reopened this PR.

In response to this:

/reopen

#7347 (comment)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer sbueringer changed the title [WIP] 🐛 Fix marshaling of taints, so an empty slice is preserved 🐛 Fix marshaling of taints, so an empty slice is preserved Oct 5, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 5, 2022
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

@sbueringer
Copy link
Member Author

@fabriziopandini @vincepri
Tests are green. Should be ready for review.

Just doing another run:
/test pull-cluster-api-e2e-full-main

@fabriziopandini
Copy link
Member

Thanks for nailing down this problem!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 6, 2022
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/lgtm

@sbueringer
Copy link
Member Author

/hold

Just because some folks potentially do some additional validation. Please ignore & still review :)

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2022
@sbueringer
Copy link
Member Author

sbueringer commented Oct 7, 2022

/hold cancel

(did a few more (successful) local tests)

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 7, 2022
@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release 1-2 in a new PR and assign it to you.

In response to this:

/cherry-pick release 1-2

(as discussed in the office hours this week)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer
Copy link
Member Author

/cherry-pick release-1.2

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.2 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #7366

In response to this:

/cherry-pick release-1.2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer sbueringer deleted the pr-poc-taints-marshalling branch October 7, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an untainted control plane with KCP
6 participants