-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Populate container list to allow filtering #380
base: master
Are you sure you want to change the base?
Populate container list to allow filtering #380
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbaudracco Thank you for this PR. Nice catch! You are correct about adding the containers to the rule.
I think this could use some TLC in terms of drying up the code and testing the actual fix.
Also I think rs are missing from this line up.
@@ -31,6 +32,12 @@ func NewCronJob(co *issues.Collector, db *db.DB) *CronJob { | |||
} | |||
} | |||
|
|||
func CjSpecFor(fqn string, cj *batchv1.CronJob) rules.Spec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be dry-ed up a bit i.e coSpecFor(string, metav1.ObjectMetaAccessor, v1.PodSpec).
Thus we would not need the same impl for any pod resources.
@@ -59,3 +60,54 @@ func TestCronJobLint(t *testing.T) { | |||
assert.Equal(t, `[POP-106] No resources requests/limits defined`, ii[5].Message) | |||
assert.Equal(t, rules.WarnLevel, ii[5].Level) | |||
} | |||
|
|||
func TestCjSpecFor(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests really test the same call. Better would be to have tests that actually show the resolved fix i.e no spinach vs with spinach and show container codes exclusions.
This PR fixes the exclusion of containers not working
Background
When using a spinach file like
I noticed that the relevant containers were not excluded:
After some debugging it appears that this is because the container list is not populated for the appropriate resources: this PR addresses the issue
Todo