Skip to content

Commit

Permalink
Merge pull request #112 from kloudlite/update/nodepool-type
Browse files Browse the repository at this point in the history
fix(web/nodepool): remove stateful type as extra field
  • Loading branch information
nxtcoder17 authored Mar 4, 2024
2 parents fd237e8 + b4a641c commit ba52010
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions web/gql-queries-generator/doc/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ query consoleGetNodePool($clusterName: String!, $poolName: String!) {
}
creationTime
displayName
stateful
kind
lastUpdatedBy {
userEmail
Expand Down Expand Up @@ -614,6 +613,7 @@ query consoleGetNodePool($clusterName: String!, $poolName: String!) {
cloudProvider
maxCount
minCount
nodeLabels
}
status {
checks
Expand Down Expand Up @@ -664,7 +664,6 @@ query consoleListNodePools($clusterName: String!, $search: SearchNodepool, $pagi
}
creationTime
displayName
stateful
lastUpdatedBy {
userEmail
userId
Expand Down Expand Up @@ -707,6 +706,7 @@ query consoleListNodePools($clusterName: String!, $search: SearchNodepool, $pagi
cloudProvider
maxCount
minCount
nodeLabels
}
status {
checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Switch } from '~/components/atoms/switch';
import { NameIdView } from '~/console/components/name-id-view';
import { findNodePlan, nodePlans, provisionTypes } from './nodepool-utils';
import { IClusterContext } from '../_layout';
import {keyconstants} from "~/console/server/r-utils/key-constants";

type IDialog = IDialogBase<ExtractNodeType<INodepools>>;

Expand Down Expand Up @@ -53,7 +54,7 @@ const Root = (props: IDialog) => {
taints: [],
autoScale: props.data.spec.minCount !== props.data.spec.maxCount,
isNameError: false,
stateful: props.data.stateful || false
stateful: props.data.spec.nodeLabels[keyconstants.nodepoolStateType] || false
}
: {
nvidiaGpuEnabled: false,
Expand Down Expand Up @@ -155,9 +156,11 @@ const Root = (props: IDialog) => {
maxCount: Number.parseInt(val.maximum, 10),
minCount: Number.parseInt(val.minimum, 10),
cloudProvider: 'aws',
nodeLabels: {
[keyconstants.nodepoolStateType]: val.stateful ? "stateful" : "stateless"
},
...getNodeConf(),
},
stateful: val.stateful || false
},
});
if (e) {
Expand All @@ -173,11 +176,14 @@ const Root = (props: IDialog) => {
},
spec: {
...props.data.spec,
nodeLabels: {
...(props.data.spec.nodeLabels || {}),
[keyconstants.nodepoolStateType]: val.stateful ? "stateful" : "stateless"
},
maxCount: Number.parseInt(val.maximum, 10),
minCount: Number.parseInt(val.minimum, 10),
...getNodeConf(),
},
stateful: val.stateful || false
},
});
if (e) {
Expand Down
4 changes: 2 additions & 2 deletions web/src/apps/console/server/gql/queries/nodepool-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const nodepoolQueries = (executor: IExecutor) => ({
}
creationTime
displayName
stateful
kind
lastUpdatedBy {
userEmail
Expand Down Expand Up @@ -79,6 +78,7 @@ export const nodepoolQueries = (executor: IExecutor) => ({
cloudProvider
maxCount
minCount
nodeLabels
}
status {
checks
Expand Down Expand Up @@ -158,7 +158,6 @@ export const nodepoolQueries = (executor: IExecutor) => ({
}
creationTime
displayName
stateful
lastUpdatedBy {
userEmail
userId
Expand Down Expand Up @@ -201,6 +200,7 @@ export const nodepoolQueries = (executor: IExecutor) => ({
cloudProvider
maxCount
minCount
nodeLabels
}
status {
checks
Expand Down
4 changes: 3 additions & 1 deletion web/src/apps/console/server/r-utils/key-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ export const keyconstants = {
nodeType: 'kloudlite.io/ui-node-type',
repoName: 'kloudlite.io/ui-repoName',
imageTag: 'kloudlite.io/ui-imageTag',
repoAccountName: 'kloudlite.io/ui-repoAccountName'
repoAccountName: 'kloudlite.io/ui-repoAccountName',

nodepoolStateType: 'kloudlite.io/ui/pool.app-state-type'
};
3 changes: 0 additions & 3 deletions web/src/generated/gql/sdl.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3020,7 +3020,6 @@ 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!
Expand All @@ -3037,7 +3036,6 @@ input NodePoolIn {
kind: String
metadata: MetadataIn
spec: Github__com___kloudlite___operator___apis___clusters___v1__NodePoolSpecIn!
stateful: Boolean!
}

type NodePoolPaginatedRecords {
Expand Down Expand Up @@ -3477,7 +3475,6 @@ input SearchNamespaces {
}

input SearchNodepool {
isStateful: MatchFilterIn
text: MatchFilterIn
}

Expand Down
6 changes: 2 additions & 4 deletions web/src/generated/gql/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ export type SearchNamespaces = {
};

export type SearchNodepool = {
isStateful?: InputMaybe<MatchFilterIn>;
text?: InputMaybe<MatchFilterIn>;
};

Expand Down Expand Up @@ -962,7 +961,6 @@ export type NodePoolIn = {
kind?: InputMaybe<Scalars['String']['input']>;
metadata?: InputMaybe<MetadataIn>;
spec: Github__Com___Kloudlite___Operator___Apis___Clusters___V1__NodePoolSpecIn;
stateful: Scalars['Boolean']['input'];
};

export type Github__Com___Kloudlite___Operator___Apis___Clusters___V1__NodePoolSpecIn =
Expand Down Expand Up @@ -2016,7 +2014,6 @@ export type ConsoleGetNodePoolQuery = {
clusterName: string;
creationTime: any;
displayName: string;
stateful: boolean;
kind?: string;
markedForDeletion?: boolean;
updateTime: any;
Expand All @@ -2035,6 +2032,7 @@ export type ConsoleGetNodePoolQuery = {
cloudProvider: Github__Com___Kloudlite___Operator___Apis___Common____Types__CloudProvider;
maxCount: number;
minCount: number;
nodeLabels?: any;
aws?: {
availabilityZone: string;
iamInstanceProfileRole?: string;
Expand Down Expand Up @@ -2104,7 +2102,6 @@ export type ConsoleListNodePoolsQuery = {
clusterName: string;
creationTime: any;
displayName: string;
stateful: boolean;
markedForDeletion?: boolean;
recordVersion: number;
updateTime: any;
Expand All @@ -2115,6 +2112,7 @@ export type ConsoleListNodePoolsQuery = {
cloudProvider: Github__Com___Kloudlite___Operator___Apis___Common____Types__CloudProvider;
maxCount: number;
minCount: number;
nodeLabels?: any;
aws?: {
availabilityZone: string;
nvidiaGpuEnabled: boolean;
Expand Down

0 comments on commit ba52010

Please sign in to comment.