cli-utils icon indicating copy to clipboard operation
cli-utils copied to clipboard

feat: allow disabling/overriding ObjectFilter in status watcher

Open floreks opened this issue 1 year ago • 3 comments

With the addition of Filters to the DefaultStatusWatcher it is now possible to apply server-side filtering via labels/fields. This PR allows dropping or overriding client-side filtering with a custom ObjectFilter. In our case we are making sure that every resource in the inventory will contain a static label that can be used for server-side filtering and further client-side filtering is obsolete.

floreks avatar Jun 20 '24 11:06 floreks

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: floreks Once this PR has been reviewed and has the lgtm label, please assign mortent for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Jun 20 '24 11:06 k8s-ci-robot

What's the benefit of using a custom object filter?

The built-in filter filters by ID from a map, so it's pretty efficient, just a hashtable lookup. It shouldn't cause any real performance impact.

karlkfi avatar Jul 02 '24 18:07 karlkfi

There might not be many use cases for the custom implementation of ObjectFilter. Being able to disable it completely when relying on server-side filtering is what I was looking for. If that would be something you would be interested in, let me know and I will adjust the code.

PS. From what I can see current AllowListObjectFilter is simply going through the array and doing a struct comparison. https://github.com/kubernetes-sigs/cli-utils/blob/4d57e6e23edac29f2ea3ae9aa8b0ff0a85fc01cc/pkg/kstatus/watcher/object_filter.go#L27-L30 https://github.com/kubernetes-sigs/cli-utils/blob/4d57e6e23edac29f2ea3ae9aa8b0ff0a85fc01cc/pkg/object/objmetadata_set.go#L56-L62

floreks avatar Jul 03 '24 07:07 floreks

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Oct 01 '24 08:10 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Oct 31 '24 08:10 k8s-triage-robot