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

✨ support NodeRegistrationOptions.IgnorePreflightErrors #4905

Conversation

sbueringer
Copy link
Member

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

What this PR does / why we need it:
For details see linked issue

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 #4581

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 9, 2021
@k8s-ci-robot k8s-ci-robot requested review from enxebre and JoelSpeed July 9, 2021 08:23
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 9, 2021
@sbueringer
Copy link
Member Author

/cc @vincepri @fabriziopandini
If I'm not mistaken, the IgnorePreflightErrors field was already added with kubeadm v1beta2 (I only had to add it to our structs not to our copies of the v1beta2 structs).

I assume as we stopped supporting kubeadm v1beta1 with v1alpha4 (i.e. Kubernetes versions < 1.15), it doesn't make sense to add validation for the v1beta1 case?

@sbueringer sbueringer force-pushed the pr-add-ignore-preflight-errors branch from 675248a to 0a1f63e Compare July 9, 2021 08:51
@sbueringer
Copy link
Member Author

/retest

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

If I'm not mistaken, the IgnorePreflightErrors field was already added with kubeadm v1beta2

You are right; given that it already existed in v1beta2 and now also in v1alpha4, what about cleaning up following custom conversion func

func Convert_v1beta2_InitConfiguration_To_v1alpha4_InitConfiguration(in *InitConfiguration, out *bootstrapv1.InitConfiguration, s apimachineryconversion.Scope) error {
// InitConfiguration.CertificateKey exists in v1beta2 types but not in bootstrapv1.InitConfiguration (Cluster API does not uses automatic copy certs). Ignoring when converting.
return autoConvert_v1beta2_InitConfiguration_To_v1alpha4_InitConfiguration(in, out, s)
}
func Convert_v1beta2_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(in *NodeRegistrationOptions, out *bootstrapv1.NodeRegistrationOptions, s apimachineryconversion.Scope) error {
// NodeRegistrationOptions.IgnorePreflightErrors exists in v1beta2 types but not in bootstrapv1.NodeRegistrationOptions (Cluster API does not support it for now). Ignoring when converting.
return autoConvert_v1beta2_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(in, out, s)
}
func Convert_v1beta2_JoinControlPlane_To_v1alpha4_JoinControlPlane(in *JoinControlPlane, out *bootstrapv1.JoinControlPlane, s apimachineryconversion.Scope) error {
// JoinControlPlane.CertificateKey exists in v1beta2 types but not in bootstrapv1.JoinControlPlane (Cluster API does not uses automatic copy certs). Ignoring when converting.
return autoConvert_v1beta2_JoinControlPlane_To_v1alpha4_JoinControlPlane(in, out, s)
}
func Convert_v1beta2_DNS_To_v1alpha4_DNS(in *DNS, out *bootstrapv1.DNS, s apimachineryconversion.Scope) error {
// DNS.Type was removed in v1alpha4 because only CoreDNS is supported, dropping this info.
return autoConvert_v1beta2_DNS_To_v1alpha4_DNS(in, out, s)
}
func Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *ClusterConfiguration, out *bootstrapv1.ClusterConfiguration, s apimachineryconversion.Scope) error {
// ClusterConfiguration.UseHyperKubeImage was removed in kubeadm v1alpha4 API
return autoConvert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s)
}

Eventually also v1beta2 <-> v1alpha4 conversion tests can now be cleaned up (
func nodeRegistrationOptionsFuzzer(obj *NodeRegistrationOptions, c fuzz.Continue) {
c.FuzzNoCustom(obj)
// NodeRegistrationOptions.IgnorePreflightErrors does not exists in v1alpha4, so setting it to nil in order to avoid v1beta2 --> v1alpha4 --> v1beta2 round trip errors.
obj.IgnorePreflightErrors = nil
}
)

controlplane/kubeadm/api/v1alpha3/conversion_test.go Outdated Show resolved Hide resolved
bootstrap/kubeadm/api/v1alpha3/conversion_test.go Outdated Show resolved Hide resolved
@sbueringer sbueringer force-pushed the pr-add-ignore-preflight-errors branch from 0a1f63e to 8f8902a Compare July 12, 2021 11:47
@sbueringer
Copy link
Member Author

@fabriziopandini dropped the conversion and fuzzer func for IgnorePreflight, ptal

@sbueringer
Copy link
Member Author

@fabriziopandini ping In case you have some time. Not sure who else wants to review / to cc.

Comment on lines +83 to +89
func kubeadmNodeRegistrationOptionsFuzzer(obj *kubeadmbootstrapv1alpha4.NodeRegistrationOptions, c fuzz.Continue) {
c.FuzzNoCustom(obj)

// NodeRegistrationOptions.IgnorePreflightErrors does not exist in kubeadm v1beta1 API, so setting it to nil in order to avoid
// v1alpha4 --> v1beta1 -> v1alpha4 round trip errors.
obj.IgnorePreflightErrors = nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we restore the field during conversion instead of dropping it?

Copy link
Member Author

@sbueringer sbueringer Jul 29, 2021

Choose a reason for hiding this comment

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

@vincepri
Very nice finding. I implemented it for the top-level types: KubeadmConfig, KubeadmConfigTemplate and KubeadmControlPlane.

Given that in the current case we convert between InitConfigurations and JoinConfigurations and they don't have ObjectMeta I'm not sure if it's possible in this case. (and if it makes sense to implement it)

@sbueringer sbueringer force-pushed the pr-add-ignore-preflight-errors branch from d41926b to 0aa4de9 Compare July 29, 2021 08:26
@sbueringer
Copy link
Member Author

@vincepri PTAL :) (push --force because of rebase onto current main)

@sbueringer
Copy link
Member Author

/test pull-cluster-api-test-main
flakes

@fabriziopandini
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2021
@vincepri vincepri added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 2, 2021
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 Aug 2, 2021
@sbueringer sbueringer force-pushed the pr-add-ignore-preflight-errors branch from 50844bc to 2f96785 Compare August 2, 2021 15:43
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2021
@sbueringer
Copy link
Member Author

@vincepri @fabriziopandini squashed the commits, so I need a lgtm again

@sbueringer
Copy link
Member Author

/retest

@fabriziopandini
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2021
@k8s-ci-robot k8s-ci-robot merged commit 914e79c into kubernetes-sigs:master Aug 2, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Aug 2, 2021
@sbueringer sbueringer deleted the pr-add-ignore-preflight-errors branch August 3, 2021 06:44
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. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add IgnorePreflightErrors to KubeadmConfig types
4 participants