Skip to content

Commit b0b04d6

Browse files
author
Sebastian Florek
authored
Fix external endpoints and add node port information to service details (#940)
1 parent bb51346 commit b0b04d6

File tree

6 files changed

+55
-13
lines changed

6 files changed

+55
-13
lines changed

src/app/backend/resource/common/serviceport.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ type ServicePort struct {
2525

2626
// Protocol name, e.g., TCP or UDP.
2727
Protocol api.Protocol `json:"protocol"`
28+
29+
// The port on each node on which service is exposed.
30+
NodePort int32 `json:"nodePort"`
2831
}
2932

3033
// GetServicePorts returns human readable name for the given service ports list.
3134
func GetServicePorts(apiPorts []api.ServicePort) []ServicePort {
3235
var ports []ServicePort
3336
for _, port := range apiPorts {
34-
ports = append(ports, ServicePort{port.Port, port.Protocol})
37+
ports = append(ports, ServicePort{port.Port, port.Protocol, port.NodePort})
3538
}
3639
return ports
3740
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
.kd-endpoint-icon {
16+
font-size: inherit;
17+
height: inherit;
18+
margin: 0;
19+
vertical-align: middle;
20+
}

src/app/frontend/common/components/endpoint/externalendpoint.html

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,26 @@
2020
Link is always shown independent of the endpoint capabilities to support HTTP.
2121
-->
2222
<div>
23-
<div ng-repeat="port in ::$ctrl.endpoint.ports">
24-
<a href="http://{{::$ctrl.endpoint.host}}:{{::port.port}}" target="_blank"
25-
layout layout-align="start center">
26-
<kd-middle-ellipsis display-string="{{::$ctrl.endpoint.host}}:{{::port.port}}">
27-
</kd-middle-ellipsis>
28-
&nbsp;
29-
<i class="material-icons kd-text-icon">open_in_new</i>
30-
</a>
23+
<div ng-repeat="endpoint in ::$ctrl.endpoints">
24+
<div ng-repeat="port in ::endpoint.ports">
25+
<div>
26+
<a href="http://{{::endpoint.host}}:{{::port.port}}" target="_blank"
27+
layout layout-align="start center">
28+
<kd-middle-ellipsis display-string="{{::endpoint.host}}:{{::port.port}}">
29+
</kd-middle-ellipsis>
30+
&nbsp;
31+
<md-icon class="kd-endpoint-icon">open_in_new</md-icon>
32+
</a>
33+
</div>
34+
<div>
35+
<a href="http://{{::endpoint.host}}:{{::port.nodePort}}" target="_blank"
36+
layout layout-align="start center">
37+
<kd-middle-ellipsis display-string="{{::endpoint.host}}:{{::port.nodePort}}">
38+
</kd-middle-ellipsis>
39+
&nbsp;
40+
<md-icon class="kd-endpoint-icon">open_in_new</md-icon>
41+
</a>
42+
</div>
43+
</div>
3144
</div>
3245
</div>

src/app/frontend/common/components/endpoint/externalendpoint_component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
export const externalEndpointComponent = {
2121
templateUrl: 'common/components/endpoint/externalendpoint.html',
2222
bindings: {
23-
/** {backendApi.Endpoint} */
24-
'endpoint': '<',
23+
/** {!Array<!backendApi.Endpoint>} */
24+
'endpoints': '<',
2525
},
2626
};

src/app/frontend/common/components/endpoint/internalendpoint.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@
2121
display-string="{{::$ctrl.endpoint.host}}:{{::port.port}} {{::port.protocol}}">
2222
</kd-middle-ellipsis>
2323
</div>
24+
<div>
25+
<kd-middle-ellipsis
26+
display-string="{{::$ctrl.endpoint.host}}:{{::port.nodePort}} {{::port.protocol}}">
27+
</kd-middle-ellipsis>
28+
</div>
2429
</div>
2530
</div>

src/app/frontend/servicedetail/servicedetailinfo.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@
5151
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_SERVICE_DETAIL_INTERNAL_ENDPOINTS_LABEL}}" ng-if="::$ctrl.service.internalEndpoint">
5252
<kd-internal-endpoint endpoint="::$ctrl.service.internalEndpoint"></kd-internal-endpoint>
5353
</kd-info-card-entry>
54-
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_SERVICE_DETAIL_EXTERNAL_ENDPOINTS_LABEL}}" ng-if="::$ctrl.detail.externalEndpoints">
55-
<kd-external-endpoint endpoint="::$ctrl.service.internalEndpoint"></kd-external-endpoint>
54+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_SERVICE_DETAIL_EXTERNAL_ENDPOINTS_LABEL}}"
55+
ng-if="::$ctrl.service.externalEndpoints">
56+
<kd-external-endpoint endpoints="::$ctrl.service.externalEndpoints"></kd-external-endpoint>
5657
</kd-info-card-entry>
5758
</kd-info-card-section>
5859
</kd-info-card>

0 commit comments

Comments
 (0)