File tree 2 files changed +42
-0
lines changed
pkg/handlers/nutanix/mutation/machinedetails 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,24 @@ func (h *nutanixMachineDetailsPatchHandler) Mutate(
122
122
capxv1 .NutanixResourceIdentifier (* nutanixMachineDetailsVar .Project ),
123
123
)
124
124
}
125
+ if nutanixMachineDetailsVar .GPUs != nil {
126
+ spec .GPUs = make (
127
+ []capxv1.NutanixGPU ,
128
+ len (nutanixMachineDetailsVar .GPUs ),
129
+ )
130
+
131
+ for i , gpu := range nutanixMachineDetailsVar .GPUs {
132
+ gpuType := capxv1 .NutanixGPUIdentifierType (gpu .Type )
133
+ spec .GPUs [i ] = capxv1.NutanixGPU {
134
+ Type : gpuType ,
135
+ }
136
+ if gpuType == capxv1 .NutanixGPUIdentifierName {
137
+ spec .GPUs [i ].Name = gpu .Name
138
+ continue
139
+ }
140
+ spec .GPUs [i ].DeviceID = gpu .DeviceID
141
+ }
142
+ }
125
143
126
144
obj .Spec .Template .Spec = spec
127
145
return nil
Original file line number Diff line number Diff line change 55
55
Type : capxv1 .NutanixIdentifierName ,
56
56
Name : ptr .To ("fake-project" ),
57
57
}),
58
+ GPUs : []v1alpha1.NutanixGPU {
59
+ {
60
+ Type : "name" ,
61
+ Name : ptr .To ("gpu1" ),
62
+ },
63
+ {
64
+ Type : "deviceID" ,
65
+ DeviceID : ptr .To (int64 (1 )),
66
+ },
67
+ },
58
68
}
59
69
60
70
matchersForAllFieldsSet = []capitest.JSONPatchMatcher {
71
+ {
72
+ Operation : "add" ,
73
+ Path : "/spec/template/spec/gpus" ,
74
+ ValueMatcher : gomega .ContainElements (
75
+ gomega .SatisfyAll (
76
+ gomega .HaveKeyWithValue ("type" , "name" ),
77
+ gomega .HaveKeyWithValue ("name" , "gpu1" ),
78
+ ),
79
+ gomega .SatisfyAll (
80
+ gomega .HaveKeyWithValue ("type" , "deviceID" ),
81
+ gomega .HaveKey ("deviceID" ),
82
+ ),
83
+ ),
84
+ },
61
85
{
62
86
Operation : "add" ,
63
87
Path : "/spec/template/spec/bootType" ,
You can’t perform that action at this time.
0 commit comments