mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
Make validation optional, handle YAML
This commit is contained in:
@@ -54,6 +54,7 @@ var (
|
||||
json = flag.Bool("json", false, "If true, print raw JSON for responses")
|
||||
yaml = flag.Bool("yaml", false, "If true, print raw YAML for responses")
|
||||
verbose = flag.Bool("verbose", false, "If true, print extra information")
|
||||
validate = flag.Bool("validate", false, "If true, try to validate the passed in object using a swagger schema on the api server")
|
||||
proxy = flag.Bool("proxy", false, "If true, run a proxy to the api server")
|
||||
www = flag.String("www", "", "If -proxy is true, use this directory to serve static files")
|
||||
templateFile = flag.String("template_file", "", "If present, load this file as a golang template and use it for output printing")
|
||||
@@ -159,9 +160,11 @@ func readConfig(storage string, c *client.Client) []byte {
|
||||
}
|
||||
|
||||
dataInput := readConfigData()
|
||||
err := kubecfg.ValidateObject(dataInput, c)
|
||||
if err != nil {
|
||||
glog.Fatalf("Error validating %v as an object for %v: %v\n", *config, storage, err)
|
||||
if *validate {
|
||||
err := kubecfg.ValidateObject(dataInput, c)
|
||||
if err != nil {
|
||||
glog.Fatalf("Error validating %v as an object for %v: %v\n", *config, storage, err)
|
||||
}
|
||||
}
|
||||
data, err := parser.ToWireFormat(dataInput, storage, latest.Codec, serverCodec)
|
||||
|
||||
|
Reference in New Issue
Block a user