mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
feat(cluster): Show the cluster health by showing the status of the underlying cluster components (#4022)
* feat(cluster): add tabs * feat(cluster): add cluster status informations to cluster detail view * feat(cluster): change data display * feat(cluster): prevent regular users to see cluster health * feat(kubernetes): reviewed ComponentStatus handling * refactor(kubernetes): review apiToModel for KubernetesComponentStatus * refactor(kubernetes): remove unused variable * refactor(kubernetes): clean hasUnhealthyComponentStatus code Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
833abb24cb
commit
f765c63c74
6 changed files with 142 additions and 3 deletions
|
@ -6,17 +6,35 @@ import { KubernetesResourceReservation } from 'Kubernetes/models/resource-reserv
|
|||
|
||||
class KubernetesClusterController {
|
||||
/* @ngInject */
|
||||
constructor($async, Authentication, Notifications, KubernetesNodeService, KubernetesApplicationService) {
|
||||
constructor($async, $state, Authentication, Notifications, LocalStorage, KubernetesNodeService, KubernetesApplicationService, KubernetesComponentStatusService) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
this.Authentication = Authentication;
|
||||
this.Notifications = Notifications;
|
||||
this.LocalStorage = LocalStorage;
|
||||
this.KubernetesNodeService = KubernetesNodeService;
|
||||
this.KubernetesApplicationService = KubernetesApplicationService;
|
||||
this.KubernetesComponentStatusService = KubernetesComponentStatusService;
|
||||
|
||||
this.onInit = this.onInit.bind(this);
|
||||
this.getNodes = this.getNodes.bind(this);
|
||||
this.getNodesAsync = this.getNodesAsync.bind(this);
|
||||
this.getApplicationsAsync = this.getApplicationsAsync.bind(this);
|
||||
this.getComponentStatus = this.getComponentStatus.bind(this);
|
||||
this.getComponentStatusAsync = this.getComponentStatusAsync.bind(this);
|
||||
}
|
||||
|
||||
async getComponentStatusAsync() {
|
||||
try {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
getComponentStatus() {
|
||||
return this.$async(this.getComponentStatusAsync);
|
||||
}
|
||||
|
||||
async getNodesAsync() {
|
||||
|
@ -67,12 +85,14 @@ class KubernetesClusterController {
|
|||
this.state = {
|
||||
applicationsLoading: true,
|
||||
viewReady: false,
|
||||
hasUnhealthyComponentStatus: false,
|
||||
};
|
||||
|
||||
this.isAdmin = this.Authentication.isAdmin();
|
||||
|
||||
await this.getNodes();
|
||||
if (this.isAdmin) {
|
||||
await this.getComponentStatus();
|
||||
await this.getApplications();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue