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
* Remake dry-run=server optional
This is a follow-up on #499 which redoes it without relying on DisableParsing. DisableParsing turned out to break far many things than I imagined!
* Remove redundant test case
* optimze little code
Signed-off-by: yxxhero <[email protected]>
---------
Signed-off-by: yxxhero <[email protected]>
Co-authored-by: yxxhero <[email protected]>
// Note that we can't just move this block to PersistentPreRunE,
158
-
// because cmd.SetArgs(args) does not persist between PersistentPreRunE and RunE.
159
-
// The choice is between:
160
-
// 1. Doing this in RunE
161
-
// 2. Doing this in PersistentPreRunE, saving args somewhere, and calling cmd.SetArgs(args) again in RunE
162
-
// 2 is more complicated without much benefit, so we choose 1.
163
-
{
164
-
const (
165
-
dryRunUsage="--dry-run, --dry-run=client, or --dry-run=true disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation."+
166
-
" --dry-run=server enables the cluster access with helm-get and the lookup template function."
f.BoolVar(&diff.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
294
248
f.BoolVar(&diff.disableValidation, "disable-validation", false, "disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install")
295
249
f.BoolVar(&diff.disableOpenAPIValidation, "disable-openapi-validation", false, "disables rendered templates validation against the Kubernetes OpenAPI Schema")
250
+
f.StringVar(&diff.dryRunMode, "dry-run", "", "--dry-run, --dry-run=client, or --dry-run=true disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation."+
251
+
" --dry-run=server enables the cluster access with helm-get and the lookup template function.")
252
+
f.Lookup("dry-run").NoOptDefVal=dryRunNoOptDefVal
296
253
f.BoolVar(&diff.enableDNS, "enable-dns", false, "enable DNS lookups when rendering templates")
297
254
f.StringVar(&diff.postRenderer, "post-renderer", "", "the path to an executable to be used for post rendering. If it exists in $PATH, the binary will be used, otherwise it will try to look for the executable at the given path")
298
255
f.StringArrayVar(&diff.postRendererArgs, "post-renderer-args", []string{}, "an argument to the post-renderer (can specify multiple)")
0 commit comments