-
Notifications
You must be signed in to change notification settings - Fork 94
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
🐛 migration-controller depending on cluster-manager condition. #328
🐛 migration-controller depending on cluster-manager condition. #328
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #328 +/- ##
==========================================
- Coverage 61.75% 61.54% -0.22%
==========================================
Files 132 133 +1
Lines 13992 14125 +133
==========================================
+ Hits 8641 8693 +52
- Misses 4585 4670 +85
+ Partials 766 762 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/assign @haoqing0110 |
/assign @qiujian16 |
if storageVersion == migration.Spec.Resource.Version { | ||
errs = append(errs, fmt.Errorf("the current storage version of %v is %v, which is the same as the version in the migration CR %v", | ||
resourceToCRDName(migration.Spec.Resource.Resource, migration.Spec.Resource.Group), | ||
storageVersion, migration.Name)) |
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.
if we continue here, how does the controller get triggered after crd is updated later?
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.
At this point of time, the migration instance is not created yet.
The errs = append(errs, fmt.Errorf("the current storage version of %v is %v, which is the same as the version in the migration CR %v", resourceToCRDName(migration.Spec.Resource.Resource, migration.Spec.Resource.Group), storageVersion, migration.Name))
makes sure this round of reconcile will return error and fail.
And then the controller will requene the request.
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 am thinking you would want to requeue instead of error fallback.
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.
Agree, sperate another checkCRDStorageVersion
function and requeue if:
- CRD doens't exist
- CRD storage version is not correct.
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.
right, I think we probably should requeue under these conditions, or we need to watch crds.
c539e80
to
aa6177e
Compare
err = checkCRDStorageVersion(ctx, migrations, apiExtensionClient) | ||
if err != nil { | ||
klog.Errorf("Failed to check CRD current storage version. %v", err) | ||
controllerContext.Queue().Add(clusterManagerName) |
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.
AddAfter for a certain period. You would not want to requeue immediately.
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.
Good point, add a reSyncTime
equals to 5 seconds.
aa6177e
to
dfa9384
Compare
/approve @elgnay would you take a look pls? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiujian16, xuezhaojun 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 |
Signed-off-by: xuezhaojun <zxue@redhat.com>
dfa9384
to
e6bec14
Compare
// 1.The CRD must exists before the migration CR is created. | ||
// 2.The CRD must have at least 2 version. | ||
// 3.The version set in the migration CR must exist in the CRD. | ||
// 4.The currrent storage vesion in CRD should not be the version in the migration CR, otherwise during the migration, the |
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 requires we following this practice in the following upgrade flow: when create a StorageVersionMigration, the version must be the "migration from" version, not the "migration to" version. @qiujian16
cc @elgnay
@elgnay PR update:
@qiujian16 In the last offline discussion with YangLe, he mentioned the point that StorageVersionMigration doesn't limit the That means we have to make it a convention of the upgrade flow, more details see: https://github.com/open-cluster-management-io/ocm/pull/328/files#r1424801861 |
/assign @elgnay |
/lgtm |
93a9d19
into
open-cluster-management-io:main
Changes
parseStorageVersionMigrationFiles
and put it at the beginning of the reconcile.removeStorageVersionMigrations
,applyStorageVersionMigrations
,syncStorageVersionMigrationsCondition
all have the parse files process, we should extract them into one place.supportStorageVersionMigration
beforeremoveStorageVersionMigrations
supported
is the base of every StorageVersionMigration related process, it should be done at the beginning.applyStorageVersionMigrations
tocreateStorageVersionMigrations
, add CRD check and remove theupdate
partstorageversionmigration
is a create-only job-style object, the version field update won’t trigger another round of migration.testMigrationRequestFiles
and any code locked with specific CRD types. Usingfoo
andbar
instead.Related issue(s)
Fixes #