mirror of https://github.com/k3s-io/k3s
[Kubectl]Fix example and annotation in convert
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>pull/6/head
parent
d7e56d5330
commit
a0e06c746f
|
@ -51,7 +51,7 @@ var (
|
||||||
kubectl convert -f pod.yaml
|
kubectl convert -f pod.yaml
|
||||||
|
|
||||||
# Convert the live state of the resource specified by 'pod.yaml' to the latest version
|
# Convert the live state of the resource specified by 'pod.yaml' to the latest version
|
||||||
# and print to stdout in json format.
|
# and print to stdout in JSON format.
|
||||||
kubectl convert -f pod.yaml --local -o json
|
kubectl convert -f pod.yaml --local -o json
|
||||||
|
|
||||||
# Convert all files under current directory to latest version and create them all.
|
# Convert all files under current directory to latest version and create them all.
|
||||||
|
@ -203,7 +203,7 @@ func (o *ConvertOptions) RunConvert() error {
|
||||||
return o.printer.PrintObj(objects, o.out)
|
return o.printer.PrintObj(objects, o.out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectListToVersionedObject receives a list of api objects and a group version
|
// objectListToVersionedObject receives a list of api objects and a group version
|
||||||
// and squashes the list's items into a single versioned runtime.Object.
|
// and squashes the list's items into a single versioned runtime.Object.
|
||||||
func objectListToVersionedObject(objects []runtime.Object, version schema.GroupVersion) (runtime.Object, error) {
|
func objectListToVersionedObject(objects []runtime.Object, version schema.GroupVersion) (runtime.Object, error) {
|
||||||
objectList := &api.List{Items: objects}
|
objectList := &api.List{Items: objects}
|
||||||
|
@ -214,7 +214,7 @@ func objectListToVersionedObject(objects []runtime.Object, version schema.GroupV
|
||||||
return converted, nil
|
return converted, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsVersionedObject converts a list of infos into a single object - either a List containing
|
// asVersionedObject converts a list of infos into a single object - either a List containing
|
||||||
// the objects as children, or if only a single Object is present, as that object. The provided
|
// the objects as children, or if only a single Object is present, as that object. The provided
|
||||||
// version will be preferred as the conversion target, but the Object's mapping version will be
|
// version will be preferred as the conversion target, but the Object's mapping version will be
|
||||||
// used if that version is not present.
|
// used if that version is not present.
|
||||||
|
@ -247,7 +247,7 @@ func asVersionedObject(infos []*resource.Info, forceList bool, version schema.Gr
|
||||||
return object, nil
|
return object, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsVersionedObjects converts a list of infos into versioned objects. The provided
|
// asVersionedObjects converts a list of infos into versioned objects. The provided
|
||||||
// version will be preferred as the conversion target, but the Object's mapping version will be
|
// version will be preferred as the conversion target, but the Object's mapping version will be
|
||||||
// used if that version is not present.
|
// used if that version is not present.
|
||||||
func asVersionedObjects(infos []*resource.Info, version schema.GroupVersion, encoder runtime.Encoder) ([]runtime.Object, error) {
|
func asVersionedObjects(infos []*resource.Info, version schema.GroupVersion, encoder runtime.Encoder) ([]runtime.Object, error) {
|
||||||
|
|
Loading…
Reference in New Issue