Commit a9aabd76 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #46017 from xilabao/fix-print-of-generic-resources

Automatic merge from submit-queue (batch tested with PRs 44412, 44810, 47130, 46017, 47829) fix self link error of generic resources in describe command **What this PR does / why we need it**: fix Self Link error ``` ./cluster/kubectl.sh describe clusterrole system:controller:ttl-controller Name: system:controller:ttl-controller Namespace: Labels: kubernetes.io/bootstrapping=rbac-defaults Annotations: rbac.authorization.kubernetes.io/autoupdate=true API Version: rbac.authorization.k8s.io/v1alpha1 Kind: ClusterRole Metadata: Creation Timestamp: 2017-05-18T06:42:02Z Resource Version: 80 Self Link: /apis/rbac.authorization.k8s.io/v1alpha1/clusterroles/system%!A(MISSING)controller%!A(MISSING)ttl-controller UID: 19a705a4-3b95-11e7-9d55-7427ea6f0fe3 Rules: API Groups: Resources: nodes Verbs: list patch update watch API Groups: Resources: events Verbs: create patch update Events: <none> ``` **Which issue this PR fixes**: fixes #48743 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 6c1552c5 fa563dce
...@@ -231,7 +231,7 @@ func printUnstructuredContent(w PrefixWriter, level int, content map[string]inte ...@@ -231,7 +231,7 @@ func printUnstructuredContent(w PrefixWriter, level int, content map[string]inte
if slice.ContainsString(skip, skipExpr, nil) { if slice.ContainsString(skip, skipExpr, nil) {
continue continue
} }
w.Write(level, fmt.Sprintf("%s:\n", smartLabelFor(field))) w.Write(level, "%s:\n", smartLabelFor(field))
printUnstructuredContent(w, level+1, typedValue, skipExpr, skip...) printUnstructuredContent(w, level+1, typedValue, skipExpr, skip...)
case []interface{}: case []interface{}:
...@@ -239,13 +239,13 @@ func printUnstructuredContent(w PrefixWriter, level int, content map[string]inte ...@@ -239,13 +239,13 @@ func printUnstructuredContent(w PrefixWriter, level int, content map[string]inte
if slice.ContainsString(skip, skipExpr, nil) { if slice.ContainsString(skip, skipExpr, nil) {
continue continue
} }
w.Write(level, fmt.Sprintf("%s:\n", smartLabelFor(field))) w.Write(level, "%s:\n", smartLabelFor(field))
for _, child := range typedValue { for _, child := range typedValue {
switch typedChild := child.(type) { switch typedChild := child.(type) {
case map[string]interface{}: case map[string]interface{}:
printUnstructuredContent(w, level+1, typedChild, skipExpr, skip...) printUnstructuredContent(w, level+1, typedChild, skipExpr, skip...)
default: default:
w.Write(level+1, fmt.Sprintf("%v\n", typedChild)) w.Write(level+1, "%v\n", typedChild)
} }
} }
...@@ -254,7 +254,7 @@ func printUnstructuredContent(w PrefixWriter, level int, content map[string]inte ...@@ -254,7 +254,7 @@ func printUnstructuredContent(w PrefixWriter, level int, content map[string]inte
if slice.ContainsString(skip, skipExpr, nil) { if slice.ContainsString(skip, skipExpr, nil) {
continue continue
} }
w.Write(level, fmt.Sprintf("%s:\t%v\n", smartLabelFor(field), typedValue)) w.Write(level, "%s:\t%v\n", smartLabelFor(field), typedValue)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment