diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index 9fb8576fb..be5df6edb 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -278,14 +278,13 @@ > -
- -
+ this.formValues, @@ -209,7 +210,7 @@ class KubernetesCreateApplicationController { if (this.formValues.DeploymentType === this.ApplicationDeploymentTypes.Global) { return this.ApplicationTypes.DaemonSet; } - if (this.formValues.PersistedFolders && this.formValues.PersistedFolders.length) { + if (this.formValues.PersistedFolders && this.formValues.PersistedFolders.length && this.formValues.DataAccessPolicy === this.ApplicationDataAccessPolicies.Isolated) { return this.ApplicationTypes.StatefulSet; } return this.ApplicationTypes.Deployment; @@ -365,7 +366,6 @@ class KubernetesCreateApplicationController { this.formValues.PersistedFolders = values; if (values && values.length && !this.supportGlobalDeployment()) { this.onChangeDeploymentType(this.ApplicationDeploymentTypes.Replicated); - return; } this.updateApplicationType(); }); @@ -442,6 +442,13 @@ class KubernetesCreateApplicationController { return true; } + // from the pvcs in the form values, get all selected storage classes and find if they are all support RWX + canSupportSharedAccess() { + const formStorageClasses = this.formValues.PersistedFolders.map((pf) => pf.storageClass); + const isRWXSupported = formStorageClasses.every((sc) => sc.AccessModes.includes('RWX')); + return isRWXSupported; + } + // A StatefulSet is defined by DataAccessPolicy === 'Isolated' isEditAndStatefulSet() { return this.state.isEdit && this.formValues.DataAccessPolicy === this.ApplicationDataAccessPolicies.Isolated; diff --git a/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx b/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx index 258bf3a4f..892ab0521 100644 --- a/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx +++ b/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx @@ -59,9 +59,13 @@ function getOptions( label: 'Shared', description: 'Application will be deployed as a Deployment with a shared storage access', - tooltip: () => - isEdit ? 'Changing the data access policy is not allowed' : '', - disabled: () => isEdit && value !== 'Shared', + tooltip: () => { + if (persistedFoldersUseExistingVolumes) { + return 'Changing the data access policy is not allowed'; + } + return ''; + }, + disabled: () => persistedFoldersUseExistingVolumes, }, ] as const; } diff --git a/app/react/kubernetes/applications/CreateView/deploymentOptions.tsx b/app/react/kubernetes/applications/CreateView/deploymentOptions.tsx deleted file mode 100644 index 3c67db96b..000000000 --- a/app/react/kubernetes/applications/CreateView/deploymentOptions.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Boxes, Sliders } from 'lucide-react'; - -import { BoxSelectorOption } from '@@/BoxSelector'; - -import { DeploymentType } from '../types'; - -export function getDeploymentOptions( - supportGlobalDeployment: boolean -): ReadonlyArray> { - return [ - { - id: 'deployment_replicated', - label: 'Replicated', - value: 'Replicated', - icon: Sliders, - iconType: 'badge', - description: 'Run one or multiple instances of this container', - }, - { - id: 'deployment_global', - disabled: () => !supportGlobalDeployment, - tooltip: () => - !supportGlobalDeployment - ? 'The storage or access policy used for persisted folders cannot be used with this option' - : '', - label: 'Global', - description: - 'Application will be deployed as a DaemonSet with an instance on each node of the cluster', - value: 'Global', - icon: Boxes, - iconType: 'badge', - }, - ] as const; -} diff --git a/app/react/kubernetes/applications/components/AppDeploymentTypeFormSection/AppDeploymentTypeFormSection.tsx b/app/react/kubernetes/applications/components/AppDeploymentTypeFormSection/AppDeploymentTypeFormSection.tsx index 764fb64f0..ce2fbd38b 100644 --- a/app/react/kubernetes/applications/components/AppDeploymentTypeFormSection/AppDeploymentTypeFormSection.tsx +++ b/app/react/kubernetes/applications/components/AppDeploymentTypeFormSection/AppDeploymentTypeFormSection.tsx @@ -1,12 +1,12 @@ +import { Boxes, Sliders } from 'lucide-react'; import { FormikErrors } from 'formik'; -import { BoxSelector } from '@@/BoxSelector'; +import { BoxSelector, BoxSelectorOption } from '@@/BoxSelector'; import { FormSection } from '@@/form-components/FormSection'; import { TextTip } from '@@/Tip/TextTip'; import { FormError } from '@@/form-components/FormError'; import { DeploymentType } from '../../types'; -import { getDeploymentOptions } from '../../CreateView/deploymentOptions'; interface Props { values: DeploymentType; @@ -21,7 +21,7 @@ export function AppDeploymentTypeFormSection({ errors, supportGlobalDeployment, }: Props) { - const options = getDeploymentOptions(supportGlobalDeployment); + const options = getOptions(supportGlobalDeployment); return ( @@ -39,3 +39,32 @@ export function AppDeploymentTypeFormSection({ ); } + +function getOptions( + supportGlobalDeployment: boolean +): ReadonlyArray> { + return [ + { + id: 'deployment_replicated', + label: 'Replicated', + value: 'Replicated', + icon: Sliders, + iconType: 'badge', + description: 'Run one or multiple instances of this container', + }, + { + id: 'deployment_global', + disabled: () => !supportGlobalDeployment, + tooltip: () => + !supportGlobalDeployment + ? 'The storage or access policy used for persisted folders cannot be used with this option' + : '', + label: 'Global', + description: + 'Application will be deployed as a DaemonSet with an instance on each node of the cluster', + value: 'Global', + icon: Boxes, + iconType: 'badge', + }, + ] as const; +} diff --git a/app/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigurationItem.tsx b/app/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigurationItem.tsx index 7c181c549..694a864de 100644 --- a/app/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigurationItem.tsx +++ b/app/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigurationItem.tsx @@ -91,7 +91,7 @@ export function ConfigurationItem({