From 6b21879af2e8bfc06c9616d6a952e788729e5f03 Mon Sep 17 00:00:00 2001 From: Allan Reid Date: Wed, 24 Jan 2024 08:31:13 -0800 Subject: [PATCH] Pass valid securityContext to tenant patch when multiple pools are present. This is necessary to enable editing of pools when multiple are present. --- .../Pools/EditPool/thunks/editPoolAsync.ts | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/web-app/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/thunks/editPoolAsync.ts b/web-app/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/thunks/editPoolAsync.ts index 3c9dfb64fea..ae7e4f15a46 100644 --- a/web-app/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/thunks/editPoolAsync.ts +++ b/web-app/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/thunks/editPoolAsync.ts @@ -23,11 +23,7 @@ import { getDefaultAffinity, getNodeSelector } from "../../../utils"; import { resetEditPoolForm } from "../editPoolSlice"; import { getTenantAsync } from "../../../../thunks/tenantDetailsAsync"; import { api } from "../../../../../../../api"; -import { - Pool, - PoolUpdateRequest, - SecurityContext, -} from "../../../../../../../api/operatorApi"; +import { Pool, PoolUpdateRequest } from "../../../../../../../api/operatorApi"; export const editPoolAsync = createAsyncThunk( "editPool/editPoolAsync", @@ -82,28 +78,31 @@ export const editPoolAsync = createAsyncThunk( const tolerationValues = tolerations.filter( (toleration) => toleration.key.trim() !== "", ); - const cleanPools = tenant?.pools ?.filter((pool) => pool.name !== selectedPool) .map((pool) => { - let securityContextOption: SecurityContext | null = null; - - if (pool.securityContext) { + if (securityContextEnabled && pool.securityContext) { if ( - !!pool.securityContext.runAsUser || - !!pool.securityContext.runAsGroup || - !!pool.securityContext.fsGroup + pool.securityContext.runAsUser || + pool.securityContext.runAsGroup || + pool.securityContext.fsGroup ) { - securityContextOption = { ...pool.securityContext }; + return pool; } } - const request = pool; - if (securityContextOption) { - request.securityContext = securityContextOption!; - } - - return request; + return { + name: pool.name, + servers: pool.servers, + volumes_per_server: pool.volumes_per_server, + volume_configuration: pool.volume_configuration, + resources: pool.resources, + node_selector: pool.node_selector, + affinity: pool.affinity, + runtimeClassName: pool.runtimeClassName, + tolerations: pool.tolerations, + securityContext: undefined, + }; }) as Pool[]; let runtimeClass = {};