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

Fix: Add filters to replicasets #324

Merged
merged 4 commits into from
Jun 26, 2024
Merged

Fix: Add filters to replicasets #324

merged 4 commits into from
Jun 26, 2024

Conversation

yonahd
Copy link
Owner

@yonahd yonahd commented Jun 24, 2024

What this PR does / why we need it?

This adds the filters to replicasets

PR Checklist

  • This PR adds K8s exceptions (false positives)
  • This PR adds new code
  • This PR includes tests for new/existing code
  • This PR adds docs

GitHub Issue

Closes #318

@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 42.01%. Comparing base (bc2cca8) to head (fb7521c).
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/kor/finalizers.go 0.00% 0 Missing and 1 partial ⚠️
pkg/kor/replicaset.go 0.00% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #324      +/-   ##
==========================================
+ Coverage   41.77%   42.01%   +0.24%     
==========================================
  Files          61       61              
  Lines        3179     3175       -4     
==========================================
+ Hits         1328     1334       +6     
+ Misses       1637     1633       -4     
+ Partials      214      208       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@doronkg
Copy link
Contributor

doronkg commented Jun 24, 2024

Following a quick grep it seems as ReplicaSets is not the only case where SetObject() function is missing:

$ grep -rn 'if pass, _ := filter.Run' pkg/kor/
pkg/kor/clusterroles.go:47:             if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/clusterroles.go:64:             if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/finalizers.go:50:                                       if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/ingresses.go:39:                if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/replicaset.go:25:               if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/roles.go:30:            if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/services.go:34:         if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/statefulsets.go:25:             if pass, _ := filter.Run(filterOpts); pass {

@yonahd
Copy link
Owner Author

yonahd commented Jun 25, 2024

Following a quick grep it seems as ReplicaSets is not the only case where SetObject() function is missing:

$ grep -rn 'if pass, _ := filter.Run' pkg/kor/
pkg/kor/clusterroles.go:47:             if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/clusterroles.go:64:             if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/finalizers.go:50:                                       if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/ingresses.go:39:                if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/replicaset.go:25:               if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/roles.go:30:            if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/services.go:34:         if pass, _ := filter.Run(filterOpts); pass {
pkg/kor/statefulsets.go:25:             if pass, _ := filter.Run(filterOpts); pass {

Good catch. I'll take care of all the references

@yonahd
Copy link
Owner Author

yonahd commented Jun 26, 2024

Removed the filter from areas in the code that are not referring to the actual resource.
The filter logic should apply only to the actual resource and not to wether its orphaned or not

@yonahd yonahd merged commit 181141d into main Jun 26, 2024
1 check passed
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.

Filter flags are not working --older-than , --newer-than
3 participants