-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
pkg/sdk: Add label selector for sdk.Watch() #428
Conversation
initial pass at adding label selector to watch
Can we document the update to the Watch interface in the user guide here |
@theishshah added some documentation and propose slight format change since we now have more than one option for watch. |
doc/user-guide.md
Outdated
```Go | ||
sdk.Watch("cache.example.com/v1alpha1", "Memcached", "default", 5, sdk.WithNumWorkers(n)) | ||
``` | ||
|
||
**Label Selector** | ||
Label selectors allow the watch to filter resources by kubernetes labels. It can be sepecified using the standard kubernetes label selector format: |
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.
*specified
@CSdread Were you able to test this out to watch for CRs with a particular label? |
adding documentation
@hasbro17 it takes the k8s label selector format as its argument. It should handle what you would build in an operator to do the label selection. |
I will verify it tonight |
@theishshah I have validated that this works with a PoC. It works with multiple label selectors as well as per the Kube API: |
LGTM |
lgtm |
pkg/sdk: adding label selector to sdk.Watch()
This is being made because as of right now there is no way to watch a specific
sub-set of a resource based on labels. This makes implementing finalizer
controllers difficult.