diff --git a/app/kubernetes/converters/application.js b/app/kubernetes/converters/application.js index 93dcf1420..3db3b26d7 100644 --- a/app/kubernetes/converters/application.js +++ b/app/kubernetes/converters/application.js @@ -345,7 +345,7 @@ class KubernetesApplicationConverter { (claims.length === 0 || (claims.length > 0 && formValues.DataAccessPolicy === KubernetesApplicationDataAccessPolicies.Shared && rwx))) || formValues.ApplicationType === KubernetesApplicationTypes.DaemonSet; - const pod = formValues.ApplicationType === KubernetesApplicationTypes.POD; + const pod = formValues.ApplicationType === KubernetesApplicationTypes.Pod; let app; if (deployment) { diff --git a/app/kubernetes/services/applicationService.js b/app/kubernetes/services/applicationService.js index c473f2604..7d43acb23 100644 --- a/app/kubernetes/services/applicationService.js +++ b/app/kubernetes/services/applicationService.js @@ -2,6 +2,7 @@ import _ from 'lodash-es'; import angular from 'angular'; import PortainerError from 'Portainer/error'; +import { KubernetesApplicationDeploymentTypes, KubernetesApplicationTypes } from 'Kubernetes/models/application/models/appConstants'; import KubernetesApplicationHelper from 'Kubernetes/helpers/application'; import KubernetesApplicationConverter from 'Kubernetes/converters/application'; import { KubernetesStatefulSet } from 'Kubernetes/models/stateful-set/models'; @@ -12,7 +13,8 @@ import KubernetesPodConverter from 'Kubernetes/pod/converter'; import { notifyError } from '@/portainer/services/notifications'; import { KubernetesIngressConverter } from 'Kubernetes/ingress/converter'; import { generateNewIngressesFromFormPaths } from '@/react/kubernetes/applications/CreateView/application-services/utils'; -import { KubernetesApplicationDeploymentTypes, KubernetesApplicationTypes } from 'Kubernetes/models/application/models/appConstants'; +import { KubernetesPod } from '../pod/models'; +import { KubernetesApplication } from '../models/application/models'; class KubernetesApplicationService { /* #region CONSTRUCTOR */ @@ -62,7 +64,7 @@ class KubernetesApplicationService { apiService = this.KubernetesDaemonSetService; } else if (app.ApplicationType === KubernetesApplicationTypes.StatefulSet) { apiService = this.KubernetesStatefulSetService; - } else if (app.ApplicationType === KubernetesApplicationTypes.Pod) { + } else if (app instanceof KubernetesPod || (app instanceof KubernetesApplication && app.ApplicationType === KubernetesApplicationTypes.Pod)) { apiService = this.KubernetesPodService; } else { throw new PortainerError('Unable to determine which association to use to retrieve API Service'); diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index 2ef06c764..4f3631ea2 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -203,7 +203,8 @@ class KubernetesCreateApplicationController { if (this.formValues.DeploymentType === this.ApplicationDeploymentTypes.Global) { return this.ApplicationTypes.DaemonSet; } - if (this.formValues.PersistedFolders && this.formValues.PersistedFolders.length && this.formValues.DataAccessPolicy === this.ApplicationDataAccessPolicies.Isolated) { + const persistedFolders = this.formValues.PersistedFolders && this.formValues.PersistedFolders.filter((pf) => !pf.NeedsDeletion); + if (persistedFolders && persistedFolders.length && this.formValues.DataAccessPolicy === this.ApplicationDataAccessPolicies.Isolated) { return this.ApplicationTypes.StatefulSet; } return this.ApplicationTypes.Deployment;