Skip to content

Commit

Permalink
Fix domain describe reference
Browse files Browse the repository at this point in the history
  • Loading branch information
dsimansk committed Oct 14, 2021
1 parent b1e4132 commit 65471ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/kn/commands/domain/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions pkg/kn/commands/domain/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65471ce

Please sign in to comment.