mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
feat(k8s/application): add the ability to set the auto-scale policy of an application (#4118)
* feat(application): add horizontalpodautoscaler creation * feat(application): Add the ability to set the auto-scale policy of an application * feat(k8s/application): minor UI update * fix(application): set api version and prevent to use hpa with global deployment type * feat(settings): add a switch to enable features based on server metrics * feat(k8s/applications): minor UI update Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
909e1ef02c
commit
6756b04b67
16 changed files with 534 additions and 84 deletions
|
@ -9,6 +9,7 @@ import {
|
|||
KubernetesApplicationConfigurationFormValueOverridenKey,
|
||||
KubernetesApplicationPersistedFolderFormValue,
|
||||
KubernetesApplicationPublishedPortFormValue,
|
||||
KubernetesApplicationAutoScalerFormValue,
|
||||
} from 'Kubernetes/models/application/formValues';
|
||||
import {
|
||||
KubernetesApplicationEnvConfigMapPayload,
|
||||
|
@ -263,6 +264,20 @@ class KubernetesApplicationHelper {
|
|||
return finalRes;
|
||||
}
|
||||
|
||||
static generateAutoScalerFormValueFromHorizontalPodAutoScaler(autoScaler) {
|
||||
const res = new KubernetesApplicationAutoScalerFormValue();
|
||||
if (autoScaler) {
|
||||
res.IsUsed = true;
|
||||
res.MinReplicas = autoScaler.MinReplicas;
|
||||
res.MaxReplicas = autoScaler.MaxReplicas;
|
||||
res.TargetCPUUtilization = autoScaler.TargetCPUUtilization;
|
||||
res.ApiVersion = autoScaler.ApiVersion;
|
||||
} else {
|
||||
res.ApiVersion = 'apps/v1';
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* !APPLICATION TO FORMVALUES FUNCTIONS
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue