-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[wip] sdk: add operator and builder interface #7
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
[wip] sdk: add operator and builder interface #7
Conversation
| // APIVersion is the version from the groupVersion. | ||
| APIVersion(apiVersion string) Builder | ||
| // Callbacks registers the callbacks which notifies the creation, update, and deletion of any Custom Resource. | ||
| Callbacks(callBacks CallBacks) Builder |
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.
the callback should not be per resource based. it is a pain in the ass to ask the users to serialize the requests to avoid concurrency issues.
users should only need to implement a single sync func where all changes are serialized already by SDK. Users do not need to solve any concurrency issue.
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 see. that makes sense. i'll re-think the api def.
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.
the callback should not be per resource based.
What do you mean by not per resource based?
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.
So from what I understand related to xiang's comment on the other PR the idea is that there should not be separate callbacks/sync functions registered for each different custom resource, pods, secrets etc.
https://github.com/coreos/operator-sdk/pull/6/files#r167013090
The users would just watch for all the resources they need and all events(add,update, delete) would get sent to the main sync function and be handled by the user over there.
sdk.Watch(EtcdCluster)
sdk.Watch(Vault)
sdk.Watch(ConfigMap)
...
func sync(...) {
// Handle sync based for all resources and event types
}
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.
@hasbro17 exactly.
users only need to fill in sync func like this
func sync(objects []runtime.Object) {
switch {
case X:
handle(X)
}
}|
This PR is causing too much distraction. I'm closing it now. |
…tream-dockerfile adding upstream docker file
Signed-off-by: Venkat Ramaraju <[email protected]>
Initial thoughts on operator sdk interface.