Fixes template objects describer
@@ -1008,6 +1008,7 @@ func (d *TemplateDescriber) DescribeParameters(params []templateapi.Parameter, o
formatString(out, indent+"Required", p.Required)
if len(p.Generate) == 0 {
formatString(out, indent+"Value", p.Value)
+ out.Write([]byte("\n"))
continue
}
if len(p.Value) > 0 {
@@ -1038,14 +1039,19 @@ func (d *TemplateDescriber) describeObjects(objects []runtime.Object, out *tabwr
continue
}
- meta := metav1.ObjectMeta{}
- meta.Name, _ = d.MetadataAccessor.Name(obj)
- gvk, _, err := d.ObjectTyper.ObjectKinds(obj)
- if err != nil {
- fmt.Fprintf(out, fmt.Sprintf("%s%s\t%s\n", indent, "<unknown>", meta.Name))
- continue
+ name, _ := d.MetadataAccessor.Name(obj)
+ groupKind := "<unknown>"
+ if gvk, _, err := d.ObjectTyper.ObjectKinds(obj); err == nil {
+ gk := gvk[0].GroupKind()
+ groupKind = gk.String()
+ } else {
+ if unstructured, ok := obj.(*unstructured.Unstructured); ok {
+ gvk := unstructured.GroupVersionKind()
+ gk := gvk.GroupKind()
+ groupKind = gk.String()
+ }
}
- fmt.Fprintf(out, fmt.Sprintf("%s%s\t%s\n", indent, gvk[0].Kind, meta.Name))
+ fmt.Fprintf(out, fmt.Sprintf("%s%s\t%s\n", indent, groupKind, name))
//meta.Annotations, _ = d.MetadataAccessor.Annotations(obj)
//meta.Labels, _ = d.MetadataAccessor.Labels(obj)
/*if len(meta.Labels) > 0 {
@@ -1067,7 +1073,7 @@ func (d *TemplateDescriber) Describe(namespace, name string, settings kprinters.
func (d *TemplateDescriber) DescribeTemplate(template *templateapi.Template) (string, error) {
// TODO: write error?
- _ = runtime.DecodeList(template.Objects, kapi.Codecs.UniversalDecoder(), unstructured.UnstructuredJSONScheme)
+ _ = runtime.DecodeList(template.Objects, unstructured.UnstructuredJSONScheme)
return tabbedString(func(out *tabwriter.Writer) error {
formatMeta(out, template.ObjectMeta)
