-
Notifications
You must be signed in to change notification settings - Fork 30
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
✨ feat: add support for cluster class #261
✨ feat: add support for cluster class #261
Conversation
49fcc9d
to
2ff7488
Compare
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.
Looking good @salasberryfin 👍 Thanks for this.
@@ -147,6 +147,7 @@ type RKE2AgentConfig struct { | |||
LoadBalancerPort int `json:"loadBalancerPort,omitempty"` | |||
|
|||
// Version specifies the rke2 version. | |||
// This field will be deprecated in newer versions of the API and RKE2ControlPlaneSpec.Version will be used instead. |
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.
Could we use the +kubebuilder:deprecatedversion:warning=""
annotation?
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.
Until we resolve the way we manage the new Version
field (here), we're still using this and the other is just a placeholder required by the ClusterClass implementation. The deprecation warning may push people to use the new field while it is technically not supported yet.
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.
We could modify the code to use one or the other, and then have the deprecation warning. Initially didn't want to include this in the same PR, but we can do 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.
I would say lets do it or create an issue to do it straight afterwards so that its in the API bump release.
controlplane/api/v1beta1/rke2controlplanetemplate_webhook_test.go
Outdated
Show resolved
Hide resolved
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.
Maybe I am missing something but should not you add RKE2ClusterTemplate
CRD to enable CC?
// In future iterations, this field overrides the RKE2 Version specificied in RKE2ConfigSpec.AgentConfig.Version | ||
// which will be deprecated in newer versions of the API. | ||
// +optional | ||
Version string `json:"version"` |
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.
Is this version accounted anywhere? In upstream this Version field is slightly unnessesary, as this only may differentiate the control plane machines version from worker machine versions. It might be simpler to unify those. Just thinking outloud, may be wrong
@furkatgofurov7 the way I understand ClusterClass works in this scenario, we define a topology with |
8fea3a0
to
655c6eb
Compare
Thanks for the reviews and comments @Danil-Grigorev @richardcase @furkatgofurov7. Resolved most of them and will be looking at the remaining ones tomorrow. |
8f0fb74
to
43f5e60
Compare
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.
lgtm, one nit about linter rules, seems to be added by mistake?
@@ -423,6 +423,8 @@ func autoConvert_v1beta1_RKE2ControlPlaneSpec_To_v1alpha1_RKE2ControlPlaneSpec(i | |||
return err | |||
} | |||
out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) | |||
// WARNING: in.Version requires manual conversion: does not exist in peer-type |
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.
This means that version needs to be stored as annotation, and restored manually, if for some reason the RKE2 provider version is downgraded. Maybe needs addressing.
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.
There is a manual conversion here that handles the new fields Version
and MachineTemplate
.
|
||
func Convert_v1beta1_RKE2ControlPlaneSpec_To_v1alpha1_RKE2ControlPlaneSpec(in *controlplanev1.RKE2ControlPlaneSpec, out *RKE2ControlPlaneSpec, s apiconversion.Scope) error { | ||
// Version was added in v1beta1. | ||
// MachineTemplate was added in v1beta1. | ||
return autoConvert_v1beta1_RKE2ControlPlaneSpec_To_v1alpha1_RKE2ControlPlaneSpec(in, out, s) | ||
} | ||
|
||
func Convert_v1beta1_RKE2ControlPlaneStatus_To_v1alpha1_RKE2ControlPlaneStatus(in *controlplanev1.RKE2ControlPlaneStatus, out *RKE2ControlPlaneStatus, s apiconversion.Scope) error { | ||
return autoConvert_v1beta1_RKE2ControlPlaneStatus_To_v1alpha1_RKE2ControlPlaneStatus(in, out, s) | ||
} | ||
|
||
func Convert_v1alpha1_RKE2ControlPlaneStatus_To_v1beta1_RKE2ControlPlaneStatus(in *RKE2ControlPlaneStatus, out *controlplanev1.RKE2ControlPlaneStatus, s apiconversion.Scope) error { | ||
return autoConvert_v1alpha1_RKE2ControlPlaneStatus_To_v1beta1_RKE2ControlPlaneStatus(in, out, s) | ||
} | ||
|
||
func Convert_v1beta1_RKE2ControlPlaneTemplateSpec_To_v1alpha1_RKE2ControlPlaneTemplateSpec(in *controlplanev1.RKE2ControlPlaneTemplateSpec, out *RKE2ControlPlaneTemplateSpec, s apiconversion.Scope) error { | ||
return autoConvert_v1beta1_RKE2ControlPlaneTemplateSpec_To_v1alpha1_RKE2ControlPlaneTemplateSpec(in, out, s) | ||
} | ||
|
||
func Convert_v1alpha1_RKE2ControlPlaneTemplateSpec_To_v1beta1_RKE2ControlPlaneTemplateSpec(in *RKE2ControlPlaneTemplateSpec, out *controlplanev1.RKE2ControlPlaneTemplateSpec, s apiconversion.Scope) error { | ||
return autoConvert_v1alpha1_RKE2ControlPlaneTemplateSpec_To_v1beta1_RKE2ControlPlaneTemplateSpec(in, out, s) | ||
} | ||
|
||
func Convert_v1alpha1_RKE2ControlPlaneTemplateStatus_To_v1beta1_RKE2ControlPlaneStatus(in *RKE2ControlPlaneTemplateStatus, out *controlplanev1.RKE2ControlPlaneStatus, s apiconversion.Scope) error { |
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.
Previously there were no RKE2ControlPlaneTemplates in use. I think if there are issues with this conversion code, we can remove 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.
Looks good to me, just a nit.
// In future iterations, this field overrides the RKE2 Version specificied in RKE2ConfigSpec.AgentConfig.Version | ||
// which will be deprecated in newer versions of the API. | ||
// +optional | ||
Version string `json:"version"` |
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.
Lets follow up after this merges and before we release on the version fields.
bootstrap/config/crd/patches/webhook_in_rke2configtemplates.yaml
Outdated
Show resolved
Hide resolved
Thanks @richardcase @Danil-Grigorev. Will address these nits before merging. May need to think a bit more about the |
af19f6c
43f5e60
to
af19f6c
Compare
Thanks everyone for the reviews. Just fixed most recent nits. The follow-up on how |
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.
I think this is good to go, we can follow up on the version etc
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.
Nice work!
// In future iterations, this field overrides the RKE2 Version specificied in RKE2ConfigSpec.AgentConfig.Version | ||
// which will be deprecated in newer versions of the API. | ||
// +optional | ||
Version string `json:"version"` |
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.
+1
15f7962
af19f6c
to
15f7962
Compare
Signed-off-by: Carlos Salas <[email protected]>
15f7962
to
0b62188
Compare
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.
LGTM
What this PR does / why we need it:
This moves the changes proposed in #226 to the recently created
v1beta1
api version.This PR adds
RKE2ControlPlaneTemplate
, which will be used by ClusterClass. It also includes a quick start example to create a sampleClusterClass
and a workloadCluster
based on it.Which issue(s) this PR fixes:
Fixes #75
Special notes for your reviewer:
The example ClusterClass makes use of the new configurable bootstrap timeout in CAPD, which is pending release after being merged here. The default timeout is set to 3m, which is sometimes not enough for machine to be provisioned. Upstream CAPI is expected to release this change in April but we can consider this as a non-blocker as it is an existing issue when using CAPRKE2 + CAPD. In any case, it can be added to the release notes until it is ultimately released.
Supporting
ClusterClass
meant extra fields had to be added toRKE2ControlPlaneSpec
, includingVersion
. Since the provider already has a Version field inRKE2AgentConfigSpec
, there's a follow up issue, #229, to track work on addressing how these fields are managed, with the goal of deprecatingRKE2AgentConfigSpec.Version
in a future API version.For now, only the existing RKE2AgentConfigSpec.Version is supported and the new
RKE2ControlPlaneSpec.Version
is only a placeholder to support usingClusterClass
. A following PR will add the changes to support either of the two fields but not both.This PR superseds #226
Checklist: