derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.24k stars 1.7k forks source link

Regex anchors don't work for filtering #2854

Open wholegrainloaf opened 2 months ago

wholegrainloaf commented 2 months ago




Describe the bug When using ^ and $ regex anchors, the filtering no longer works and returns an empty list instead of actually matching on resource names.

To Reproduce Steps to reproduce the behavior:

  1. Go to a resource list
  2. Click on / to start filtering
  3. Enter a regex filter like ^fancyPants
  4. Expect to see resources with names that start with fancyPants, but actually nothing shows up.
  5. Enter a regex filter like fancyPants
  6. Resources with that substring in their name show up, including ones that start with it

Historical Documents N/A

Expected behavior Resources matching the regex should show up since the k9s docs say:

Regex2 supported

Screenshots N/A

Versions (please complete the following information):

Additional context N/A

derailed commented 2 months ago

Resource filtering in k9s is very generic. User may want to filter on name but also ips, nodes, etc... for a given resource. The way search currently works is by flattening out rows and grepping on that. RX anchors tho supported are not effective here given the current strategy.