k8s-operator-node icon indicating copy to clipboard operation
k8s-operator-node copied to clipboard

Support for filtering watchResource with labels

Open kturcios opened this issue 4 years ago • 1 comments

As the title says, it would be a great feature to be able to filter watchResource by labels. Perhaps just expose a few of the options available for the watch query params? e.g.


export type WatchOptions = {
  labelSelector: { [key: string]: string; };
}

protected async watchResource(
  group: string,
  version: string,
  plural: string,
  onEvent: (event: ResourceEvent) => Promise<void>,
  namespace?: string,
  options: WatchOptions,
): Promise<void>

I would be happy to work on this and open a PR.

Btw, I'm curious if your implementation is inspired by any existing solution like the Operator SDK?

kturcios avatar Jan 27 '21 02:01 kturcios

Sounds like a good suggestion, so feel free to send in a PR for this if you have the time.

Implementation is not really inspired by the Operator SDK, no. So maybe there are a few interesting ideas to "borrow" from there to further improve this package? 😉

dot-i avatar Feb 03 '21 10:02 dot-i