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

📖 CAEP: Insulate users from kubeadm API version changes #4170

Merged

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
As per #2769 (comment)

We should stop exposing the kubeadm v1betax types in our KubeadmConfig/KubeadmControlPlane specs, and instead use our own types. This would allow us to separate what users fill in from which kubeadm API version we end up using in our bootstrap data.

IMPORTANT! This task is a release blocker for CABPK/v1alpha4. Changes in v1alpha3 are required to support Kubernetes version >= v1.21 (assuming removal of v1beta1 types in kubeadm happens in v1.21)

Which issue(s) this PR fixes:
Rif #2769

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 10, 2021
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 10, 2021
@fabriziopandini
Copy link
Member Author

/milestone v0.4.0
/kind api-change

@k8s-ci-robot k8s-ci-robot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Feb 10, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4.0 milestone Feb 10, 2021

While moving to a more recent version of the kubeadm API is a required move, Cluster API
should take this opportunity stop to exposing the kubeadm API types in the
KubeadmConfig/KubeadmControlPlane specs, and instead use our own types.
Copy link
Member

@neolit123 neolit123 Feb 10, 2021

Choose a reason for hiding this comment

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

i think embedding the kubeadm v1beta1 type was a mistake.

a non-v1 type should not be embedded in another type as as a field. but there is also a risk for v1 types in a dynamic area of k8s. if v2 comes out (inevitable in some places) you'd have to bump your API if you want to use the v2 features.

wrapping kubeadm types will inevitably introduce burden on CAPI and just more types to maintain. how much are you going to expose out of the kubeadm API?

i think the right pattern is to:

  • pass the kubeadm types as separate structures (separated with ---\n)
  • let users configure everything
  • document what cannot be configured and CAP* will override it
  • error out on outdated APIs
  • support conversion on public types, where both CAP* and users can do it on demand.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a little bit of confusion here, I rephrased it to make it more clear, PTAL.

v1.16 could work with v1beta2 types. Same for all the other versions up to latest(1.20)
and next (1.21).
- limitations: this approach is not future proof, and it should be reconsidered
whenever a new version of kubeadm types is created while v1alpha3 is still supported.
Copy link
Member

Choose a reason for hiding this comment

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

it does feel like a temporary hack.

Copy link
Member Author

Choose a reason for hiding this comment

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

there are pro and cons.
it has limitations and it is not future proof but it limits the impact/the risks on the v1alpha3 branch.
but let's see other opinions on the two alternatives

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

1 similar comment
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

@fabriziopandini fabriziopandini changed the title 📖 Add KEP for introducing a Cluster API owned copy of the kubeadm types 📖 CAEP: Insulate users from kubeadm API version changes Mar 2, 2021
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

lgtm overall. I'm leaning for alternative 2 for v1alpha3, I think we should prioritize limiting changes and risk for alpha3 and put the work for making it future proof into v1alpha4.


Planned actions are:

- introduce a Cluster API owned version of the kubeadm config types
Copy link
Contributor

Choose a reason for hiding this comment

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

would this "version" be unversioned?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, those types will be part of Cluster API types, and thus initially versioned as v1alpha4.
The advantage is that once conversion will be in place, those types are not required anymore to have the same serialization format of the real kubeadm types.

Added a sentence to make this more clear

__Alternative 1:__

Keep kubeadm v1beta1 types as a Hub type (1); implement conversion to kubeadm API
version f(Kubernetes Version) when generating the kubeadm config for init/join.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% clear on what implement conversion to kubeadm API version f(Kubernetes Version) means

Copy link
Member Author

@fabriziopandini fabriziopandini Mar 8, 2021

Choose a reason for hiding this comment

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

Added an example to make this more clear

@fabriziopandini
Copy link
Member Author

@CecileRobertMichon thanks for review, really appreciated!
Comment addressed, PTAL

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 8, 2021
Copy link
Member

@detiber detiber left a comment

Choose a reason for hiding this comment

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

A couple of minor comments, otherwise this proposal lgtm. Thanks @fabriziopandini for all the effort you've put into this.

anymore to have the same serialization format of the real kubeadm types.
- preserve `bootstrap/kubeadm/types/v1beta1` as a serialization/deserialization
spoke (1) for v1alpha4 (also, this will be used by v1alpha3 API types until removal)
- preserve `bootstrap/kubeadm/types/v1beta2` as serialization/deserialization
Copy link
Member

Choose a reason for hiding this comment

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

Weren't there plans to move the kubeadm types out of k/k? Ideally that would be a long term goal to reference the official kubeadm types even if we need to generate our own conversions to/from rather than having to worry about potential config drift between two different sources of truth.

Copy link
Member Author

@fabriziopandini fabriziopandini Mar 9, 2021

Choose a reason for hiding this comment

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

Unfortunately the for moving kubeadm out of k/k is getting stuck.
However I added a note to document this.

Planned actions are:

- introduce a Cluster API owned version of the kubeadm config types
(starting from kubeadm v1beta1?) to be used by KubeadmConfig/KubeadmControlPlane
Copy link
Member

Choose a reason for hiding this comment

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

If there are additional features that are not available in v1beta1 and there is any possibility that we want to support those features, then it might be a good idea to start with the v1beta2 types as the hub type.

Copy link
Member Author

@fabriziopandini fabriziopandini Mar 9, 2021

Choose a reason for hiding this comment

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

The only feature that not available in v1beta1 is IgnorePreflightError field, but after some thinking my idea is to start from v1beta1, get all the conversion and fuzz test in place, and only in a follow up PR, add the IgnorePreflightError to the Cluster API owned types.
I have added a bulled in the planned actions to track this

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 9, 2021
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

2 similar comments
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

@fabriziopandini
Copy link
Member Author

squashed commits, all comment addressed.
thanks everyone for feedback!

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.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 9, 2021
@detiber
Copy link
Member

detiber commented Mar 10, 2021

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: detiber

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 Mar 10, 2021
@k8s-ci-robot k8s-ci-robot merged commit 6147c8c into kubernetes-sigs:master Mar 10, 2021
@fabriziopandini fabriziopandini deleted the kubeadm-types-KEP branch March 11, 2021 09:28
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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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.

7 participants