Feroze Mohideen 2 лет назад
Родитель
Сommit
8aa09846dd

+ 4 - 0
api/server/handlers/project_integration/preflight_check.go

@@ -1,6 +1,7 @@
 package project_integration
 
 import (
+	"fmt"
 	"net/http"
 
 	"connectrpc.com/connect"
@@ -58,6 +59,7 @@ var recognizedPreflightCheckKeys = []string{
 	"cidrAvailability",
 	"iamPermissions",
 	"resourceProviders",
+	"gpu",
 }
 
 func (p *CreatePreflightCheckHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@@ -109,6 +111,8 @@ func (p *CreatePreflightCheckHandler) ServeHTTP(w http.ResponseWriter, r *http.R
 		return
 	}
 
+	fmt.Printf("here are the ccp prefligt checks: %+v\n", checkResp.Msg.PreflightChecks)
+
 	errors := []PreflightCheckError{}
 	for key, val := range checkResp.Msg.PreflightChecks {
 		if val.Message == "" || !contains(recognizedPreflightCheckKeys, key) {

+ 32 - 0
dashboard/src/lib/clusters/constants.ts

@@ -947,6 +947,33 @@ const AWS_VCPUS_QUOTA_RESOLUTION: PreflightCheckResolution = {
   ],
 };
 
+const AWS_GPU_QUOTA_RESOLUTION: PreflightCheckResolution = {
+  title: "Requesting more GPU-type vCPUs",
+  subtitle:
+    "You will need to either request more GPU-type vCPUs or delete existing instances in order to provision in the region specified. You can request more GPU-type vCPUs by following these steps:",
+  steps: [
+    {
+      text: "Log into your AWS Account",
+      externalLink:
+        "https://console.aws.amazon.com/billing/home?region=us-east-1#/account",
+    },
+    {
+      text: "Navigate to the Amazon Elastic Compute Cloud (Amazon EC2) Service Quotas portal",
+      externalLink:
+        "https://us-east-1.console.aws.amazon.com/servicequotas/home/services/ec2/quotas",
+    },
+    {
+      text: 'Search for "Running On-Demand G and VT instances" in the search box and click on the search result.',
+    },
+    {
+      text: 'Click on "Request quota increase". In order to provision with Porter, you will need to request the specified number of vCPUs above your current quota limit.',
+    },
+    {
+      text: "Once that request is approved, return to Porter and retry the provision.",
+    },
+  ],
+};
+
 const SUPPORTED_AWS_PREFLIGHT_CHECKS: PreflightCheck[] = [
   {
     name: "eip",
@@ -968,6 +995,11 @@ const SUPPORTED_AWS_PREFLIGHT_CHECKS: PreflightCheck[] = [
     displayName: "vCPU availability",
     resolution: AWS_VCPUS_QUOTA_RESOLUTION,
   },
+  {
+    name: "gpu",
+    displayName: "GPU availability",
+    resolution: AWS_GPU_QUOTA_RESOLUTION,
+  },
 ];
 
 const SUPPORTED_GCP_PREFLIGHT_CHECKS: PreflightCheck[] = [

+ 1 - 0
dashboard/src/lib/clusters/types.ts

@@ -505,6 +505,7 @@ const preflightCheckKeyValidator = z.enum([
   "apiEnabled",
   "cidrAvailability",
   "iamPermissions",
+  "gpu",
 ]);
 type PreflightCheckKey = z.infer<typeof preflightCheckKeyValidator>;
 export const preflightCheckValidator = z.object({

+ 87 - 1
dashboard/src/lib/hooks/useCluster.ts

@@ -366,7 +366,93 @@ export const useUpdateCluster = ({
       const preflightCheckResp = await api.preflightCheck(
         "<token>",
         new PreflightCheckRequest({
-          contract: newContract,
+          contract: {
+            cluster: {
+              projectId: 37,
+              clusterId: 0,
+              kind: "ENUM_KUBERNETES_KIND_EKS",
+              cloudProvider: "ENUM_CLOUD_PROVIDER_AWS",
+              cloudProviderCredentialsId:
+                "arn:aws:iam::844966915049:role/porter-manager",
+              kindValues: {
+                case: "eksKind",
+                value: {
+                  clusterName: "feroze-feb18-cluster-h0b7x4",
+                  clusterVersion: "v1.27.0",
+                  cidrRange: "10.78.0.0/16",
+                  region: "us-east-2",
+                  nodeGroups: [
+                    {
+                      instanceType: "t3.medium",
+                      minInstances: 1,
+                      maxInstances: 5,
+                      nodeGroupType: "NODE_GROUP_TYPE_SYSTEM",
+                      isStateful: false,
+                      additionalPolicies: [],
+                      additionalTaints: [],
+                    },
+                    {
+                      instanceType: "t3.large",
+                      minInstances: 1,
+                      maxInstances: 1,
+                      nodeGroupType: "NODE_GROUP_TYPE_MONITORING",
+                      isStateful: true,
+                      additionalPolicies: [],
+                      additionalTaints: [],
+                    },
+                    {
+                      instanceType: "t3.medium",
+                      minInstances: 1,
+                      maxInstances: 10,
+                      nodeGroupType: "NODE_GROUP_TYPE_APPLICATION",
+                      isStateful: false,
+                      additionalPolicies: [],
+                      additionalTaints: [],
+                    },
+                    {
+                      instanceType: "g4dn.xlarge",
+                      minInstances: 0,
+                      maxInstances: 5,
+                      nodeGroupType: "NODE_GROUP_TYPE_CUSTOM",
+                      isStateful: false,
+                      additionalPolicies: [],
+                      additionalTaints: [],
+                    },
+                  ],
+                  loadBalancer: {
+                    loadBalancerType: "LOAD_BALANCER_TYPE_NLB",
+                    wildcardDomain: "",
+                    allowlistIpRanges: "",
+                    enableWafv2: false,
+                    wafv2Arn: "",
+                    additionalCertificateArns: [],
+                    tags: {},
+                    enableS3AccessLogs: false,
+                  },
+                  enableGuardDuty: false,
+                  logging: {
+                    enableApiServerLogs: false,
+                    enableAuthenticatorLogs: false,
+                    enableSchedulerLogs: false,
+                    enableAuditLogs: false,
+                    enableControllerManagerLogs: false,
+                    enableCloudwatchLogsToS3: false,
+                  },
+                  enableKmsEncryption: false,
+                  network: {
+                    vpcCidr: "10.78.0.0/16",
+                    serviceCidr: "172.20.0.0/16",
+                  },
+                  enableEcrScanning: false,
+                },
+                isSoc2Compliant: false,
+              },
+            },
+            complianceProfiles: {
+              soc2: false,
+              hipaa: false,
+            },
+          },
         }),
         {
           id: projectId,