-
Notifications
You must be signed in to change notification settings - Fork 40.5k
Add a --short flag to kubectl config view #7007
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
Conversation
7da9c93
to
994cc9b
Compare
@@ -83,6 +85,7 @@ func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command { | |||
|
|||
options.Merge.Default(true) | |||
cmd.Flags().Var(&options.Merge, "merge", "merge together the full hierarchy of kubeconfig files") | |||
cmd.Flags().BoolVar(&options.Short, "short", false, "redact raw data for a shorter, human-readable view") |
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.
redact raw byte data?
Optional nit, the code lgtm. @liggitt Any thoughts on the defaulting. It'd be nice to be able to read the output by default, but changing the default value of |
@@ -106,6 +109,11 @@ func (o ViewOptions) Run(out io.Writer, printer kubectl.ResourcePrinter) error { | |||
} | |||
} | |||
|
|||
if o.Short { | |||
fmt.Printf("short\n") |
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 the extra output? won't this mess up anything expecting structured output, or anything using templated output?
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.
It's intentional. For templates, you won't it shortened. If you're shortening, then the output is no longer a useable kubeconfig, so you don't want it to parse.
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.
Actually it wasn't intentional, just debugging cruft. If we want to make --short
incompatible with -o template
, that should be done explicitly.
Rather than having |
You could try going one step further and actually having |
994cc9b
to
499404d
Compare
@deads2k, @liggitt what do you think of Satnam's idea of using |
d0a3b1e
to
b60fdd3
Compare
@deads2k, PTAL |
caData := "ca" | ||
|
||
config := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, nil) | ||
//config.CurrentContext = "shaker-context" |
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.
delete (looks like leftovers)
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.
done
lgtm |
Defaults to false, unless --flatten is specified. Default behavior (--raw=false) is that byte data (Client{Certificate,Key}data, CertificateAuthorityData) is redacted for a more human-readable view. Useful for manually inspecting files that have embeded data.
b60fdd3
to
fa6ce7b
Compare
Re-running Shippable. |
Can haz merge? |
Add a --short flag to kubectl config view
Defaults to false, when enabled, redacts raw data for a shorter,
human-readable view. Useful for inspecting files that have embeded
data. We may actually want to make the default be --short=true, and
disable it for --flatten.
cc @deads2k, @satnam6502