diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index f3fb11f3d..c7c03b8c3 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -564,6 +564,7 @@ query consoleGetNodePool($clusterName: String!, $poolName: String!) { } creationTime displayName + stateful kind lastUpdatedBy { userEmail @@ -663,6 +664,7 @@ query consoleListNodePools($clusterName: String!, $search: SearchNodepool, $pagi } creationTime displayName + stateful lastUpdatedBy { userEmail userId diff --git a/src/apps/console/routes/_main+/$account+/infra+/$cluster+/nodepools/handle-nodepool.tsx b/src/apps/console/routes/_main+/$account+/infra+/$cluster+/nodepools/handle-nodepool.tsx index 1c4366ffe..72a75bedd 100644 --- a/src/apps/console/routes/_main+/$account+/infra+/$cluster+/nodepools/handle-nodepool.tsx +++ b/src/apps/console/routes/_main+/$account+/infra+/$cluster+/nodepools/handle-nodepool.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/destructuring-assignment */ import { useMemo } from 'react'; import { toast } from 'react-toastify'; -import { NumberInput } from '~/components/atoms/input'; +import {NumberInput, TextInput} from '~/components/atoms/input'; import Select from '~/components/atoms/select'; import Popup from '~/components/molecule/popup'; import { useConsoleApi } from '~/console/server/gql/api-provider'; @@ -53,6 +53,7 @@ const Root = (props: IDialog) => { taints: [], autoScale: props.data.spec.minCount !== props.data.spec.maxCount, isNameError: false, + stateful: props.data.stateful || false } : { nvidiaGpuEnabled: false, @@ -72,6 +73,7 @@ const Root = (props: IDialog) => { labels: [], taints: [], isNameError: false, + stateful: false }, validationSchema: Yup.object({ name: Yup.string().required('id is required'), @@ -155,6 +157,7 @@ const Root = (props: IDialog) => { cloudProvider: 'aws', ...getNodeConf(), }, + stateful: val.stateful || false }, }); if (e) { @@ -174,6 +177,7 @@ const Root = (props: IDialog) => { minCount: Number.parseInt(val.minimum, 10), ...getNodeConf(), }, + stateful: val.stateful || false }, }); if (e) { @@ -217,79 +221,98 @@ const Root = (props: IDialog) => { /> {cloudProvider === 'aws' && ( - <> - provisionTypes} + onChange={(_, value) => { + handleChange('poolType')(dummyEvent(value)); + }} + /> + + - mapper( - awsRegions.find((v) => v.Name === clusterRegion)?.Zones || - [], - (v) => ({ - value: v, - label: v, - }) - ) - } - onChange={(_, v) => { - handleChange('awsAvailabilityZone')(dummyEvent(v)); - }} - /> +
+
+
+ { - const plan = findNodePlan(values.instanceType); - return plan?.value; - }, [values.instanceType])} - label="Node plan" - options={async () => nodePlans} - onChange={(value) => { - handleChange('instanceType')(dummyEvent(value.value)); - handleChange('nvidiaGpuEnabled')( - dummyEvent(!!value.gpuEnabled) - ); - }} - /> - +
+
Stateful
+
+ { + handleChange('stateful')(dummyEvent(val)); + }} + /> +
+
+
+ )}
{ - handleChange('minimum')(e); - if (!values.autoScale) { - handleChange('maximum')(e); - } - }} + label={values.autoScale ? 'Min Node Count' : `Node Count`} + placeholder="Minimum" + value={values.minimum} + error={!!errors.minimum} + message={errors.minimum} + onChange={(e) => { + handleChange('minimum')(e); + if (!values.autoScale) { + handleChange('maximum')(e); + } + }} />
{values.autoScale && ( -
- +
)} diff --git a/src/apps/console/server/gql/queries/nodepool-queries.ts b/src/apps/console/server/gql/queries/nodepool-queries.ts index 912ab97b1..dcf8d4818 100644 --- a/src/apps/console/server/gql/queries/nodepool-queries.ts +++ b/src/apps/console/server/gql/queries/nodepool-queries.ts @@ -29,6 +29,7 @@ export const nodepoolQueries = (executor: IExecutor) => ({ } creationTime displayName + stateful kind lastUpdatedBy { userEmail @@ -157,6 +158,7 @@ export const nodepoolQueries = (executor: IExecutor) => ({ } creationTime displayName + stateful lastUpdatedBy { userEmail userId diff --git a/src/generated/gql/sdl.graphql b/src/generated/gql/sdl.graphql index 7d5c66ddc..09fc85dd4 100644 --- a/src/generated/gql/sdl.graphql +++ b/src/generated/gql/sdl.graphql @@ -3020,6 +3020,7 @@ type NodePool { metadata: Metadata recordVersion: Int! spec: Github__com___kloudlite___operator___apis___clusters___v1__NodePoolSpec! + stateful: Boolean! status: Github__com___kloudlite___operator___pkg___operator__Status syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatus! updateTime: Date! @@ -3036,6 +3037,7 @@ input NodePoolIn { kind: String metadata: MetadataIn spec: Github__com___kloudlite___operator___apis___clusters___v1__NodePoolSpecIn! + stateful: Boolean! } type NodePoolPaginatedRecords { @@ -3475,6 +3477,7 @@ input SearchNamespaces { } input SearchNodepool { + isStateful: MatchFilterIn text: MatchFilterIn } diff --git a/src/generated/gql/server.ts b/src/generated/gql/server.ts index 3bfec033a..a233bef13 100644 --- a/src/generated/gql/server.ts +++ b/src/generated/gql/server.ts @@ -318,6 +318,7 @@ export type SearchNamespaces = { }; export type SearchNodepool = { + isStateful?: InputMaybe; text?: InputMaybe; }; @@ -961,6 +962,7 @@ export type NodePoolIn = { kind?: InputMaybe; metadata?: InputMaybe; spec: Github__Com___Kloudlite___Operator___Apis___Clusters___V1__NodePoolSpecIn; + stateful: Scalars['Boolean']['input']; }; export type Github__Com___Kloudlite___Operator___Apis___Clusters___V1__NodePoolSpecIn = @@ -2014,6 +2016,7 @@ export type ConsoleGetNodePoolQuery = { clusterName: string; creationTime: any; displayName: string; + stateful: boolean; kind?: string; markedForDeletion?: boolean; updateTime: any; @@ -2101,6 +2104,7 @@ export type ConsoleListNodePoolsQuery = { clusterName: string; creationTime: any; displayName: string; + stateful: boolean; markedForDeletion?: boolean; recordVersion: number; updateTime: any;