diff --git a/app/kubernetes/components/datatables/nodes-datatable/nodesDatatable.html b/app/kubernetes/components/datatables/nodes-datatable/nodesDatatable.html index 7d90d2379..c6526a30e 100644 --- a/app/kubernetes/components/datatables/nodes-datatable/nodesDatatable.html +++ b/app/kubernetes/components/datatables/nodes-datatable/nodesDatatable.html @@ -114,13 +114,9 @@ dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" > - - {{ item.Name }} - - - - {{ item.Name }} + {{ item.Name }} + {{ item.Name }} {{ item.Role }} {{ item.Status }} KubernetesEndpointConverter.apiToEndpoint(item)); + } catch (err) { + throw new PortainerError('Unable to retrieve endpoints', err); + } + } + + get(namespace) { + return this.$async(this.getAllAsync, namespace); + } +} + +export default KubernetesEndpointService; +angular.module('portainer.kubernetes').service('KubernetesEndpointService', KubernetesEndpointService); diff --git a/app/kubernetes/views/cluster/cluster.html b/app/kubernetes/views/cluster/cluster.html index 60bc353ff..ad95331bf 100644 --- a/app/kubernetes/views/cluster/cluster.html +++ b/app/kubernetes/views/cluster/cluster.html @@ -9,6 +9,7 @@
+
+ +
Cluster status
@@ -27,24 +30,50 @@ - - - + + + - - + - -
ComponentStatusErrorComponentStatusError
+
{{ cs.ComponentName }} + healthy unhealthy + {{ cs.ErrorMessage !== '' ? cs.ErrorMessage : '-' }}
+ + + +
+
+ Leader status +
+ + + + + + + + + + + + +
ComponentLeader node
+ {{ ep.Name }} + + {{ ep.HolderIdentity }} +
+
+
diff --git a/app/kubernetes/views/cluster/clusterController.js b/app/kubernetes/views/cluster/clusterController.js index d565c850c..a8ec935c0 100644 --- a/app/kubernetes/views/cluster/clusterController.js +++ b/app/kubernetes/views/cluster/clusterController.js @@ -6,7 +6,17 @@ import { KubernetesResourceReservation } from 'Kubernetes/models/resource-reserv class KubernetesClusterController { /* @ngInject */ - constructor($async, $state, Authentication, Notifications, LocalStorage, KubernetesNodeService, KubernetesApplicationService, KubernetesComponentStatusService) { + constructor( + $async, + $state, + Authentication, + Notifications, + LocalStorage, + KubernetesNodeService, + KubernetesApplicationService, + KubernetesComponentStatusService, + KubernetesEndpointService + ) { this.$async = $async; this.$state = $state; this.Authentication = Authentication; @@ -15,6 +25,7 @@ class KubernetesClusterController { this.KubernetesNodeService = KubernetesNodeService; this.KubernetesApplicationService = KubernetesApplicationService; this.KubernetesComponentStatusService = KubernetesComponentStatusService; + this.KubernetesEndpointService = KubernetesEndpointService; this.onInit = this.onInit.bind(this); this.getNodes = this.getNodes.bind(this); @@ -22,12 +33,13 @@ class KubernetesClusterController { this.getApplicationsAsync = this.getApplicationsAsync.bind(this); this.getComponentStatus = this.getComponentStatus.bind(this); this.getComponentStatusAsync = this.getComponentStatusAsync.bind(this); + this.getEndpointsAsync = this.getEndpointsAsync.bind(this); } async getComponentStatusAsync() { try { - this.ComponentStatuses = await this.KubernetesComponentStatusService.get(); - this.hasUnhealthyComponentStatus = _.find(this.ComponentStatuses, { Healthy: false }) ? true : false; + this.componentStatuses = await this.KubernetesComponentStatusService.get(); + this.hasUnhealthyComponentStatus = _.find(this.componentStatuses, { Healthy: false }) ? true : false; } catch (err) { this.Notifications.error('Failure', err, 'Unable to retrieve cluster component statuses'); } @@ -37,6 +49,19 @@ class KubernetesClusterController { return this.$async(this.getComponentStatusAsync); } + async getEndpointsAsync() { + try { + const endpoints = await this.KubernetesEndpointService.get('kube-system'); + this.endpoints = _.filter(endpoints, (ep) => ep.HolderIdentity); + } catch (err) { + this.Notifications.error('Failure', err, 'Unable to retrieve endpoints'); + } + } + + getEndpoints() { + return this.$async(this.getEndpointsAsync); + } + async getNodesAsync() { try { const nodes = await this.KubernetesNodeService.get(); @@ -92,6 +117,7 @@ class KubernetesClusterController { await this.getNodes(); if (this.isAdmin) { + await this.getEndpoints(); await this.getComponentStatus(); await this.getApplications(); }