@@ -166,7 +166,10 @@ func (a *baseTierChecks) GetExpectedTemplateRefs(t *testing.T, hostAwait *wait.H
166166
167167func (a * baseTierChecks ) GetClusterObjectChecks () []clusterObjectsCheck {
168168 return clusterObjectsChecks (
169- clusterResourceQuotaCompute (baseCPULimit , "6000m" , "28Gi" , "60Gi" ),
169+ clusterResourceQuotaCompute (baseCPULimit , "6000m" , "28Gi" , "60Gi" , map [corev1.ResourceName ]string {
170+ corev1 .ResourceName ("requests.nvidia.com/gpu" ): "0" ,
171+ corev1 .ResourceName ("limits.nvidia.com/gpu" ): "0" ,
172+ }),
170173 clusterResourceQuotaDeployments (),
171174 clusterResourceQuotaReplicas (),
172175 clusterResourceQuotaRoutes (),
@@ -185,8 +188,14 @@ type base1nsTierChecks struct {
185188
186189func (a * base1nsTierChecks ) GetNamespaceObjectChecks (_ string ) []namespaceObjectsCheck {
187190 checks := []namespaceObjectsCheck {
188- resourceQuotaComputeDeploy ("30" , "30Gi" , "3" , "30Gi" ),
189- resourceQuotaComputeBuild ("20" , "14Gi" , "3" , "14Gi" ),
191+ resourceQuotaComputeDeploy ("30" , "30Gi" , "3" , "30Gi" , map [corev1.ResourceName ]string {
192+ corev1 .ResourceName ("requests.nvidia.com/gpu" ): "0" ,
193+ corev1 .ResourceName ("limits.nvidia.com/gpu" ): "0" ,
194+ }),
195+ resourceQuotaComputeBuild ("20" , "14Gi" , "3" , "14Gi" , map [corev1.ResourceName ]string {
196+ corev1 .ResourceName ("requests.nvidia.com/gpu" ): "0" ,
197+ corev1 .ResourceName ("limits.nvidia.com/gpu" ): "0" ,
198+ }),
190199 resourceQuotaStorage ("15Gi" , "80Gi" , "15Gi" , "10" ),
191200 limitRange ("1" , "1000Mi" , "10m" , "64Mi" ),
192201 numberOfLimitRanges (1 ),
@@ -317,7 +326,7 @@ type appstudioTierChecks struct {
317326
318327func commonAppstudioTierChecks () []namespaceObjectsCheck {
319328 return []namespaceObjectsCheck {
320- resourceQuotaComputeDeploy ("20" , "32Gi" , "1750m" , "32Gi" ),
329+ resourceQuotaComputeDeploy ("20" , "32Gi" , "1750m" , "32Gi" , nil ),
321330 limitRange ("2" , "2Gi" , "10m" , "256Mi" ),
322331 numberOfLimitRanges (1 ),
323332 gitOpsServiceLabel (),
@@ -340,7 +349,7 @@ func commonAppstudioTierChecks() []namespaceObjectsCheck {
340349func (a * appstudioTierChecks ) GetNamespaceObjectChecks (_ string ) []namespaceObjectsCheck {
341350 checks := []namespaceObjectsCheck {
342351 resourceQuotaStorage ("50Gi" , "200Gi" , "50Gi" , "90" ),
343- resourceQuotaComputeBuild ("120" , "128Gi" , "60" , "64Gi" ),
352+ resourceQuotaComputeBuild ("120" , "128Gi" , "60" , "64Gi" , nil ),
344353 }
345354 checks = append (checks , commonAppstudioTierChecks ()... )
346355 checks = append (checks , append (commonNetworkPolicyChecks (), networkPolicyAllowFromCRW (), numberOfNetworkPolicies (7 ))... )
@@ -431,7 +440,7 @@ type appstudiolargeTierChecks struct {
431440
432441func (a * appstudiolargeTierChecks ) GetNamespaceObjectChecks (_ string ) []namespaceObjectsCheck {
433442 checks := []namespaceObjectsCheck {
434- resourceQuotaComputeBuild ("480" , "512Gi" , "240" , "256Gi" ),
443+ resourceQuotaComputeBuild ("480" , "512Gi" , "240" , "256Gi" , nil ),
435444 resourceQuotaStorage ("50Gi" , "400Gi" , "50Gi" , "180" ),
436445 }
437446 checks = append (checks , commonAppstudioTierChecks ()... )
@@ -459,7 +468,7 @@ type appstudioEnvTierChecks struct {
459468
460469func (a * appstudioEnvTierChecks ) GetNamespaceObjectChecks (_ string ) []namespaceObjectsCheck {
461470 checks := []namespaceObjectsCheck {
462- resourceQuotaComputeDeploy ("20" , "32Gi" , "1750m" , "32Gi" ),
471+ resourceQuotaComputeDeploy ("20" , "32Gi" , "1750m" , "32Gi" , nil ),
463472 zeroResourceQuotaComputeBuild (),
464473 resourceQuotaStorage ("50Gi" , "50Gi" , "50Gi" , "12" ),
465474 limitRange ("2" , "2Gi" , "10m" , "256Mi" ),
@@ -626,7 +635,7 @@ func rbacEditRole() spaceRoleObjectsCheck {
626635 }
627636}
628637
629- func resourceQuotaComputeDeploy (cpuLimit , memoryLimit , cpuRequest , memoryRequest string ) namespaceObjectsCheck {
638+ func resourceQuotaComputeDeploy (cpuLimit , memoryLimit , cpuRequest , memoryRequest string , additionalResources map [corev1. ResourceName ] string ) namespaceObjectsCheck {
630639 return func (t * testing.T , ns * corev1.Namespace , memberAwait * wait.MemberAwaitility , _ string ) {
631640 var err error
632641 spec := corev1.ResourceQuotaSpec {
@@ -641,14 +650,18 @@ func resourceQuotaComputeDeploy(cpuLimit, memoryLimit, cpuRequest, memoryRequest
641650 require .NoError (t , err )
642651 spec .Hard [corev1 .ResourceRequestsMemory ], err = resource .ParseQuantity (memoryRequest )
643652 require .NoError (t , err )
653+ for resourceName , quantity := range additionalResources {
654+ spec .Hard [resourceName ], err = resource .ParseQuantity (quantity )
655+ require .NoError (t , err )
656+ }
644657
645658 criteria := resourceQuotaMatches (ns .Name , "compute-deploy" , spec )
646659 _ , err = memberAwait .WaitForResourceQuota (t , ns .Name , "compute-deploy" , criteria )
647660 require .NoError (t , err )
648661 }
649662}
650663
651- func resourceQuotaComputeBuild (cpuLimit , memoryLimit , cpuRequest , memoryRequest string ) namespaceObjectsCheck {
664+ func resourceQuotaComputeBuild (cpuLimit , memoryLimit , cpuRequest , memoryRequest string , additionalResources map [corev1. ResourceName ] string ) namespaceObjectsCheck {
652665 return func (t * testing.T , ns * corev1.Namespace , memberAwait * wait.MemberAwaitility , _ string ) {
653666 var err error
654667 spec := corev1.ResourceQuotaSpec {
@@ -663,6 +676,10 @@ func resourceQuotaComputeBuild(cpuLimit, memoryLimit, cpuRequest, memoryRequest
663676 require .NoError (t , err )
664677 spec .Hard [corev1 .ResourceRequestsMemory ], err = resource .ParseQuantity (memoryRequest )
665678 require .NoError (t , err )
679+ for resourceName , quantity := range additionalResources {
680+ spec .Hard [resourceName ], err = resource .ParseQuantity (quantity )
681+ require .NoError (t , err )
682+ }
666683
667684 criteria := resourceQuotaMatches (ns .Name , "compute-build" , spec )
668685 _ , err = memberAwait .WaitForResourceQuota (t , ns .Name , "compute-build" , criteria )
@@ -1099,7 +1116,7 @@ func idlers(timeoutSeconds int, namespaceTypes ...string) clusterObjectsCheckCre
10991116 }
11001117}
11011118
1102- func clusterResourceQuotaCompute (cpuLimit , cpuRequest , memoryLimit , storageLimit string ) clusterObjectsCheckCreator { // nolint:unparam
1119+ func clusterResourceQuotaCompute (cpuLimit , cpuRequest , memoryLimit , storageLimit string , additionalResources map [corev1. ResourceName ] string ) clusterObjectsCheckCreator { // nolint:unparam
11031120 return func () clusterObjectsCheck {
11041121 return func (t * testing.T , memberAwait * wait.MemberAwaitility , userName , tierLabel string ) {
11051122 var err error
@@ -1120,6 +1137,10 @@ func clusterResourceQuotaCompute(cpuLimit, cpuRequest, memoryLimit, storageLimit
11201137 require .NoError (t , err )
11211138 hard [count (corev1 .ResourcePersistentVolumeClaims )], err = resource .ParseQuantity ("5" )
11221139 require .NoError (t , err )
1140+ for resourceName , quantity := range additionalResources {
1141+ hard [resourceName ], err = resource .ParseQuantity (quantity )
1142+ require .NoError (t , err )
1143+ }
11231144
11241145 _ , err = memberAwait .WaitForClusterResourceQuota (t , fmt .Sprintf ("for-%s-compute" , userName ),
11251146 crqToolchainLabelsWaitCriterion (userName ),
0 commit comments