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

feat: Implement Migration Controller #1689

Merged

Conversation

rschalo
Copy link
Contributor

@rschalo rschalo commented Sep 19, 2024

Fixes #N/A

Description
To facilitate the v1beta1 to v1 migration, Karpenter introduced conversion webhooks. These webhooks were introduced in patch versions to v0.33.x-v0.37.x along with the 1.0 release. As a result, users are able to upgrade to 1.0 with their existing v1beta1 resources. These resources would be automatically converted by the webhooks so users could upgrade without downtime. Users would then migrate the resources they’re applying (e.g. through pipelines or GitOps solutions) to v1 before the conversion webhooks are dropped at v1.1.

There is a problem when users upgrade to v1.1. Users change the storage version on their CRDs to v1 as part of the v1.0 upgrade, however this only affects newly created resources and resources which have had writes performed against them. It is possible that a user could upgrade to v1.1 while resources are still stored as v1beta1, potentially resulting in data loss.

This PR implements two controllers to perform the write against Karpenter resources and when all resources have been updated, update status.StoredVersions for Karpenter resources to be just v1.

How was this change tested?
Local testing and unit tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 19, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 19, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 19, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @rschalo. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 19, 2024
@rschalo rschalo changed the title feat: update stored version and patch CRD feat: Implement Migration Controller Sep 19, 2024
@rschalo rschalo marked this pull request as ready for review September 19, 2024 18:01
@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 Sep 19, 2024
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/suite_test.go Outdated Show resolved Hide resolved
Copy link
Member

@jmdeal jmdeal left a comment

Choose a reason for hiding this comment

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

checkpointing

pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/crd/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/crd/controller.go Show resolved Hide resolved
pkg/controllers/migration/crd/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/crd/controller.go Show resolved Hide resolved
pkg/controllers/migration/crd/controller.go Outdated Show resolved Hide resolved
pkg/controllers/migration/resource/controller.go Outdated Show resolved Hide resolved
pkg/test/environment.go Outdated Show resolved Hide resolved
Copy link
Contributor

@njtran njtran left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 24, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njtran, rschalo

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 Sep 24, 2024
@k8s-ci-robot k8s-ci-robot merged commit 11b8901 into kubernetes-sigs:release-v1.0.x Sep 25, 2024
10 of 11 checks passed
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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

4 participants