-
Notifications
You must be signed in to change notification settings - Fork 451
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
[GEP-7] Adds shoot component interfaces for Migration and Restoration. #2511
[GEP-7] Adds shoot component interfaces for Migration and Restoration. #2511
Conversation
8bfd577
to
0a69bf1
Compare
Quick question, because I am starting to get conceptually confused with these interfaces. I thought the idea was to change the implementation of the deployer depending on the use case. If not what is the idea of the NewDefaultNetwork constructor about. In the end migrate or restore are either destroying the component or deploying it, couldn't we fit in the Deploy and Destroy methods instead? |
I managed to come up with a couple of options to add the ShootState from the botanist to the network component since we can't pass it in the component's constructor (the ShootState ptr is modifed during reconciliation):
Migrate will generally be the same for extension resources (just adding an annotation), but it could also be implement it for the ETCD (if that becomes a component) where it will make sure that a snapshot is taken. I prefer the additional interfaces a bit more than option 2. (or adding some type of Injector interface) |
0a69bf1
to
1f85779
Compare
Exactly, and this is weird because in future, ShootState would be deployed as a component as well right. So possibly we are going to have multiple such dependencies between components. Are we going to expand these interfaces then, or what? I know that @mvladev had a similar case with the external DNS if I am not wrong, where he had to set the the service IP later in the flow. gardener/pkg/operation/botanist/controlplane.go Line 1247 in fc060aa
|
TBH, I'm also confused why this PR is needed. I haven't really understood it out of the above explanation. As @swilen-iwanow suggested, can't we use the existing |
/assign @swilen-iwanow @rfranzke |
The initial problem was because of this:
Since We could re-add the Get method in The other option is to make But after discussing it really briefly with @mvladev and @danielfoehrKn I went with the Restore and Migrate methods/interfaces. Anyway, maybe the new interfaces really add more complexity and aren't really necessary. @mvladev @danielfoehrKn wdyt? |
Having Restore and Migrate interfaces that can optionally be implemented by components that have a state (all extension resources), does not sound like a bad idea to me. I ll have to look more into the details here tomorrow. |
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.
To me adding shoot component interfaces for Migration and Restoration makes sense.
This way the restore and migrate operations are also decoupled from the botanist - easier to write unit tests.
@mvladev WDYT
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 also think the new interfaces make sense, and I find the new structure of the code cleaner than before. I only have a minor remark on code duplication. I haven't tested the migration itself though. Will try to do it and post an update if I find anything.
pkg/operation/botanist/extension.go
Outdated
if err := b.Shoot.Components.Network.WaitMigrate(ctx); err != nil { | ||
return err | ||
} | ||
|
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.
There is a lot of duplication between the code that follows and the WaitUntilExtensionCRMigrated
method - could this method be used below? Or could perhaps the common code be extracted into a helper function to avoid duplication?
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.
Yep I should've extracted it in the common
package similar to the RestoreExtensionObjectState
method.
I encountered the following issue when trying to test this PR during the preparation phase:
I noticed that the backupentry I have is called Not sure if this is related to this PR but I guess it should be investigated. |
Hmm, most likely isn't related. I didn't hit this error, but I'll see if I can reproduce it somehow. |
/unhold as v1.7.0 is released |
@swilen-iwanow ran into the same issue without this PR, so I guess it's not related but we should still investigate (however, add the fix with a different PR) Anyway, I'll rebase and update asap. |
1f85779
to
b5cf074
Compare
/lgtm |
/needs rebase |
@danielfoehrKn can you have another look? |
/lgtm - did not test the migration & restoration aspects of it. |
b5cf074
to
3ece63e
Compare
Rebased |
@rfranzke if you want to have another look, otherwise looks good to me |
Thanks for checking, as it got approved already by you and Stoyan I'm okay with /merge. |
How to categorize this PR?
/area control-plane-migration
/kind enhancement
/priority normal
What this PR does / why we need it:
This PR adds interfaces which can be used by shoot components (namely for extension resources) if they need to be Migrated and then Restored during control plane migration.
The PR also implements these interfaces for the Network Component and fixes an issue which prevented the network resource from having its
Restore
annotation applied due to always running into conflict when update is called.Which issue(s) this PR fixes:
Part of #1631
Special notes for your reviewer:
In the future we should do this for all botanist shoot components responsible for extension resources.
Release note: