Skip to content

Commit af4e89f

Browse files
committed
Show router canonical hostname on route page
If the route has a custom hostname and the router has a canonical hostname configured, show a message on the route page about setting up the DNS CNAME record.
1 parent 9989eef commit af4e89f

File tree

7 files changed

+76
-51
lines changed

7 files changed

+76
-51
lines changed

app/scripts/filters/resources.js

+5
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,11 @@ angular.module('openshiftConsole')
11451145
return nameFormatMap[resourceType] || resourceType;
11461146
};
11471147
})
1148+
.filter('routeHasCustomHost', function(annotationFilter) {
1149+
return function(route) {
1150+
return annotationFilter(route, "openshift.io/host.generated") !== "true";
1151+
};
1152+
})
11481153
.filter('routeTargetPortMapping', function(RoutesService) {
11491154
var portDisplayValue = function(servicePort, containerPort, protocol) {
11501155
servicePort = servicePort || "<unknown>";

app/scripts/services/routes.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ angular.module("openshiftConsole")
9292
});
9393
};
9494

95-
var isCustomHost = function(route) {
96-
return $filter('annotation')(route, "openshift.io/host.generated") !== "true";
97-
};
95+
var isCustomHost = $filter('routeHasCustomHost');
9896

9997
// Gets a score for the route to decide which to show on the overview.
10098
var scoreRoute = function(route) {

app/styles/_core.less

+5
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ mark {
200200
}
201201
}
202202

203+
.route-status .h3 {
204+
margin-top: 0;
205+
margin-bottom: 5px;
206+
}
207+
203208
.deployment-config-summary {
204209
.gutter-bottom();
205210
}

app/views/browse/route.html

+36-28
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,43 @@ <h1 class="contains-actions">
5252
<div class="row" ng-if="route">
5353
<div class="col-sm-12">
5454
<div class="resource-details">
55-
<dl class="dl-horizontal left">
56-
<dt>Hostname<span ng-if="route.status.ingress.length > 1">s</span>:</dt>
57-
<dd>
58-
<span ng-if="!route.status.ingress">
59-
{{route | routeLabel : null : true}}
60-
<span data-toggle="popover" data-trigger="hover" data-content="The route is not accepting traffic yet because it has not been admitted by a router." style="cursor: help; padding-left: 5px;">
61-
<status-icon status="'Pending'"></status-icon>
62-
<span class="sr-only">Pending</span>
63-
</span>
55+
<div ng-if="!route.status.ingress" class="route-status">
56+
<span class="h3">
57+
{{route | routeLabel : null : true}}
58+
</span>
59+
<div class="meta">
60+
<status-icon status="'Pending'"></status-icon>
61+
The route is not accepting traffic yet because it has not been admitted by a router.
62+
</div>
63+
</div>
64+
<div ng-repeat="ingress in route.status.ingress" ng-init="admittedCondition = (ingress | routeIngressCondition : 'Admitted')" class="route-status">
65+
<div class="h3">
66+
<span ng-if="(route | isWebRoute)">
67+
<a ng-href="{{route | routeWebURL : ingress.host}}" target="_blank">{{route | routeLabel : ingress.host : true}}</a>
6468
</span>
65-
<div ng-repeat="ingress in route.status.ingress">
66-
<span ng-if="(route | isWebRoute)">
67-
<a ng-href="{{route | routeWebURL : ingress.host}}" target="_blank">{{route | routeLabel : ingress.host : true}}</a>
68-
</span>
69-
<span ng-if="!(route | isWebRoute)">
70-
{{route | routeLabel : ingress.host}}
71-
</span>
72-
&ndash;
73-
<span ng-init="admittedCondition = (ingress | routeIngressCondition : 'Admitted')">
74-
<span ng-if="!admittedCondition">admission status unknown for router '{{ingress.routerName}}'</span>
75-
<span ng-if="admittedCondition.status === 'True'">
76-
exposed on router '{{ingress.routerName}}' <span am-time-ago="admittedCondition.lastTransitionTime"></span>
77-
</span>
78-
<span ng-if="admittedCondition.status === 'False'">
79-
rejected by router '{{ingress.routerName}}' <span am-time-ago="admittedCondition.lastTransitionTime"></span>
80-
</span>
81-
</span>
82-
</div>
83-
</dd>
69+
<span ng-if="!(route | isWebRoute)">
70+
{{route | routeLabel : ingress.host}}
71+
</span>
72+
</div>
73+
<div class="meta">
74+
<span ng-if="!admittedCondition">Admission status unknown for router '{{ingress.routerName}}'</span>
75+
<span ng-if="admittedCondition.status === 'True'">
76+
<status-icon status="'Succeeded'"></status-icon>
77+
Exposed on router '{{ingress.routerName}}' <span am-time-ago="admittedCondition.lastTransitionTime"></span>
78+
</span>
79+
<span ng-if="admittedCondition.status === 'False'">
80+
<status-icon status="'Error'"></status-icon>
81+
Rejected by router '{{ingress.routerName}}' <span am-time-ago="admittedCondition.lastTransitionTime"></span>
82+
</span>
83+
</div>
84+
<div ng-if="(route | routeHasCustomHost) && ingress.routerCanonicalHostname" class="help-block">
85+
The DNS admin should set up a CNAME from the route's hostname, {{route.spec.host}},
86+
to the router's canonical hostname, {{ingress.routerCanonicalHostname}}.
87+
</div>
88+
</div>
89+
90+
<h4 class="mar-top-xl">Details</h4>
91+
<dl class="dl-horizontal left">
8492
<dt ng-if-start="route.spec.wildcardPolicy && route.spec.wildcardPolicy !== 'None' && route.spec.wildcardPolicy !== 'Subdomain'">Wildcard Policy:</dt>
8593
<dd ng-if-end>{{route.spec.wildcardPolicy}}</dd>
8694
<dt>Path:</dt>

dist/scripts/scripts.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -3360,9 +3360,7 @@ type:"Admitted",
33603360
status:"True"
33613361
});
33623362
});
3363-
}, h = function(b) {
3364-
return "true" !== a("annotation")(b, "openshift.io/host.generated");
3365-
}, i = function(a) {
3363+
}, h = a("routeHasCustomHost"), i = function(a) {
33663364
var b = 0;
33673365
g(a) && (b += 11);
33683366
var c = _.get(a, "spec.alternateBackends");
@@ -14377,7 +14375,11 @@ resourcequotas:"resource quotas",
1437714375
};
1437814376
return b ? c[a] || a :d[a] || a;
1437914377
};
14380-
}).filter("routeTargetPortMapping", [ "RoutesService", function(a) {
14378+
}).filter("routeHasCustomHost", [ "annotationFilter", function(a) {
14379+
return function(b) {
14380+
return "true" !== a(b, "openshift.io/host.generated");
14381+
};
14382+
} ]).filter("routeTargetPortMapping", [ "RoutesService", function(a) {
1438114383
var b = function(a, b, c) {
1438214384
a = a || "<unknown>", b = b || "<unknown>";
1438314385
var d = "Service Port " + a + " → Container Port " + b;

dist/scripts/templates.js

+22-16
Original file line numberDiff line numberDiff line change
@@ -3635,35 +3635,41 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
36353635
"<div class=\"row\" ng-if=\"route\">\n" +
36363636
"<div class=\"col-sm-12\">\n" +
36373637
"<div class=\"resource-details\">\n" +
3638-
"<dl class=\"dl-horizontal left\">\n" +
3639-
"<dt>Hostname<span ng-if=\"route.status.ingress.length > 1\">s</span>:</dt>\n" +
3640-
"<dd>\n" +
3641-
"<span ng-if=\"!route.status.ingress\">\n" +
3638+
"<div ng-if=\"!route.status.ingress\" class=\"route-status\">\n" +
3639+
"<span class=\"h3\">\n" +
36423640
"{{route | routeLabel : null : true}}\n" +
3643-
"<span data-toggle=\"popover\" data-trigger=\"hover\" data-content=\"The route is not accepting traffic yet because it has not been admitted by a router.\" style=\"cursor: help; padding-left: 5px\">\n" +
3644-
"<status-icon status=\"'Pending'\"></status-icon>\n" +
3645-
"<span class=\"sr-only\">Pending</span>\n" +
36463641
"</span>\n" +
3647-
"</span>\n" +
3648-
"<div ng-repeat=\"ingress in route.status.ingress\">\n" +
3642+
"<div class=\"meta\">\n" +
3643+
"<status-icon status=\"'Pending'\"></status-icon>\n" +
3644+
"The route is not accepting traffic yet because it has not been admitted by a router.\n" +
3645+
"</div>\n" +
3646+
"</div>\n" +
3647+
"<div ng-repeat=\"ingress in route.status.ingress\" ng-init=\"admittedCondition = (ingress | routeIngressCondition : 'Admitted')\" class=\"route-status\">\n" +
3648+
"<div class=\"h3\">\n" +
36493649
"<span ng-if=\"(route | isWebRoute)\">\n" +
36503650
"<a ng-href=\"{{route | routeWebURL : ingress.host}}\" target=\"_blank\">{{route | routeLabel : ingress.host : true}}</a>\n" +
36513651
"</span>\n" +
36523652
"<span ng-if=\"!(route | isWebRoute)\">\n" +
36533653
"{{route | routeLabel : ingress.host}}\n" +
36543654
"</span>\n" +
3655-
"&ndash;\n" +
3656-
"<span ng-init=\"admittedCondition = (ingress | routeIngressCondition : 'Admitted')\">\n" +
3657-
"<span ng-if=\"!admittedCondition\">admission status unknown for router '{{ingress.routerName}}'</span>\n" +
3655+
"</div>\n" +
3656+
"<div class=\"meta\">\n" +
3657+
"<span ng-if=\"!admittedCondition\">Admission status unknown for router '{{ingress.routerName}}'</span>\n" +
36583658
"<span ng-if=\"admittedCondition.status === 'True'\">\n" +
3659-
"exposed on router '{{ingress.routerName}}' <span am-time-ago=\"admittedCondition.lastTransitionTime\"></span>\n" +
3659+
"<status-icon status=\"'Succeeded'\"></status-icon>\n" +
3660+
"Exposed on router '{{ingress.routerName}}' <span am-time-ago=\"admittedCondition.lastTransitionTime\"></span>\n" +
36603661
"</span>\n" +
36613662
"<span ng-if=\"admittedCondition.status === 'False'\">\n" +
3662-
"rejected by router '{{ingress.routerName}}' <span am-time-ago=\"admittedCondition.lastTransitionTime\"></span>\n" +
3663-
"</span>\n" +
3663+
"<status-icon status=\"'Error'\"></status-icon>\n" +
3664+
"Rejected by router '{{ingress.routerName}}' <span am-time-ago=\"admittedCondition.lastTransitionTime\"></span>\n" +
36643665
"</span>\n" +
36653666
"</div>\n" +
3666-
"</dd>\n" +
3667+
"<div ng-if=\"(route | routeHasCustomHost) && ingress.routerCanonicalHostname\" class=\"help-block\">\n" +
3668+
"The DNS admin should set up a CNAME from the route's hostname, {{route.spec.host}}, to the router's canonical hostname, {{ingress.routerCanonicalHostname}}.\n" +
3669+
"</div>\n" +
3670+
"</div>\n" +
3671+
"<h4 class=\"mar-top-xl\">Details</h4>\n" +
3672+
"<dl class=\"dl-horizontal left\">\n" +
36673673
"<dt ng-if-start=\"route.spec.wildcardPolicy && route.spec.wildcardPolicy !== 'None' && route.spec.wildcardPolicy !== 'Subdomain'\">Wildcard Policy:</dt>\n" +
36683674
"<dd ng-if-end>{{route.spec.wildcardPolicy}}</dd>\n" +
36693675
"<dt>Path:</dt>\n" +

dist/styles/main.css

+1
Original file line numberDiff line numberDiff line change
@@ -3790,6 +3790,7 @@ mark{padding:0;background-color:rgba(252,248,160,.5)}
37903790
.build-config-summary .h3,.deployment-config-summary .h3{margin-bottom:0}
37913791
.build-config-summary .last-status,.deployment-config-summary .last-status{margin-right:5px}
37923792
.build-config-summary .last-timestamp,.deployment-config-summary .last-timestamp{margin-left:25px}
3793+
.route-status .h3{margin-top:0;margin-bottom:5px}
37933794
.deployment-config-summary{padding-bottom:20px}
37943795
.deployment-config-summary.gutter-bottom-2x{padding-bottom:40px}
37953796
.registry-image-pull{margin-bottom:20px}

0 commit comments

Comments
 (0)