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

⚠️ Add CAPI owned kubeadm types #4255

Conversation

fabriziopandini
Copy link
Member

@fabriziopandini fabriziopandini commented Mar 4, 2021

What this PR does / why we need it:
This PR:

  • Adds a CAPI owned copy of kubeadm types.
  • Implements conversion from the CAPI owned copy of kubeadm types to the actual kubeadm types (v1beta1 and v1beta2).
  • Uses conversions for generating the Kubeadm Config files in CABPK

Which issue(s) this PR fixes:
Fixes #

/milestone v0.4.0
/hold
For the CAEP to merge

@vincepri

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 4, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4.0 milestone Mar 4, 2021
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 4, 2021
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 4, 2021
@fabriziopandini fabriziopandini force-pushed the add-CAPI-owned-kubeadm-types branch from a6b0926 to 6fd499e Compare March 5, 2021 09:17
@fabriziopandini
Copy link
Member Author

/retest

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

@fabriziopandini fabriziopandini force-pushed the add-CAPI-owned-kubeadm-types branch from 6fd499e to 15a6ffb Compare March 11, 2021 12:26
@fabriziopandini fabriziopandini changed the title [WIP] ⚠️ Add CAPI owned kubeadm types ⚠️ Add CAPI owned kubeadm types Mar 11, 2021
@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 Mar 11, 2021
@fabriziopandini
Copy link
Member Author

/hold cancel

@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 Mar 11, 2021
@fabriziopandini
Copy link
Member Author

@vincepri this one is ready for review now

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 11, 2021
@fabriziopandini fabriziopandini force-pushed the add-CAPI-owned-kubeadm-types branch from 15a6ffb to 02e6697 Compare March 12, 2021 10:19
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-test-main

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 12, 2021
Comment on lines 173 to 178
// NOTE: Kubeadm types does not have ObjectMeta, so this step is executed only when required.
metaAfter, ok := spokeAfter.(metav1.Object)
if ok {
delete(metaAfter.GetAnnotations(), DataAnnotation)
}
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 is not ObjectMeta in the kubeadm types, why use this function to test? Could we pass the encapsulating object instead?

Copy link
Member Author

@fabriziopandini fabriziopandini Mar 15, 2021

Choose a reason for hiding this comment

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

With the new conversions, kubeadm v1beta1 and v1beta2 two types are defined as conversion spoke, and the don't have encapsulating objects anymore.

So, given that v1beta1 and v1beta2 (which are mirrored from kubeadm) do not have ObjectMeta, it was require to introduce this type check before calling delete

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to just use the super-types instead each inner type? Without this logic, we have no way to preserve conversion between types

Copy link
Member Author

Choose a reason for hiding this comment

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

@vincepri I have added a commit where I'm trying to make skipping this operation something that should be required explicitly (vs trying to assume intent)

bootstrap/kubeadm/types/v1beta2/doc.go Outdated Show resolved Hide resolved
bootstrap/kubeadm/types/v1beta2/doc.go Outdated Show resolved Hide resolved
bootstrap/kubeadm/types/v1beta1/doc.go Outdated Show resolved Hide resolved
bootstrap/kubeadm/types/v1beta1/doc.go Outdated Show resolved Hide resolved
Comment on lines +439 to +442
type BootstrapTokenString struct {
ID string `json:"-"`
Secret string `json:"-"`
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to keep the token as a struct?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

According to the CAEP as a first step we are going to create v1alpha4 types equal to v1beta1 (thus including token struct).
As soon as conversion are in place then we could start simplifying Cluster API owned types

@fabriziopandini fabriziopandini force-pushed the add-CAPI-owned-kubeadm-types branch from ad73e03 to 3c3f298 Compare March 22, 2021 15:32
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 22, 2021
@fabriziopandini fabriziopandini force-pushed the add-CAPI-owned-kubeadm-types branch from 3c3f298 to 35c2ffe Compare March 26, 2021 13:25
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 26, 2021
@fabriziopandini fabriziopandini force-pushed the add-CAPI-owned-kubeadm-types branch from 35c2ffe to e8cb88e Compare April 6, 2021 19:44
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Apr 6, 2021

@fabriziopandini: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cluster-api-apidiff-main e8cb88e link /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@fabriziopandini
Copy link
Member Author

@vincepri this is back in shape now (Problems with go-bindata were resolved by #4378)

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
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 6, 2021
@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 Apr 6, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5f08b4a into kubernetes-sigs:master Apr 6, 2021
@fabriziopandini fabriziopandini deleted the add-CAPI-owned-kubeadm-types branch April 7, 2021 14:11
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants