feat(k8s/application): add default values for auto scaler (#4190)

pull/4192/head
Chaim Lev-Ari 2020-08-11 01:57:20 +03:00 committed by GitHub
parent baaa96f34f
commit a1e3ed7f78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -260,7 +260,7 @@ class KubernetesApplicationConverter {
res.EnvironmentVariables = KubernetesApplicationHelper.generateEnvVariablesFromEnv(app.Env);
res.PersistedFolders = KubernetesApplicationHelper.generatePersistedFoldersFormValuesFromPersistedFolders(app.PersistedFolders, persistentVolumeClaims); // generate from PVC and app.PersistedFolders
res.Configurations = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(app.Env, app.ConfigurationVolumes, configurations);
res.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(app.AutoScaler);
res.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(app.AutoScaler, res.ReplicaCount);
if (app.ServiceType === KubernetesServiceTypes.LOAD_BALANCER) {
res.PublishingType = KubernetesApplicationPublishingTypes.LOAD_BALANCER;

View File

@ -264,7 +264,7 @@ class KubernetesApplicationHelper {
return finalRes;
}
static generateAutoScalerFormValueFromHorizontalPodAutoScaler(autoScaler) {
static generateAutoScalerFormValueFromHorizontalPodAutoScaler(autoScaler, replicasCount) {
const res = new KubernetesApplicationAutoScalerFormValue();
if (autoScaler) {
res.IsUsed = true;
@ -274,6 +274,8 @@ class KubernetesApplicationHelper {
res.ApiVersion = autoScaler.ApiVersion;
} else {
res.ApiVersion = 'apps/v1';
res.MinReplicas = replicasCount;
res.MaxReplicas = replicasCount;
}
return res;
}

View File

@ -733,9 +733,7 @@ class KubernetesCreateApplicationController {
});
}
} else {
this.formValues.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler();
this.formValues.AutoScaler.MinReplicas = this.formValues.ReplicaCount;
this.formValues.AutoScaler.MaxReplicas = this.formValues.ReplicaCount;
this.formValues.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(null, this.formValues.ReplicaCount);
}
await this.updateSliders();