-
Notifications
You must be signed in to change notification settings - Fork 142
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
Separate the logic of applying resources from syncer and make it reusable #400
base: master
Are you sure you want to change the base?
Conversation
Hi @saza-ku. 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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
@sanposhiho: GitHub didn't allow me to request PR reviews from the following users: ordovicia. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. 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-sigs/prow repository. |
/retest |
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.
LGTM. Thank you!
eb4b4a0
to
a51cdd9
Compare
/lgtm @sanposhiho Would you mind checking this PR because this PR needs |
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 PR doesn't change oneshotimporter, did you mean you're gonna create another PR to refactor that to use resourceapplier?
Yes. This is because |
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ordovicia, saza-ku 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 |
f7c7c29
to
14cbcd3
Compare
14cbcd3
to
8aae944
Compare
type Service struct { | ||
gvrs []schema.GroupVersionResource | ||
srcDynamicClient dynamic.Interface | ||
resourceApplierService *resourceapplier.Service | ||
} | ||
|
||
type Options struct { | ||
// GVRsToSync is a list of GroupVersionResource that will be synced. | ||
// If GVRsToSync is nil, defaultGVRs are used. | ||
GVRsToSync []schema.GroupVersionResource |
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 somehow move it to the resourceapplier option as well so that we can unify the interface of the option regardless of whether users want to use oneshot or syncer?
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 could just make resourceapplier
have GVRsToSync
and syncer
refer to resouceApplierService.GRVsToSync
.
// in syncer service
infFact := dynamicinformer.NewFilteredDynamicSharedInformerFactory(s.srcDynamicClient, 0, metav1.NamespaceAll, nil)
for _, gvr := range s.resourceApplierService.GVRsToSync { // syncer itself doesn't have gvrs
inf := infFact.ForResource(gvr).Informer()
oneshotimporter
would just ignore it.
Is it okay?
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.
oneshotimporter would just ignore it.
Well, can't we make oneshotimporter also configurable about which resource to import with the same option of resourceapplyer?
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.
Yes. So we could make a PR that makes it configurable after this PR.
For now, I'll just implement as I wrote in the last comment.
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.
Ah, got what you meant. Yes, I'm fine with it if oneshotimporter would also follow the option later.
What type of PR is this?
/area simulator
/kind cleanup
What this PR does / why we need it:
syncer
andoneshotimporter
have their own logic of applying resources. They can be generalized and the replaying feature (#395) can use it.This PR separates that of
syncer
and makes it a moduleresourceapplier
.Which issue(s) this PR fixes:
Part of #395
Special notes for your reviewer:
I'll create another PR to refactor
oneshotimporter
to useresourceapplier
./label tide/merge-method-squash