-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ support NodeRegistrationOptions.IgnorePreflightErrors #4905
Conversation
/cc @vincepri @fabriziopandini 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? |
675248a
to
0a1f63e
Compare
/retest |
There was a problem hiding this 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
cluster-api/bootstrap/kubeadm/types/v1beta2/conversion.go
Lines 73 to 96 in db47368
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 (
cluster-api/bootstrap/kubeadm/types/v1beta2/conversion_test.go
Lines 71 to 76 in 29333cd
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 | |
} |
0a1f63e
to
8f8902a
Compare
@fabriziopandini dropped the conversion and fuzzer func for IgnorePreflight, ptal |
@fabriziopandini ping In case you have some time. Not sure who else wants to review / to cc. |
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 | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
d41926b
to
0aa4de9
Compare
@vincepri PTAL :) (push --force because of rebase onto current main) |
/test pull-cluster-api-test-main |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[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 |
Signed-off-by: Stefan Büringer [email protected]
50844bc
to
2f96785
Compare
@vincepri @fabriziopandini squashed the commits, so I need a lgtm again |
/retest |
/lgtm |
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