You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a flag --admission-create to replicate the old behavior but the
scan now by default run with --dry-run=server so no cleaning is needed.
Shoutout to @smarticu5 for the idea at KubeHuddle 2022!
// create the config that will be passed to every plugins
78
-
config:=&bucket.Config{
79
-
Color: color,
80
-
OutputWidth: outputWidth,
81
-
AdmForce: admForce,
82
-
}
83
-
84
74
// handles the "all" or "a" and erase the args with the bucket list
85
75
// PreRun should guarantee that len(args) != 0 but in case
86
76
iflen(args) !=0 {
@@ -107,7 +97,7 @@ arguments.`,
107
97
for_, name:=rangeargs {
108
98
// initialize the bucket
109
99
ifbuckets.RequiresClient(name) {
110
-
err:=loadContext(config)
100
+
err:=loadContext(&pluginConfig)
111
101
iferr!=nil {
112
102
// loading the context failed and is required so skip this
113
103
// execution after printing the error with the name
@@ -118,7 +108,7 @@ arguments.`,
118
108
continue
119
109
}
120
110
}
121
-
b, err:=buckets.InitBucket(name, *config)
111
+
b, err:=buckets.InitBucket(name, pluginConfig)
122
112
iferr!=nil {
123
113
returnerr
124
114
}
@@ -191,7 +181,11 @@ func init() {
191
181
}
192
182
193
183
digCmd.Flags().StringVarP(&namespace, "namespace", "n", "", "Kubernetes namespace to use. (default to the namespace in the context)")
194
-
digCmd.Flags().BoolVarP(&color, "color", "c", false, "Enable color in output. (default true if output is human)")
195
184
digCmd.Flags().BoolVarP(&sideEffects, "side-effects", "s", false, "Enable all buckets that might have side effect on environment.")
196
-
digCmd.Flags().BoolVarP(&admForce, "admission-force", "", false, "Force creation of pods to scan admission even without cleaning rights. (this flag is specific to the admission bucket)")
185
+
186
+
digCmd.Flags().BoolVarP(&pluginConfig.Color, "color", "c", false, "Enable color in output. (default true if output is human)")
187
+
digCmd.Flags().BoolVarP(&pluginConfig.AdmForce, "admission-force", "", false, "Force creation of pods to scan admission even without cleaning rights. (this flag is specific to the admission bucket)")
188
+
digCmd.Flags().BoolVarP(&pluginConfig.AdmCreate, "admission-create", "", false, "Actually create pods to scan admission instead of using server dry run. (this flag is specific to the admission bucket)")
189
+
// this one is retrieved from the root cmd because applicable to many cmds
0 commit comments