-
Notifications
You must be signed in to change notification settings - Fork 64
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
Use storage version API #85
Conversation
/test pull-kube-storage-version-migrator-ha-master |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: roycaihw The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
472da72
to
2b87611
Compare
@roycaihw: The following tests failed, say
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. |
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 need more time to think about the logic in storageversion_handler.go, so you don't need to address my comments in that file.
We need to revisit the storageState API. Currently it's recording the storageVersionHash, we need to convert it to recording storage version.
The storageState.status.lastHeartbeatTime
field probably can be removed, because we now uses watch instead of polling, we won't miss the storage version change.
storageVersionInformer: apiserverinternalinformers.NewStorageVersionInformer(kubeClient, | ||
0, | ||
cache.Indexers{}), | ||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "migration_triggering_controller"), |
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.
Can we name this queue and respective enqueue/dequeue function as well? Maybe just migrationQueue
.
func (mt *MigrationTrigger) updateStorageVersion(_ interface{}, obj interface{}) { | ||
mt.addStorageVersion(obj) | ||
} | ||
|
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 we should handle deleteStorageVersion as well. The controller can garbage collect respective storageVersionMigration and storageState objects.
m := &migrationv1alpha1.StorageVersionMigration{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
GenerateName: storageStateName(resource) + "-", |
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 need to garbage collects the old storageVersionMigration. cleanMigrations
won't GC the old ones. We can do this in a follow-up.
@@ -47,25 +50,40 @@ const ( | |||
) | |||
|
|||
type MigrationTrigger struct { |
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 we can split the Trigger to two controllers. The storageVersion control loop and the migration control loop is decoupled.
) | ||
|
||
func (mt *MigrationTrigger) processStorageVersion(ctx context.Context, sv *apiserverinternalv1alpha1.StorageVersion) error { | ||
klog.V(2).Infof("processing storage version %#v", sv) |
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.
In production we don't want to log the entire storageVersion object.
} | ||
} | ||
storageVersionChanged := found && (ss.Status.CurrentStorageVersionHash != *sv.Status.CommonEncodingVersion || | ||
lastTransitionTime != mt.lastSeenTransitionTime[sv.Name]) && foundCondition |
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.
Can we make a standalone variable for case storageVersionlastTransitionTime != mt.lastSeenTransitionTime[sv.Name]
, maybe naming it storageVersionPossiblyFlipped
(or a better name)?
Also I don't remember if the migrator skips migrating the We should skip migrating |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
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. |
/assign @caesarxuchao
This PR changes the storage migrator trigger controller to use the new storage version API, which supports HA clusters. This PR also adds a test
pull-kube-storage-version-migrator-ha-master
, which rolling-updates an HA cluster to change the storage version of CRD from apiextensions.k8s.io/v1beta1 to apiextensions.k8s.io/v1.The two existing tests
pull-kube-storage-version-migrator-fully-automated-e2e
andpull-kube-storage-version-migrator-disruptive
are failing now because they exercise storage migration for custom resources. These tests will pass when custom resource storage version support is merged upstream: kubernetes/kubernetes#96403 (which I'm working on this week)