diff --git a/pkg/kn/commands/domain/describe.go b/pkg/kn/commands/domain/describe.go index 44f0fead94..d17bee469e 100644 --- a/pkg/kn/commands/domain/describe.go +++ b/pkg/kn/commands/domain/describe.go @@ -88,7 +88,16 @@ func describe(w io.Writer, domainMapping *v1alpha1.DomainMapping, printDetails b commands.WriteMetadata(dw, &domainMapping.ObjectMeta, printDetails) dw.WriteLine() dw.WriteAttribute("URL", domainMapping.Status.URL.String()) - dw.WriteAttribute("Service", domainMapping.Spec.Ref.Name) + ref := dw.WriteAttribute("Reference", "") + ref.WriteAttribute("APIVersion", domainMapping.Spec.Ref.APIVersion) + ref.WriteAttribute("Kind", domainMapping.Spec.Ref.Kind) + ref.WriteAttribute("Name", domainMapping.Spec.Ref.Name) + if domainMapping.Namespace != domainMapping.Spec.Ref.Namespace { + ref.WriteAttribute("Namespace", domainMapping.Spec.Ref.Namespace) + } + if err := ref.Flush(); err != nil { + return err + } dw.WriteLine() commands.WriteConditions(dw, domainMapping.Status.Conditions, printDetails) if err := dw.Flush(); err != nil { diff --git a/pkg/kn/commands/domain/describe_test.go b/pkg/kn/commands/domain/describe_test.go index 00015efa70..59344e40bd 100644 --- a/pkg/kn/commands/domain/describe_test.go +++ b/pkg/kn/commands/domain/describe_test.go @@ -42,6 +42,9 @@ func TestDomainMappingDescribe(t *testing.T) { assert.Assert(t, cmp.Regexp("Name:\\s+foo.bar", out)) assert.Assert(t, cmp.Regexp("Namespace:\\s+default", out)) assert.Assert(t, util.ContainsAll(out, "URL:", "http://foo.bar")) + assert.Assert(t, cmp.Regexp("Reference:", out)) + assert.Assert(t, cmp.Regexp("Kind:\\s+Service", out)) + assert.Assert(t, cmp.Regexp("Name:\\s+foo", out)) assert.Assert(t, util.ContainsAll(out, "Conditions:", "Ready")) // There're 2 empty lines used in the "describe" formatting