-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(source/service): watch headless endpoints #4427
base: master
Are you sure you want to change the base?
feat(source/service): watch headless endpoints #4427
Conversation
Welcome @tufitko! |
Hi @tufitko. 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/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Thanks. This PR looks good. |
/lgtm |
|
||
// Check updates in headless endpoints. | ||
// It's ignores adds and deletes to avoid unnecessary handler processing. | ||
sc.endpointsInformer.Informer().AddEventHandler(headlessEndpointFilter{eventHandlerFunc(handler)}) |
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 would rather like to see an opt-in approach rather than having this added.
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.
hmm, I can add label selector to a shared informer factory, but I need to create another one, something like this:
headlessLabelSelector, err := labels.NewRequirement(v1.IsHeadlessService, selection.Exists, nil)
if err != nil {
return nil, err
}
headlessEndpointInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, 0,
kubeinformers.WithNamespace(namespace),
kubeinformers.WithTweakListOptions(func(options *metav1.ListOptions) {
options.LabelSelector = headlessLabelSelector.String()
}),
)
endpointsInformer := headlessEndpointInformerFactory.Core().V1().Endpoints()
// duplicate Start and waitForCacheSync funcs for this factory
Is that OK?
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, do I need to do something?
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 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.
@szuecs @mloiseleur Can you please reply?
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.
@mloiseleur Are you sure it’s not enabled by default? It would be strange behavior if you don’t use the filter but still don’t get everything. Additionally, this filter seems to work differently compared to the others.
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.
On v0.15.0, it's all:
--service-type-filter=SERVICE-TYPE-FILTER ...
The service types to take care about (default: all,
expected: ClusterIP, NodePort, LoadBalancer or ExternalName)
I think you're right: it works quite differently from the other service types. It would be quite unexpected to enable/disable an informer with this filter.
So I guess it should be opt-in with a new option on --source
(something like headless-service
for instance)
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.
hmm, I think it better to add explicit type in --service-type-filter
, enabled by default.
Anyway, it's breaking changes.
With a new source, 2 sources are triggered when creating/updating/deleting services (headless or not) because there isn't any filter in the event handler. Is that OK?
With a new service type (enabled by default), the source can be triggered more often.
For users, who use external-dns for headless services, this change would be good (allows increasing sync interval)
For users, who don't have headless services in a cluster, nothing is changed
Bad case, when a user has a headless service, but doesn't use external-dns for managing records
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 the last proposal from @tufitko makes sense to me. I think this is more of a bug fix than something we need to carefully feature flag and it's gonna be in the new release only anyway. wdyt @mloiseleur ?
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.
Hi @tufitko Are you still interesting in this feature to be merged? I appreciate is being a while. Just to make it clear, the headler service is this one? Just to make sure we're talking about the same thing... So we have dozens of headless services, mainly grpc client/service applications. We have client load balancers, they root traffic to in-cluster ips with cluster local, and we have ingresses if grpc calls happens cross-clusters or networks. There are as well headless services that route traffic to S3 or similar storages and etc. Here is the very high level diagram What come to mind, potential pain points I see here
Will this change affect all the headless services, or only specific services annotate with which annotation? |
/assign |
PR needs rebase. 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. |
Description
Call event handler for service source when headless service's endpoints change.
Fixes #4113
Checklist