mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Lock the output format version based on user input
This commit is contained in:
parent
a8ccb0f99f
commit
dbf28cbe51
@ -68,9 +68,12 @@ Examples:
|
|||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
||||||
if versioned {
|
if versioned {
|
||||||
// TODO Add an --output-version lock which can ensure that regardless of the
|
outputVersion := getFlagString(cmd, "output-version")
|
||||||
// server version, the client output stays the same.
|
if len(outputVersion) == 0 {
|
||||||
obj, err = mapping.ObjectConvertor.ConvertToVersion(obj, mapping.APIVersion)
|
outputVersion = mapping.APIVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
obj, err = mapping.ObjectConvertor.ConvertToVersion(obj, outputVersion)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +83,7 @@ Examples:
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
cmd.Flags().StringP("output", "o", "", "Output format: json|yaml|template|templatefile")
|
cmd.Flags().StringP("output", "o", "", "Output format: json|yaml|template|templatefile")
|
||||||
|
cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version)")
|
||||||
cmd.Flags().Bool("no-headers", false, "When using the default output, don't print headers")
|
cmd.Flags().Bool("no-headers", false, "When using the default output, don't print headers")
|
||||||
cmd.Flags().StringP("template", "t", "", "Template string or path to template file to use when --output=template or --output=templatefile")
|
cmd.Flags().StringP("template", "t", "", "Template string or path to template file to use when --output=template or --output=templatefile")
|
||||||
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
|
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
|
||||||
|
Loading…
Reference in New Issue
Block a user