Skip to content

Commit 4007e8a

Browse files
add test case for defining MCAD resources
1 parent 837f5fc commit 4007e8a

File tree

6 files changed

+14
-28
lines changed

6 files changed

+14
-28
lines changed

api/v1alpha1/mcad_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type MCADSpec struct {
5050
PodCreationTimeout int `json:"podCreationTimeout,omitempty"`
5151
//podCreationTimeout: //int (default blank)
5252

53-
// ControllerResources TODO: Add details
53+
// ControllerResources defines the cpu and memory resource requirements for the MCAD Controller
5454
// +kubebuilder:default={}
5555
ControllerResources v1.ResourceRequirements `json:"controllerResources,omitempty" protobuf:"bytes,8,opt"`
5656
}

config/crd/bases/codeflare.codeflare.dev_mcads.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ spec:
3939
description: 'AgentConfigs TODO: Add details'
4040
type: string
4141
controllerResources:
42-
description: 'ControllerResources TODO: Add details'
42+
description: ControllerResources defines the cpu and memory resource
43+
requirements for the MCAD Controller
4344
properties:
4445
claims:
4546
description: "Claims lists the names of resources, defined in

controllers/mcad_controller_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ const (
1515
mcadConfigMap1 = "./testdata/mcad_test_results/case_1/configmap.yaml"
1616
mcadService1 = "./testdata/mcad_test_results/case_1/service.yaml"
1717
mcadServiceAccount1 = "./testdata/mcad_test_results/case_1/serviceaccount.yaml"
18-
)
19-
20-
const (
2118
mcadCRCase2 = "./testdata/mcad_test_cases/case_2.yaml"
2219
mcadConfigMap2 = "./testdata/mcad_test_results/case_2/configmap.yaml"
2320
mcadService2 = "./testdata/mcad_test_results/case_2/service.yaml"

controllers/mcad_params.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package controllers
22

33
import (
4-
"encoding/json"
5-
64
mf "github.com/manifestival/manifestival"
75
mcadv1alpha1 "github.com/project-codeflare/codeflare-operator/api/v1alpha1"
8-
v1 "k8s.io/api/core/v1"
96
)
107

118
type MCADParams struct {
@@ -22,18 +19,9 @@ type MCADParams struct {
2219
ControllerResources ControllerResources
2320
}
2421

25-
type ControllerResources struct {
26-
v1.ResourceRequirements
27-
}
28-
29-
func (c *ControllerResources) String() string {
30-
raw, err := json.Marshal(c)
31-
if err != nil {
32-
return "{}"
33-
} else {
34-
return string(raw)
35-
}
36-
}
22+
// type ControllerResources struct {
23+
// v1.ResourceRequirements
24+
// }
3725

3826
// ExtractParams is currently a straight-up copy. We can add in more complex validation at a later date
3927
func (p *MCADParams) ExtractParams(mcad *mcadv1alpha1.MCAD) error {

controllers/testdata/mcad_test_cases/case_1.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,4 @@ apiVersion: codeflare.codeflare.dev/v1alpha1
22
kind: MCAD
33
metadata:
44
name: blank-custom-resource
5-
spec:
6-
controllerResources:
7-
limits:
8-
cpu: '2'
9-
memory: 2G
10-
requests:
11-
cpu: '2'
12-
memory: 2G
5+
spec: {}

controllers/testdata/mcad_test_cases/case_2.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ spec:
66
podCreationTimeout: 300
77
quotaRestURL: 'bar.com'
88
agentConfigs: 'foo'
9+
controllerResources:
10+
limits:
11+
cpu: '2'
12+
memory: 2G
13+
requests:
14+
cpu: '2'
15+
memory: 2G

0 commit comments

Comments
 (0)