Add an Endpoints view to the web dashboard#2275
Conversation
siggy
left a comment
There was a problem hiding this comment.
awesome! a couple tioli comments but good to go! 🚢 👍
web/app/js/components/Endpoints.jsx
Outdated
|
|
||
| export default withREST( | ||
| withContext(Endpoints), | ||
| ({api}) => [api.fetchMetrics("/api/endpoints")] |
There was a problem hiding this comment.
not a huge deal but this is adding a window=1m param on the URL, which is not needed/used by /api/endpoints.
There was a problem hiding this comment.
good catch! I think api.fetch is better here
web/app/js/components/Endpoints.jsx
Outdated
| }, | ||
| { | ||
| title: "Resource Version", | ||
| dataIndex: "pod.resourceVersion" |
There was a problem hiding this comment.
tioli perhaps sorting by resource version could be useful in determining pod age / service discovery staleness?
There was a problem hiding this comment.
ohhh that's interesting. I'll add it!
| handler struct { | ||
| render renderTemplate | ||
| apiClient pb.ApiClient | ||
| apiClient public.APIClient |
|
Definitely not a blocker for this PR, but would it be possible to have links for pods/resources/services? Pods and services should link to the detail views and the resource could maybe pull the actual YAML? |
|
@grampelberg oh yeah, that's a good idea, we can easily link to the detail views! |
web/app/js/components/Endpoints.jsx
Outdated
| title: "Resource Version", | ||
| dataIndex: "pod.resourceVersion" | ||
| dataIndex: "pod.resourceVersion", | ||
| sorter: (a, b) => (a.pod.resourceVersion).localeCompare(b.resourceVersion) |
There was a problem hiding this comment.
yeah they are, but maybe I should set numeric: true on the localeCompare so that they are sorted as numbers
dadjeibaah
left a comment
There was a problem hiding this comment.
This looks awesome! Thanks for adding this. What are your thoughts on where this link would reside? Would it be another option in the sidebar? Would it be a link in the Service Mesh page? To me, it feels like this is essentially debug information for the control plane, so it would naturally be somewhere in the Service Mesh page. WDYT?
web/app/js/components/Endpoints.jsx
Outdated
| let pods = []; | ||
| _each(svc.portEndpoints, info => { | ||
| info.podAddresses.forEach(podAddress => { | ||
| podAddress.service = svcName; |
There was a problem hiding this comment.
TIOLI: I think this section here could produce a more "flattened" object. This would forego the need to have nested object traversal in the endpointColumns const.
diff --git a/web/app/js/components/Endpoints.jsx b/web/app/js/components/Endpoints.jsx
index 539f8b09..4f16168d 100644
--- a/web/app/js/components/Endpoints.jsx
+++ b/web/app/js/components/Endpoints.jsx
@@ -21,12 +21,12 @@ const endpointColumns = [
},
{
title: "IP",
- dataIndex: "pod.podIP"
+ dataIndex: "ip"
},
{
title: "Port",
- dataIndex: "addr.port",
- sorter: (a, b) => numericSort(a.addr.port, b.addr.port)
+ dataIndex: "port",
+ sorter: (a, b) => numericSort(a.port, b.port)
},
{
title: "Pod",
@@ -36,8 +36,8 @@ const endpointColumns = [
},
{
title: "Resource Version",
- dataIndex: "pod.resourceVersion",
- sorter: (a, b) => numericSort(a.pod.resourceVersion, b.pod.resourceVersion)
+ dataIndex: "resourceVersion",
+ sorter: (a, b) => numericSort(a.resourceVersion, b.resourceVersion)
},
{
title: "Service",
@@ -80,12 +80,18 @@ class Endpoints extends React.Component {
let pods = [];
_each(svc.portEndpoints, info => {
info.podAddresses.forEach(podAddress => {
- podAddress.service = svcName;
let [podNamespace, podName] = podAddress.pod.name.split("/");
- podAddress.name = podName;
- podAddress.namespace = podNamespace;
- podAddress.pod.resourceVersion = parseInt(podAddress.pod.resourceVersion, 10);
- pods.push(podAddress);
+ let resourceVersion = parseInt(podAddress.pod.resourceVersion, 10);
+ let podIP = podAddress.pod.podIP;
+ let port = podAddress.addr.port;
+ pods.push({
+ service: svcName,
+ name: podName,
+ namespace: podNamespace,
+ resourceVersion: resourceVersion,
+ ip: podIP,
+ port: port
+ });
});
});
return mem.concat(pods);
@@ -101,7 +107,7 @@ class Endpoints extends React.Component {
tableColumns={endpointColumns}
tableClassName="metric-table"
defaultOrderBy="namespace"
- rowKey={r => r.service + r.pod.name}
+ rowKey={r => r.service + r.name}
padding="dense" />
</React.Fragment>
|
@dadjeibaah Yeah! I think this table could fit in the service mesh page! I think it could also be part of a |
|
My preference is for a |
dadjeibaah
left a comment
There was a problem hiding this comment.
This is awesome! Thanks for making these changes! 📦
klingerf
left a comment
There was a problem hiding this comment.
⭐️ New page looks really great!
web/app/js/components/Debug.jsx
Outdated
| control-plane's proxy-api container. Note that this cache of service discovery | ||
| information is populated on-demand via linkerd-proxy requests. No endpoints | ||
| will be found until a linkerd-proxy begins routing | ||
| requests. |
There was a problem hiding this comment.
You have two spaces here between "found" and "until". Might as well move "requests" up a line while you're at it.
| { | ||
| title: "IP", | ||
| dataIndex: "ip" | ||
| }, |
There was a problem hiding this comment.
TIOLI, "IP" is the only column that's not sortable. Would it make sense to add a sorter for it? I think it's also totally fine for it to not be sortable, but in that case I'd recommend removing the sorter from the "Port" column, since it feels pretty similar to this column.
web/app/js/components/Debug.jsx
Outdated
| {this.banner()} | ||
| <Typography variant="h6">Endpoints</Typography> | ||
| <Typography> | ||
| This table allow you to see Linkerd's service discovery state. It provides |
There was a problem hiding this comment.
Typo here: allow => allows
klingerf
left a comment
There was a problem hiding this comment.
⭐️ Great, thanks for updating!
scottcarol
left a comment
There was a problem hiding this comment.
The changes look great - everything worked when I ran it locally!

In #2195 we introduced
linkerd endpointson the CLI. I would like similar information to be on the web.This PR adds an api endpoint at
/api/endpoints, and introduces a new page with a table that is the same as the CLI table, available at/endpointsbut currently not linked in the nav.