1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 13:59:40 +02:00

fix(application): Can't update application with persisted data, after the storage option is disabled on cluster (#4861)

* fix(application): Can't update application with persisted data, after the storage option is disabled on cluster

* refacto(application): Some code extraction requested for better maintenance
This commit is contained in:
Maxime Bajeux 2021-02-22 20:05:43 +01:00 committed by GitHub
parent 93eaccc878
commit cc9dd55b5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View file

@ -462,7 +462,7 @@ class KubernetesCreateApplicationController {
// * The data access policy is set to ISOLATED
supportGlobalDeployment() {
const hasFolders = this.formValues.PersistedFolders.length !== 0;
const hasRWOOnly = _.find(this.formValues.PersistedFolders, (item) => _.isEqual(item.StorageClass.AccessModes, ['RWO']));
const hasRWOOnly = KubernetesApplicationHelper.hasRWOOnly(this.formValues);
const isIsolated = this.formValues.DataAccessPolicy === this.ApplicationDataAccessPolicies.ISOLATED;
if ((hasFolders && hasRWOOnly) || isIsolated) {
@ -483,7 +483,7 @@ class KubernetesCreateApplicationController {
// * The access policy is set to isolated
supportScalableReplicaDeployment() {
const hasFolders = this.formValues.PersistedFolders.length !== 0;
const hasRWOOnly = _.find(this.formValues.PersistedFolders, (item) => _.isEqual(item.StorageClass.AccessModes, ['RWO']));
const hasRWOOnly = KubernetesApplicationHelper.hasRWOOnly(this.formValues);
const isIsolated = this.formValues.DataAccessPolicy === this.ApplicationDataAccessPolicies.ISOLATED;
if (!hasFolders || isIsolated || (hasFolders && !hasRWOOnly)) {
@ -499,7 +499,7 @@ class KubernetesCreateApplicationController {
for (let i = 0; i < this.formValues.PersistedFolders.length; i++) {
const folder = this.formValues.PersistedFolders[i];
if (_.isEqual(folder.StorageClass.AccessModes, ['RWO'])) {
if (folder.StorageClass && _.isEqual(folder.StorageClass.AccessModes, ['RWO'])) {
storageOptions.push(folder.StorageClass.Name);
}
}