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

fix(app): only show special message when limits change for existing app resource limit [EE-6837] (#11367)

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2024-03-14 08:45:48 +13:00 committed by GitHub
parent a2a4c85f2d
commit 3b1d853090
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 8 deletions

View file

@ -123,6 +123,10 @@ class KubernetesCreateApplicationController {
persistedFoldersUseExistingVolumes: false,
pullImageValidity: false,
nodePortServices: [],
// when the namespace available resources changes, and the existing app not has a resource limit that exceeds whats available,
// a validation message will be shown. isExistingCPUReservationUnchanged and isExistingMemoryReservationUnchanged (with available resources being exceeded) is used to decide whether to show the message or not.
isExistingCPUReservationUnchanged: false,
isExistingMemoryReservationUnchanged: false,
};
this.isAdmin = this.Authentication.isAdmin();
@ -514,6 +518,13 @@ class KubernetesCreateApplicationController {
return this.$async(async () => {
this.formValues.MemoryLimit = values.memoryLimit;
this.formValues.CpuLimit = values.cpuLimit;
if (this.oldFormValues.CpuLimit !== this.formValues.CpuLimit && this.state.isExistingCPUReservationUnchanged) {
this.state.isExistingCPUReservationUnchanged = false;
}
if (this.oldFormValues.MemoryLimit !== this.formValues.MemoryLimit && this.state.isExistingMemoryReservationUnchanged) {
this.state.isExistingMemoryReservationUnchanged = false;
}
});
}
@ -1063,6 +1074,13 @@ class KubernetesCreateApplicationController {
this.originalServicePorts = structuredClone(this.formValues.Services.flatMap((service) => service.Ports));
this.originalIngressPaths = structuredClone(this.originalServicePorts.flatMap((port) => port.ingressPaths).filter((ingressPath) => ingressPath.Host));
if (this.formValues.CpuLimit) {
this.state.isExistingCPUReservationUnchanged = true;
}
if (this.formValues.MemoryLimit) {
this.state.isExistingMemoryReservationUnchanged = true;
}
if (this.application.ApplicationKind) {
this.state.appType = KubernetesDeploymentTypes[this.application.ApplicationKind.toUpperCase()];
if (this.application.ApplicationKind === KubernetesDeploymentTypes.URL) {