+
{isEditable ? (
diff --git a/libs/domains/clusters/feature/src/lib/utils/get-gcp-nat-gateway-settings.spec.ts b/libs/domains/clusters/feature/src/lib/utils/get-gcp-nat-gateway-settings.spec.ts
new file mode 100644
index 00000000000..359a44f0966
--- /dev/null
+++ b/libs/domains/clusters/feature/src/lib/utils/get-gcp-nat-gateway-settings.spec.ts
@@ -0,0 +1,57 @@
+import { type ClusterFeatureResponse, ClusterFeatureResponseTypeEnum } from 'qovery-typescript-axios'
+import { getGcpNatGatewaySettings } from './get-gcp-nat-gateway-settings'
+
+const makeFeature = (value: object | null): ClusterFeatureResponse => ({
+ id: 'NAT_GATEWAY',
+ value_object: {
+ type: ClusterFeatureResponseTypeEnum.NAT_GATEWAY,
+ value,
+ },
+})
+
+describe('getGcpNatGatewaySettings', () => {
+ it('should return settings when value has GCP nat_gateway_type shape', () => {
+ expect(
+ getGcpNatGatewaySettings(
+ makeFeature({
+ nat_gateway_type: {
+ provider: 'gcp',
+ static_ips_enabled: true,
+ static_ips_count: 3,
+ },
+ })
+ )
+ ).toEqual({
+ static_ips_enabled: true,
+ static_ips_count: 3,
+ })
+ })
+
+ it('should return undefined for Scaleway nat_gateway_type shape', () => {
+ expect(
+ getGcpNatGatewaySettings(
+ makeFeature({
+ nat_gateway_type: {
+ provider: 'scaleway',
+ type: 'VPC-GW-S',
+ },
+ })
+ )
+ ).toBeUndefined()
+ })
+
+ it('should return undefined for null, undefined, or non-NAT_GATEWAY feature', () => {
+ expect(getGcpNatGatewaySettings(undefined)).toBeUndefined()
+ expect(
+ getGcpNatGatewaySettings({
+ id: 'STATIC_IP',
+ value_object: { type: ClusterFeatureResponseTypeEnum.BOOLEAN, value: true },
+ })
+ ).toBeUndefined()
+ })
+
+ it('should return undefined when nat_gateway_type is null or missing', () => {
+ expect(getGcpNatGatewaySettings(makeFeature(null))).toBeUndefined()
+ expect(getGcpNatGatewaySettings(makeFeature({ nat_gateway_type: null }))).toBeUndefined()
+ })
+})
diff --git a/libs/domains/clusters/feature/src/lib/utils/get-gcp-nat-gateway-settings.ts b/libs/domains/clusters/feature/src/lib/utils/get-gcp-nat-gateway-settings.ts
new file mode 100644
index 00000000000..593bc9bcbfe
--- /dev/null
+++ b/libs/domains/clusters/feature/src/lib/utils/get-gcp-nat-gateway-settings.ts
@@ -0,0 +1,17 @@
+import { type ClusterFeatureNatGatewayTypeGcp, type ClusterFeatureResponse } from 'qovery-typescript-axios'
+
+export type GcpNatGatewaySettings = {
+ static_ips_enabled: boolean
+ static_ips_count: number
+}
+
+export const getGcpNatGatewaySettings = (feature?: ClusterFeatureResponse): GcpNatGatewaySettings | undefined => {
+ const valueObj = feature?.value_object
+ if (valueObj?.type !== 'NAT_GATEWAY') return undefined
+ const natGatewayType = valueObj.value?.nat_gateway_type
+ if (natGatewayType && natGatewayType.provider === 'gcp') {
+ const { static_ips_enabled, static_ips_count } = natGatewayType as ClusterFeatureNatGatewayTypeGcp
+ return { static_ips_enabled, static_ips_count }
+ }
+ return undefined
+}
diff --git a/libs/domains/clusters/feature/src/lib/utils/has-gpu-instance.ts b/libs/domains/clusters/feature/src/lib/utils/has-gpu-instance.ts
index 911c30f8fc0..56fdfb7c113 100644
--- a/libs/domains/clusters/feature/src/lib/utils/has-gpu-instance.ts
+++ b/libs/domains/clusters/feature/src/lib/utils/has-gpu-instance.ts
@@ -3,9 +3,12 @@ import { type Cluster } from 'qovery-typescript-axios'
export const hasGpuInstance = (cluster?: Cluster) => {
const clusterFeatureKarpenter = cluster?.features?.find((feature) => feature.id === 'KARPENTER')
if (!clusterFeatureKarpenter) return false
+ const karpenterValue = clusterFeatureKarpenter.value_object?.value
+
return Boolean(
- typeof clusterFeatureKarpenter?.value_object?.value === 'object' &&
- 'qovery_node_pools' in clusterFeatureKarpenter.value_object.value &&
- clusterFeatureKarpenter.value_object.value.qovery_node_pools.gpu_override
+ karpenterValue &&
+ typeof karpenterValue === 'object' &&
+ 'qovery_node_pools' in karpenterValue &&
+ karpenterValue.qovery_node_pools.gpu_override
)
}
diff --git a/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts b/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts
index 686edd943c2..c1ce7f07b56 100644
--- a/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts
+++ b/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts
@@ -65,6 +65,13 @@ export type Subnets = {
C: string
}
+export type ClusterFeatureExtendedValue =
+ | string
+ | {
+ static_ips_enabled: boolean
+ static_ips_count: number
+ }
+
export type ClusterFeaturesData = {
vpc_mode: 'DEFAULT' | 'EXISTING_VPC' | undefined
aws_existing_vpc?: {
@@ -89,7 +96,7 @@ export type ClusterFeaturesData = {
id: string
title: string
value: boolean
- extendedValue?: string
+ extendedValue?: ClusterFeatureExtendedValue
}
}
}
diff --git a/package.json b/package.json
index 5718be9cf69..77531ac916a 100644
--- a/package.json
+++ b/package.json
@@ -56,7 +56,7 @@
"@xterm/xterm": "5.5.0",
"ansi-to-react": "6.1.6",
"autoprefixer": "10.4.13",
- "axios": "1.15.0",
+ "axios": "1.15.2",
"class-variance-authority": "0.7.0",
"clsx": "2.1.1",
"cmdk": "1.1.1",
@@ -75,7 +75,7 @@
"mermaid": "11.6.0",
"monaco-editor": "0.53.0",
"posthog-js": "1.345.1",
- "qovery-typescript-axios": "1.1.881",
+ "qovery-typescript-axios": "1.1.887",
"react": "18.3.1",
"react-country-flag": "3.0.2",
"react-datepicker": "4.12.0",
diff --git a/yarn.lock b/yarn.lock
index a8c2efddc3e..95cad262a12 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6320,7 +6320,7 @@ __metadata:
"@xterm/xterm": 5.5.0
ansi-to-react: 6.1.6
autoprefixer: 10.4.13
- axios: 1.15.0
+ axios: 1.15.2
babel-jest: 30.0.5
babel-loader: 8.3.0
chance: 1.1.10
@@ -6369,7 +6369,7 @@ __metadata:
prettier: 3.2.5
prettier-plugin-tailwindcss: 0.5.14
pretty-quick: 4.0.0
- qovery-typescript-axios: 1.1.881
+ qovery-typescript-axios: 1.1.887
qovery-ws-typescript-axios: 0.1.506
react: 18.3.1
react-country-flag: 3.0.2
@@ -12187,14 +12187,14 @@ __metadata:
languageName: node
linkType: hard
-"axios@npm:1.15.0":
- version: 1.15.0
- resolution: "axios@npm:1.15.0"
+"axios@npm:1.15.2":
+ version: 1.15.2
+ resolution: "axios@npm:1.15.2"
dependencies:
follow-redirects: ^1.15.11
form-data: ^4.0.5
proxy-from-env: ^2.1.0
- checksum: 95a8455554867a083ab3772fcadba42a22ec4bb546dccc66011556d837a07e544ae006675a30a5c43453f3e37e7c0982e934cec482c06b75abead2a2c157448a
+ checksum: e7d208b751959c7c6936417b870d6286979e0dff17784ae230d3988e754b6322682cb136e25669b534072b6f44c08715801ab961227eb8cc075323d9fda8ad43
languageName: node
linkType: hard
@@ -26327,12 +26327,12 @@ __metadata:
languageName: node
linkType: hard
-"qovery-typescript-axios@npm:1.1.881":
- version: 1.1.881
- resolution: "qovery-typescript-axios@npm:1.1.881"
+"qovery-typescript-axios@npm:1.1.887":
+ version: 1.1.887
+ resolution: "qovery-typescript-axios@npm:1.1.887"
dependencies:
- axios: 1.15.0
- checksum: 230ffc8a4d5d18dd650e6f0ce9a71fedd69fa21c38b738905f9969e5f65e7eb2ed5cb490bc01334208b5da7dc7193604eaa3701d6b088bf19c79670684d9d033
+ axios: 1.15.2
+ checksum: 24d37b51845c92dc35199dc6fca18fad9b011fe63719ba3d819fc76b681042d7b061b1ff6a31e3d6b52a11cb0e3354e06b761d725329c216067127ae3a5b6572
languageName: node
linkType: hard