1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 22:39:41 +02:00

feat(kubernetes/resource-usage): k8s resource usage for cluster, node and namespace EE-3 EE-1112 (#5301)

* backported resource usage functionality from EE

* utilising view bound endpoint object instead of depracated EndpointProvider

* refactor flatmap

* addressed merge conflict issues
This commit is contained in:
zees-dev 2021-07-28 14:26:03 +12:00 committed by GitHub
parent cee7ac26e9
commit ce31de5e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 188 additions and 30 deletions

View file

@ -3,10 +3,15 @@ import angular from 'angular';
class KubernetesResourceReservationController {
usageValues() {
if (this.cpuLimit) {
this.cpuUsage = Math.round((this.cpu / this.cpuLimit) * 100);
this.cpuReservationPercent = Math.round((this.cpuReservation / this.cpuLimit) * 100);
}
if (this.memoryLimit) {
this.memoryUsage = Math.round((this.memory / this.memoryLimit) * 100);
this.memoryReservationPercent = Math.round((this.memoryReservation / this.memoryLimit) * 100);
}
if (this.displayUsage && this.cpuLimit && this.memoryLimit) {
this.cpuUsagePercent = Math.round((this.cpuUsage / this.cpuLimit) * 100);
this.memoryUsagePercent = Math.round((this.memoryUsage / this.memoryLimit) * 100);
}
}