Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit 496656c

Browse files
committed
Show route visibility
Only show external address when it differs from the internal address, as it will be the same for cluster-local visibility. Signed-off-by: Scott Andrews <andrewssc@vmware.com>
1 parent 99f3b77 commit 496656c

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/serving/route.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export class RouteSummaryFactory implements ComponentFactory<any> {
133133
toSpecComponent(): Component<any> {
134134
const summary = new SummaryFactory({
135135
sections: [
136+
{ header: "Visibility", content: new TextFactory({ value: (this.route.metadata.labels || {})["serving.knative.dev/visibility"] || "external" }).toComponent() },
136137
{ header: "Traffic Policy", content: new TrafficPolicyTableFactory({ trafficPolicy: this.route.spec.traffic, trafficPolicyStatus: this.route.status.traffic, linker: this.linker }).toComponent() },
137138
],
138139
factoryMetadata: {
@@ -147,12 +148,16 @@ export class RouteSummaryFactory implements ComponentFactory<any> {
147148

148149
let unknown = new TextFactory({ value: '*unknown*', options: { isMarkdown: true } }).toComponent();
149150

151+
const sections = [];
152+
153+
if (status.address?.url !== status.url) {
154+
sections.push({ header: "External Address", content: status.url ? new LinkFactory({ value: status.url, ref: status.url }).toComponent() : unknown });
155+
}
156+
sections.push({ header: "Internal Address", content: status.address?.url ? new LinkFactory({ value: status.address?.url, ref: status.address?.url }).toComponent() : unknown });
157+
sections.push({ header: "Conditions", content: this.toConditionsListComponent() });
158+
150159
const summary = new SummaryFactory({
151-
sections: [
152-
{ header: "External Address", content: status.url ? new LinkFactory({ value: status.url, ref: status.url }).toComponent() : unknown },
153-
{ header: "Internal Address", content: status.address?.url ? new LinkFactory({ value: status.address?.url, ref: status.address?.url }).toComponent() : unknown },
154-
{ header: "Conditions", content: this.toConditionsListComponent() },
155-
],
160+
sections,
156161
factoryMetadata: {
157162
title: [new TextFactory({ value: "Status" }).toComponent()],
158163
},

src/serving/service.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ export class ServiceSummaryFactory implements ComponentFactory<any> {
279279
sections.push({ header: "Volume Mounts", content: volumeMountList(container?.volumeMounts) });
280280
}
281281

282+
sections.push({ header: "Route Visibility", content: new TextFactory({ value: (metadata.labels || {})["serving.knative.dev/visibility"] || "external" }).toComponent() });
282283
sections.push({ header: "Traffic Policy", content: this.toTrafficPolicyComponent() });
283284

284285
const summary = new SummaryFactory({
@@ -296,12 +297,16 @@ export class ServiceSummaryFactory implements ComponentFactory<any> {
296297

297298
let unknown = new TextFactory({ value: '*unknown*', options: { isMarkdown: true } }).toComponent();
298299

300+
const sections = [];
301+
302+
if (status.address?.url !== status.url) {
303+
sections.push({ header: "External Address", content: status.url ? new LinkFactory({ value: status.url, ref: status.url }).toComponent() : unknown });
304+
}
305+
sections.push({ header: "Internal Address", content: status.address?.url ? new LinkFactory({ value: status.address?.url, ref: status.address?.url }).toComponent() : unknown });
306+
sections.push({ header: "Conditions", content: this.toConditionsListComponent() });
307+
299308
const summary = new SummaryFactory({
300-
sections: [
301-
{ header: "External Address", content: status.url ? new LinkFactory({ value: status.url, ref: status.url }).toComponent() : unknown },
302-
{ header: "Internal Address", content: status.address?.url ? new LinkFactory({ value: status.address?.url, ref: status.address?.url }).toComponent() : unknown },
303-
{ header: "Conditions", content: this.toConditionsListComponent() },
304-
],
309+
sections,
305310
factoryMetadata: {
306311
title: [new TextFactory({ value: "Status" }).toComponent()],
307312
},

0 commit comments

Comments
 (0)