Skip to content
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

Merged
merged 5 commits into from
Aug 28, 2018

Conversation

CSdread
Copy link
Contributor

@CSdread CSdread commented Aug 25, 2018

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.

Daniel Feinberg and others added 2 commits August 24, 2018 15:41
@theishshah
Copy link
Member

Can we document the update to the Watch interface in the user guide here

@CSdread
Copy link
Contributor Author

CSdread commented Aug 27, 2018

@theishshah added some documentation and propose slight format change since we now have more than one option for watch.

```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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*specified

@hasbro17
Copy link
Contributor

@CSdread Were you able to test this out to watch for CRs with a particular label?
What about specifying multiple label selectors app=test,foo=bar? Can you verify that works too.

@CSdread
Copy link
Contributor Author

CSdread commented Aug 27, 2018

@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.

@CSdread
Copy link
Contributor Author

CSdread commented Aug 27, 2018

I will verify it tonight

@CSdread
Copy link
Contributor Author

CSdread commented Aug 28, 2018

@theishshah I have validated that this works with a PoC. It works with multiple label selectors as well as per the Kube API: "<label1>=<value1>,<label2>=<value2>", this is ready to go

@hasbro17
Copy link
Contributor

LGTM
@fanminshi PTAL

@fanminshi
Copy link
Contributor

lgtm

@fanminshi fanminshi merged commit 51288eb into operator-framework:master Aug 28, 2018
@squeed squeed mentioned this pull request Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants