Skip to content

add more detail to specific service types #839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Nov 7, 2016

Related Trello Card:
https://trello.com/c/5dZkZQAX/807-2-details-on-other-service-types-kubernetes-networking

Fixes openshift/origin#5979

This patch adds more detail, such as ingress points and external IPs, to service types
that support these extra fields (LoadBalancer, etc).

add-more-detail-other-svc-types

@spadgett @jwforres

>{{ingress.ip}}<span ng-if="!$last">, </span></span>
</dd>
<dt ng-if="service.spec.externalIPs.length">External IPs</dt>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we want to add endpoints as well for each service?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the CLI show them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is the output for describing a service

$ oc describe svc/loadbalancer
Name:                   loadbalancer
Namespace:              default
Labels:                 app=loadbalancer
Selector:               app=loadbalancer
Type:                   LoadBalancer
IP:                     172.30.162.207
External IPs:           172.46.160.65
LoadBalancer Ingress:   172.46.160.65
Port:                   8080    8080/TCP
NodePort:               8080    30347/TCP
Endpoints:              <none>
Session Affinity:       None
No events.

Copy link
Member

@jwforres jwforres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to run hack/install-deps.sh to get updated dependencies, you have a big diff in your dist files because your deps are out of date

<dt ng-if="resource.status.loadBalancer.ingress.length">Ingress points</dt>
<dd ng-if="resource.status.loadBalancer.ingress.length">
<span ng-repeat="ingress in resource.status.loadBalancer.ingress"
<dt ng-if="service.status.loadBalancer.ingress.length">Ingress points</dt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the : character after the labels for consistency

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juanvallejo Do you mind also changing the labels to headline case like "Ingress Points:" while you're in the file? It looks like I missed a few in #805

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett

Do you mind also changing the labels to headline case like "Ingress Points:" while you're in the file?

Sure, will do

>{{ingress.ip}}<span ng-if="!$last">, </span></span>
</dd>
<dt ng-if="service.spec.externalIPs.length">External IPs</dt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the CLI show them?

@jwforres
Copy link
Member

jwforres commented Nov 7, 2016

what does the output look like when there are endpoints

On Mon, Nov 7, 2016 at 1:18 PM, Juan Vallejo [email protected]
wrote:

@juanvallejo commented on this pull request.

In app/views/browse/service.html
#839:

                       >{{ingress.ip}}<span ng-if="!$last">, </span></span>
                   </dd>
  •                  <dt ng-if="service.spec.externalIPs.length">External IPs</dt>
    

Yeah, this is the output for describing a service

$ oc describe svc/loadbalancer
Name: loadbalancer
Namespace: default
Labels: app=loadbalancer
Selector: app=loadbalancer
Type: LoadBalancer
IP: 172.30.162.207
External IPs: 172.46.160.65
LoadBalancer Ingress: 172.46.160.65
Port: 8080 8080/TCP
NodePort: 8080 30347/TCP
Endpoints:
Session Affinity: None
No events.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#839, or mute the
thread
https://github.com/notifications/unsubscribe-auth/ABZk7Z2OPbBNSjP2JUxao1Tr_7LIWgzIks5q72uFgaJpZM4KrdXt
.

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch 2 times, most recently from f30ac7b to 21aabbd Compare November 7, 2016 18:43
@juanvallejo
Copy link
Contributor Author

@jwforres

what does the output look like when there are endpoints

$ oc describe svc/idling-echo
Name:                   idling-echo
Namespace:              default
Labels:                 app=idling-echo
Selector:               app=idling-echo
Type:                   ClusterIP
IP:                     172.30.205.85
Port:                   tcp-echo        8675/TCP
Endpoints:              172.17.0.8:8675,172.17.0.9:8675
Port:                   udp-echo        3090/UDP
Endpoints:              172.17.0.8:3090,172.17.0.9:3090
Session Affinity:       None
No events.

@jwforres
Copy link
Member

jwforres commented Nov 7, 2016

which are just the IPs of the pods the service is currently sending traffic
to, correct?

I feel like a better approach in the console is to show the list of pods
the service should be sending traffic to and then part of that should be
confirmation of which ones are currently receiving traffic (which ones
actually have endpoints created)

On Mon, Nov 7, 2016 at 1:44 PM, Juan Vallejo [email protected]
wrote:

@jwforres https://github.com/jwforres

what does the output look like when there are endpoints

$ oc describe svc/idling-echo
Name: idling-echo
Namespace: default
Labels: app=idling-echo
Selector: app=idling-echo
Type: ClusterIP
IP: 172.30.205.85
Port: tcp-echo 8675/TCP
Endpoints: 172.17.0.8:8675,172.17.0.9:8675
Port: udp-echo 3090/UDP
Endpoints: 172.17.0.8:3090,172.17.0.9:3090
Session Affinity: None
No events.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#839 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABZk7TzVL-v_6mdXoOExMU7jywAiRv8Wks5q73F1gaJpZM4KrdXt
.

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch 2 times, most recently from eb360d2 to 7e81227 Compare November 8, 2016 19:32
@juanvallejo
Copy link
Contributor Author

juanvallejo commented Nov 8, 2016

@jwforres @spadgett 7e81227 creates a routes table directive and adds it, along with the existing pods table directive, to the service page.

When a service has no routes to display, it reverts to the old behavior of showing create route:

<span ng-if="!routesForService.length">
  <a ng-href="project/{{project.metadata.name}}/create-route?service={{service.metadata.name}}"  ng-if="'routes' | canI : 'create'">Create route</a>
</span>

service-page-no-routes

A service page with routes and pods would look like:
service-page-routes-and-pods

And a service page with pods that have no endpoints looks like this:
service-page-pods-with-warning

@jwforres
Copy link
Member

jwforres commented Nov 9, 2016

It feels like the tables need something to separate them, headers or something. Right now it just feels like a wall of tables :)

@jwforres
Copy link
Member

jwforres commented Nov 9, 2016

I also don't think I would restrict the width on the Route and Pod tables, the only reason we did it on the ports table before was because it looked odd when it stretched the full width


watches.push(DataService.watch("pods", context, function(pods) {
var service = $scope.service;
if (!service) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont request the service here. Instead call getPodsForService either way, and that function should just return if the service hasn't been loaded yet. The serviceResolved method should also call getPodsForService, this way if the service loads after the pods the association will still happen.

function getPodsForService(service, pods) {
$scope.podsForService = [];
var ls = new LabelSelector(service.spec.selector);
angular.forEach(pods.by("metadata.name"), function(pod) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of looping over the pods yourself, just do

$scope.podsForService = ls.select(pods);


watches.push(DataService.watch("endpoints", context, function(endpoints) {
$scope.podsWithEndpoints = {};
angular.forEach(endpoints.by("metadata.name"), function(endpoint) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endpoints.by("metadata.name") returns a map of objects indexed by the metadata name, so iterating over that map is wasting cycles, you can do a direct lookup in that map using $routeParams.service.

To follow our code style use _.each when looping over either arrays or hashes.

You don't need to do undefined checks when trying to find JSON subpaths if you use _.get, see the usage below to get targetRef.Kind

var svcEndpoint = endpoints.by("metadata.name")[$routeParams.service];
if (svcEndpoint) {
  _.each(svcEndpoint.subsets, function(subset) {
    _.each(subset.addresses, function(address) {
      if (_.get(address, "targetRef.Kind") === "Pod") {
        $scope.podsWithEndpoints[address.targetRef.name] = true;
      }
    });
  });
}

>{{ingress.ip}}<span ng-if="!$last">, </span></span>
</dd>
<dt>Routes:</dt>
<dd>
<dt ng-if="service.spec.externalIPs.length">External IPs:</dt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use ng-if-start and ng-if-end when you have consecutive sibling nodes checking the same thing. We have some old code that didn't do this but any new code should. Fix up the other instances in here like ingress above and routes below

ng-if-start="service.spec.externalIPs.length"

<dt>Routes:</dt>
<dd>
<dt ng-if="service.spec.externalIPs.length">External IPs:</dt>
<dd ng-if="service.spec.externalIPs.length">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ng-if-end

<routes-table routes="routesForService" services="services" custom-name-header="routesForService[0].kind"></routes-table>
</div>
<div ng-if="podsForService.length" class="table-responsive small service-table">
<pods-table pods="podsForService" active-pods="podsWithEndpoints" custom-name-header="podsForService[0].kind"></pods-table>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switching to LabelSelector.select is going to return a map, I would just explicitly set custom-name-header to "Pod" and don't worry about trying to use the kind here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwforres Hm, for some reason even when dealing with podsForService as a map, it still allows me to select an item by numerical index, so podsForService[0].kind still returns Pod in this case.

@@ -15,6 +15,10 @@
<tr>
<td data-title="Name">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need customNameHeader here, this is what shows up at mobile screen widths

</tbody>
<tbody ng-repeat="route in routes | orderObjectsByDate : true">
<tr>
<td data-title="Name">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customNameHeader

@juanvallejo
Copy link
Contributor Author

@jwforres Thanks for the feedback! Review comments addressed:

service-page-with-h3-headers

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from a38ca01 to 546a661 Compare November 9, 2016 19:19
@juanvallejo
Copy link
Contributor Author

juanvallejo commented Nov 9, 2016

@jwforres Here is the pods' table updated to display a Receiving Traffic column instead of the warning tooltip

service-page-with-receiving-traffic-column

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from fe814e1 to fa24643 Compare November 9, 2016 22:38
@juanvallejo
Copy link
Contributor Author

juanvallejo commented Nov 11, 2016

@jwforres @spadgett Here is what the page would look like with all three tables of the same width, and a black-and-white check when a pod is receiving traffic (this is not a commit, just dev-tools):

service-page-with-color-traffic-status

EDIT: updated image to replace "yes" / "no" with checks and x's in the pods' table "receiving traffic" column
EDIT2: switched x's and checks in the pods table to use text-success / text-danger

@spadgett
Copy link
Member

I prefer the 100% width of the ports table, but we might need to center the td content so the arrows are centered. @jwforres ?

Suggest just a check or x for receiving traffic without the "yes/no" text.

@jwforres
Copy link
Member

@juanvallejo use the text-success class (green) on the check and the text-danger class (red) on the x

@jwforres
Copy link
Member

If I see I have pods that aren't receiving traffic I probably want to know why. Is it worth having a help tip next to Receiving Traffic that suggests reasons your pod may not be getting any traffic yet?

@spadgett ?

@jwforres
Copy link
Member

I dunno I actually think i like the ports table shorter, it just doesn't have the content to be full width to me.

But I'm starting to wonder if maybe Routes and Pods should be in tabs instead

Just throwing ideas out, but what if we tied in the words Incoming and Outgoing somehow? I feel like there isn't enough context here to someone that doesn't understand how the networking works. How do they know that the Routes are saying what hostnames are pushing traffic to this service and how do they know that services send traffic to pods. I feel like this is an opportunity for us to make this page better.

cc @ajacobs21e

@juanvallejo
Copy link
Contributor Author

@jwforres

Just throwing ideas out, but what if we tied in the words Incoming and Outgoing somehow? I feel like there isn't enough context here to someone that doesn't understand how the networking works. How do they know that the Routes are saying what hostnames are pushing traffic to this service and how do they know that services send traffic to pods.

Maybe we could have cards similar to the overview page to help display this?
An overall card represents a service, with each of its routes displayed as sets (similar to how container information is displayed on the overview) that contain their hostname / other info with arrows pointing towards the pods donut (also similar to how they are displayed on the overview page, but without the "scale up / scale down" arrows), thoughts?

@juanvallejo
Copy link
Contributor Author

@jwforres @spadgett Page with tabs for each table

service-page-tabbed-tables-ports

service-page-tabbed-tables-routes

service-page-tabbed-tables-single-tab

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from f1333b3 to 0359c30 Compare November 16, 2016 16:58
@spadgett
Copy link
Member

I like the tabs now that I've seen it.

Should it be "Routes | Ports | Pods" since that is how the traffic flows?

Are tabs missing from the last screenshot because there are none to show? I'd probably keep the tab and have a message like no routes. Maybe we should put a number with the count in the tab title like we do on the membership page.

@spadgett
Copy link
Member

If I see I have pods that aren't receiving traffic I probably want to know why. Is it worth having a help tip next to Receiving Traffic that suggests reasons your pod may not be getting any traffic yet?

It would be especially helpful if we can say exactly why, for instance when status is ContainerCreating or the container hasn't passed the readiness check. Then have a generic fallback explaining common reasons if we don't know?

@juanvallejo
Copy link
Contributor Author

juanvallejo commented Nov 16, 2016

@spadgett Thanks for the feedback. Here is the same page with each tab displaying the number of resources in each. If a tab has none to show, it displays a warning.

service-page-tabbed-tables-number

Empty table

service-page-with-tabbed-tables-missing-resources

Custom messages if pod not receiving traffic

service-page-custom-traffic-warning

Default traffic warning

service-page-tabbed-tables-default-warning

@ajacobs21e
Copy link

I dunno I actually think i like the ports table shorter, it just doesn't have the content to be full width to me.

Agreed

But I'm starting to wonder if maybe Routes and Pods should be in tabs instead

Tabs within the detail page or tabs between details and events? I am not sure if I like the tabs within tabs. How many rows would we expect each table to have?

Just throwing ideas out, but what if we tied in the words Incoming and Outgoing somehow? I feel like there isn't enough context here to someone that doesn't understand how the networking works. How do they know that the Routes are saying what hostnames are pushing traffic to this service and how do they know that services send traffic to pods. I feel like this is an opportunity for us to make this page better.

As someone that doesn't fully understand networking, this could be helpful. Which word goes where? :)

@jwforres @juanvallejo

@ajacobs21e
Copy link

How are pods, services, routes, and ports related? Maybe understanding those connections will help me suggest a design.

Would a user want to / need to see more than one table at a time to compare data and/or follow the path?

@ajacobs21e
Copy link

With only two tables it's ok to leave both tables on the details page with headers "Traffic" and "Pods"

@juanvallejo
Copy link
Contributor Author

juanvallejo commented Nov 30, 2016

@spadgett @ajacobs21e @jwforres

Thanks again for the feedback. Commit c7b83a2 makes a new traffic-table directive that combines routes and ports for a service. Pods are also shown in the same Details tab, rather than in their own tab.

services-page-dns-to-hostname-learn-more-link-traffic-table

A Learn more link has been added beside the Traffic header that links to Route Types documentation.

service-page-learn-more-link

Routes and Node Ports are shown in the same column. If there are no node ports, they are not shown at all.

service-page-with-route-and-nodeport

If a service has no routes, but does have ports, the same traffic-table directive is re-used, with any missing route information set to none.

service-page-with-ports-and-no-routes

service-page-no-routes-or-ports

The routes-table directive once again has the same original behavior that was introduced in an earlier commit (150bd60) in this PR:

routes-overview-page-routes-table-directive

@jwforres
Copy link
Member

jwforres commented Nov 30, 2016 via email

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from c3f8c98 to c7b83a2 Compare November 30, 2016 20:07
@juanvallejo
Copy link
Contributor Author

juanvallejo commented Nov 30, 2016

@jwforres @spadgett

I think part of what we were saying is that you should not even see "Node
Port" in the header if there are no node ports.

Thanks, updated the last commit to hide Node Port from the header if there are none to show.

service-page-no-nodeport-header

@@ -62,50 +62,48 @@
<dd>{{service.spec.type}}</dd>
<dt>IP:</dt>
<dd>{{service.spec.clusterIP}}</dd>
<dt ng-if-start="service.spec.externalName">External Name</dt>
<dd ng-if-end>{{service.spec.externalName}}</dd>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwforres Added this field to display a service's external name (if any) for the new types of services. https://tcms-openshift.rhcloud.com/case/6047/

PTAL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is external name like a hostname? should this be "External Hostname:"

Either way don't forget the : on the end of the label

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwforres Thanks, updated it to "External Hostname:", image below:

service-page-fields-external-name

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from 0d4e584 to 12f08dd Compare December 1, 2016 21:12
@juanvallejo
Copy link
Contributor Author

@jwforres thanks for the feedback. The traffic and pods tables no longer have the small class name

services-page-bigger-tables-receiving-traffic-tweaks

The Receiving traffic icon is now an x when a pod is not receiving traffic

services-page-receiving-traffic-max

and there is now a footnote that links to the routes docs, and services docs.

@jwforres
Copy link
Member

jwforres commented Dec 6, 2016 via email

@juanvallejo
Copy link
Contributor Author

@jwforres added support for a "footnote" to the traffic table that decreases its bottom margin to bring it closer:

services-page-traffic-table-footer

Added the fa-fw class to both the check and the x icons in the pod's table, but I still think they seem to have different sizes:

services-page-pods-fw

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from cb9421b to a5f6916 Compare December 6, 2016 21:48
@@ -39,11 +39,11 @@
<td data-title="Age"><span am-time-ago="pod.metadata.creationTimestamp" am-without-suffix="true"></span></td>
<td ng-if="activePods" data-title="Receiving Traffic">
<span ng-if="activePods[pod.metadata.name]">
<status-icon status="'Succeeded'" disable-animation></status-icon>
<status-icon fixed-width="true" status="'Succeeded'" disable-animation></status-icon>
</span>
<span ng-if="!activePods[pod.metadata.name]">
<span data-toggle="popover" data-trigger="hover" data-content="{{podFailureReasons[pod.status.phase] || 'This pod has no endpoints and is not accepting traffic.'}}" style="cursor: help; padding-left: 5px;">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think your problem is the padding-left that is on this span, thats what is offsetting this icon compared to the other

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think the padding is needed, try just removing it

Copy link
Member

@jwforres jwforres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not done reviewing yet, but first chunk of feedback

$scope.portsForRoutes = {};
var orderedPorts = $filter("orderBy")(service.spec.ports, "port");

for(var i = 0; i < routes.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't use for loops, we use _.each for all iteration

_.each(routes, function(route) {

});

var orderedPorts = $filter("orderBy")(service.spec.ports, "port");

for(var i = 0; i < routes.length; i++) {
$scope.portsForRoutes[routes[i].metadata.name] = orderedPorts[i];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block doesn't seem right to me. A route can specify what port it uses. You might have multiple routes targeting the same ports on the service. You might have some service ports that have no route associated with it.

var serviceResolved = function(service, action) {
$scope.loaded = true;
$scope.service = service;

getPodsForService(service, $scope.pods);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service and pods are already on the scope, you don't need to pass them into the functions

}));

watches.push(DataService.watch("pods", context, function(pods) {
$scope.pods = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there shouldn't be any reason for converting the pod map to an array, you also probably have no reason to have all pods on the scope, you only care about the pods for the service from within the view. You can use a local variable to the controller to keep track of the full set of pods.


watches.push(DataService.watch("endpoints", context, function(endpoints) {
$scope.podsWithEndpoints = {};
var svcEndpoint = endpoints.by("metadata.name");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would probably just make this a one-liner instead of initializing a variable as a map and then turning it into a singleton

var svcEndpoint = endpoints.by("metadata.name")[$routeParams.service];

@@ -62,50 +62,53 @@
<dd>{{service.spec.type}}</dd>
<dt>IP:</dt>
<dd>{{service.spec.clusterIP}}</dd>
<dt>Hostname:</dt>
<dd>
{{service.metadata.name + '.' + service.metadata.namespace + '.svc'}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't concatenate when it isn't necessary

{{service.metadata.name}}.{{service.metadata.namespace}}.svc

<span ng-repeat="externalIP in service.spec.externalIPs"
>{{externalIP}}<span ng-if="!$last">, </span></span>
</dd>
<dt ng-if="!routesForService.length">Routes:</dt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to ng-if-start

>{{externalIP}}<span ng-if="!$last">, </span></span>
</dd>
<dt ng-if="!routesForService.length">Routes:</dt>
<dd ng-if="!routesForService.length">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ng-if-end

>{{externalIP}}<span ng-if="!$last">, </span></span>
</dd>
<dt ng-if="!routesForService.length">Routes:</dt>
<dd ng-if="!routesForService.length">
<span ng-if="!routesForService.length">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if check is unnecessary, the one above it covers this

>{{externalIP}}<span ng-if="!$last">, </span></span>
</dd>
<dt ng-if="!routesForService.length">Routes:</dt>
<dd ng-if="!routesForService.length">
<span ng-if="!routesForService.length">
<a ng-href="project/{{project.metadata.name}}/create-route?service={{service.metadata.name}}" ng-if="'routes' | canI : 'create'">Create route</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if user doesn't have access to create routes, this should say <em>none</em>

<traffic-table routes="routesForService" ports="portsForRoutes" services="services" show-node-ports="showNodePorts" custom-name-header="routesForService[0].kind" has-footer="true"></traffic-table>
</div>
Learn more about
<span class="learn-more-inline" style="margin-left:0;">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is learn-more-inline actually giving you anything here when you have these links embedded in a sentence? i also don't actually like the external link icon on these links, it looks strange in this context

<a ng-href="{{'services' | helpLink}}" target="_blank">
services <i class="fa fa-external-link"></i>
</a>
</span>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because you have newlines in the template the . is going to have whitespace between it and the previous link

<a href="{{pod | navigateResourceURL}}">{{pod.metadata.name}}</a>
<span ng-if="pod | isTroubledPod">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt we take this out of the pods table in your other PR

<span ng-if="!activePods[pod.metadata.name]">
<span data-toggle="popover" data-trigger="hover" data-content="{{podFailureReasons[pod.status.phase] || 'This pod has no endpoints and is not accepting traffic.'}}" style="cursor: help; padding-left: 5px;">
<span class="fa fa-fw fa-times text-danger" aria-hidden="true" data-toggle="tooltip" style="cursor: help;"></span>
<span class="sr-only">{{pod.status.phase}}</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the phase is not the right sr-only content here, this should probably be either "No" or "Not receiving traffic"

@@ -33,6 +37,17 @@
<td data-title="Ready">{{pod | numContainersReady}}/{{pod.spec.containers.length}}</td>
<td data-title="Restarts">{{pod | numContainerRestarts}}</td>
<td data-title="Age"><span am-time-ago="pod.metadata.creationTimestamp" am-without-suffix="true"></span></td>
<td ng-if="activePods" data-title="Receiving Traffic">
<span ng-if="activePods[pod.metadata.name]">
<status-icon fixed-width="true" status="'Succeeded'" disable-animation></status-icon>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using status-icon here is actually going to cause the sr-only text to say "Succeeded" when really it should be something like "Yes"

@@ -0,0 +1,84 @@
<!-- Table combining routes and ports for a service -->
<table class="table table-bordered table-hover table-mobile" style="{{ hasFooter ? 'margin-bottom:5px;' : ''}}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when i saw hasFooter i expected the footer to actually be part of the directive, not to just change the styles of the table. i would either make the footer part of the directive, or you can use negative margins on the footer.

<thead>
<tr>
<th ng-if="!showNodePorts">{{customNameHeader || 'Route'}}</th>
<th ng-if="showNodePorts">{{customNameHeader || 'Route'}} / Node Port</th>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this will screw up a screen reader making these different <th> elements, when the content can change dynamically, instead I would probably do

<th>{{customNameHeader || 'Route'}}<span ng-if="showNodePorts"> / Node Port</span></th>

<tbody ng-if="(routes | hashSize) == 0 && (ports | hashSize) == 0">
<tr><td colspan="7"><em>{{emptyMessage || 'No routes or ports to show'}}</em></td></tr>
</tbody>
<tbody ng-if="(routes | hashSize) > 0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the route / port iteration and association logic in here isn't right, lets sync up later

</tbody>
<tbody ng-if="(routes | hashSize) > 0">
<tr ng-repeat="route in routes | orderObjectsByDate : true">
<td data-title="{{ customNameHeader || 'Route' }}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this data-title needs to match the column header and include / Node Port when the other one does.

@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch 2 times, most recently from b5e6aad to fee3da9 Compare December 8, 2016 20:09
@juanvallejo
Copy link
Contributor Author

juanvallejo commented Dec 8, 2016

@jwforres thanks for your help and feedback, review comments addressed.

Traffic table now shows each route's information for every service port that it reaches.

service-page-all-ports-for-routes

Ports that have no routes linked to them are also displayed

service-page-ports-without-route

service-page-all-ports-without-route

"No traffic" icon in the pod's table is now aligned properly

service-page-no-traffic-icon-aligned

_.each($scope.service.spec.ports, function(port) {
var reachedByRoute = false;
_.each($scope.routesForService, function(route) {
if(!route.spec.port || route.spec.port.targetPort === port.name ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett you are more familiar with the route / port stuff, can you review this section

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks correct.

_.each($scope.routesForService, function(route) {
if(!route.spec.port || route.spec.port.targetPort === port.name ||
route.spec.port.targetPort === port.targetPort) {
if(!$scope.portsByRoute[route.metadata.name]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually do this if block as a one-liner

$scope.portsByRoute[route.metadata.name] = $scope.portsByRoute[route.metadata.name] || [];

});

if(!reachedByRoute) {
if(!$scope.portsByRoute['']) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$scope.portsByRoute[''] = $scope.portsByRoute[''] || [];


watches.push(DataService.watch("endpoints", context, function(endpoints) {
$scope.podsWithEndpoints = {};
var svcEndpoint = endpoints.by("metadata.name")[$routeParams.service];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a nit but you have an extra whitespace after svcEndpoint

@@ -33,6 +34,18 @@
<td data-title="Ready">{{pod | numContainersReady}}/{{pod.spec.containers.length}}</td>
<td data-title="Restarts">{{pod | numContainerRestarts}}</td>
<td data-title="Age"><span am-time-ago="pod.metadata.creationTimestamp" am-without-suffix="true"></span></td>
<td ng-if="activePods" data-title="Receiving Traffic">
<span ng-if="activePods[pod.metadata.name]">
<span class="fa fa-check text-success" aria-hidden="true"></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing fa-fw

</tr>
<tr ng-repeat-end style="display:none;"></tr>
<tr ng-repeat="port in portsByRoute['']">
<td data-title="{{customNameHeader || 'Route'}}"><span class="text-muted">none</span></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are missing node port for this case

@juanvallejo
Copy link
Contributor Author

@jwforres Thanks, review comments addressed.

NodePort case is now handled when there are 0 or >0 routes

service-page-nodeport

service-page-nodeport-routes

@jwforres
Copy link
Member

jwforres commented Dec 9, 2016

@juanvallejo looks good now, can you squash your commits

Related Trello Card:
https://trello.com/c/5dZkZQAX/807-2-details-on-other-service-types-kubernetes-networking

This patch adds more detail, such as ingress points, to service types
that support these extra fields (LoadBalancer, etc).

It also replaces single-line descriptions, for listing routes and
pods related to the current service, with route and pod table
directives. It adds warning tooltips to the pod table directive to rows
displaying pods with no endpoints.

This patch further adds an optional field to pod and route directives
for setting a custom 'Name' column header value.
@juanvallejo juanvallejo force-pushed the jvallejo/add-detail-other-svc-types branch from c570b50 to 6a6bd16 Compare December 9, 2016 15:39
@juanvallejo
Copy link
Contributor Author

@jwforres

looks good now, can you squash your commits

Thanks! Done

@jwforres
Copy link
Member

jwforres commented Dec 9, 2016

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 6a6bd16

@openshift-bot
Copy link

openshift-bot commented Dec 9, 2016

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/832/) (Base Commit: 1fb702b)

@openshift-bot openshift-bot merged commit 1265ebc into openshift:master Dec 9, 2016
@juanvallejo juanvallejo deleted the jvallejo/add-detail-other-svc-types branch December 9, 2016 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants