mirror of https://github.com/portainer/portainer
feat(k8s/application): add default values for auto scaler (#4190)
parent
baaa96f34f
commit
a1e3ed7f78
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue