-
Notifications
You must be signed in to change notification settings - Fork 184
Conversation
cmd/commands/autofix.go
Outdated
|
||
conf = setConfigFromFlags(cmd, conf) | ||
|
||
allAuditors, err := all.Auditors(conf) |
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.
should I just call it auditors
? or configEnabledAuditors
?
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.
Auditors makes sense to me! This code looks like it's based on the all
command so I think we should change it there too!
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.
Awesome this is very clean!
cmd/commands/autofix.go
Outdated
|
||
conf = setConfigFromFlags(cmd, conf) | ||
|
||
allAuditors, err := all.Auditors(conf) |
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.
Auditors makes sense to me! This code looks like it's based on the all
command so I think we should change it there too!
cmd/commands/autofix.go
Outdated
@@ -35,20 +47,42 @@ func autofix(cmd *cobra.Command, args []string) { | |||
} | |||
} | |||
|
|||
func loadKubeAuditConfigFromFile(configFile string) config.KubeauditConfig { |
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.
This looks like it's based on loadConfigFromFile
from the all
command. I think that function was meant to use configFile
(the passed in parameter) instead of auditAllConfig.configFile
(since the passed in parameter is not used anywhere in the function π€¦ ). I do like loadKubeAuditConfigFromFile
better as a function name though. So I think what we should do is keep this function but replace autofixConfig.kubeauditConfigFile
with configFile
, then remove the loadConfigFromFile
function, and have the auditAll command call this function instead. Wdyt?
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.
totally!! it makes sense! I also failed to notice configFile
wasn't being used! πI will change it and also rename the function!
@@ -263,3 +264,13 @@ To write the fixed manifest to a different file, use the `--outfile/-o` flag: | |||
``` | |||
kubeaudit autofix -f "manifest.yml" -o "fixed.yaml" | |||
``` | |||
|
|||
### Using Custom Rules with Kubeaudit Config File |
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.
Now that two commands support the kubeaudit config maybe we can move the documentation from the all
command (https://github.com/Shopify/kubeaudit/blob/master/docs/all.md#kubeaudit-config) to the home page (https://github.com/Shopify/kubeaudit#configuration-file) and then link there from the all
and autofix
readmes?
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.
good idea!!!
fix.go
Outdated
@@ -1,135 +0,0 @@ | |||
package kubeaudit |
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.
Why is this file removed?
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.
omg! I didn't mean to delete it! π©I'll bring it back!
fixed.yaml
Outdated
@@ -0,0 +1,37 @@ | |||
apiVersion: apps/v1beta2 |
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.
Was this file added intentionally?
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.
noooo! sorry! I made a mistake when going back and forth! I should have reviewed this more carefully before asking for feedback!
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 was supposed to have deleted the yaml and ended up deleting the fix.go by accident instead!
Co-authored-by: Genevieve Luyt <[email protected]>
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.
LGTM!
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.
This looks good to me!
Description
Closes #264
Type of change
How Has This Been Tested?
Checklist: