@@ -214,62 +214,51 @@ func (tcp *TestCloudProvider) NewNodeGroup(machineType string, labels map[string
214
214
}, nil
215
215
}
216
216
217
- // NewNodeGroupWithId creates a new node group with custom ID suffix.
218
- func (tcp * TestCloudProvider ) NewNodeGroupWithId (machineType string , labels map [string ]string , systemLabels map [string ]string ,
219
- taints []apiv1.Taint , extraResources map [string ]resource.Quantity , id string ) (cloudprovider.NodeGroup , error ) {
220
- return & TestNodeGroup {
221
- cloudProvider : tcp ,
222
- id : "autoprovisioned-" + machineType + "-" + id ,
223
- minSize : 0 ,
224
- maxSize : 1000 ,
225
- targetSize : 0 ,
226
- exist : false ,
227
- autoprovisioned : true ,
228
- machineType : machineType ,
229
- labels : labels ,
230
- taints : taints ,
231
- }, nil
232
- }
233
-
234
- // InsertNodeGroup adds already created node group to test cloud provider.
235
- func (tcp * TestCloudProvider ) InsertNodeGroup (nodeGroup cloudprovider.NodeGroup ) {
236
- tcp .Lock ()
237
- defer tcp .Unlock ()
238
-
239
- tcp .groups [nodeGroup .Id ()] = nodeGroup
240
- }
241
-
242
217
// BuildNodeGroup returns a test node group.
243
- func (tcp * TestCloudProvider ) BuildNodeGroup (id string , min , max , size int , autoprovisioned bool , machineType string , opts * config.NodeGroupAutoscalingOptions ) * TestNodeGroup {
218
+ func (tcp * TestCloudProvider ) BuildNodeGroup (id string , min , max , size int , exists bool , autoprovisioned bool , machineType string , opts * config.NodeGroupAutoscalingOptions ) * TestNodeGroup {
244
219
return & TestNodeGroup {
245
220
cloudProvider : tcp ,
246
221
id : id ,
247
222
minSize : min ,
248
223
maxSize : max ,
249
224
targetSize : size ,
250
- exist : true ,
225
+ exist : exists ,
251
226
autoprovisioned : autoprovisioned ,
252
227
machineType : machineType ,
253
228
opts : opts ,
254
229
}
255
230
}
256
231
232
+ // InsertNodeGroup adds already created node group to test cloud provider.
233
+ func (tcp * TestCloudProvider ) InsertNodeGroup (nodeGroup cloudprovider.NodeGroup ) {
234
+ tcp .Lock ()
235
+ defer tcp .Unlock ()
236
+
237
+ tcp .groups [nodeGroup .Id ()] = nodeGroup
238
+ }
239
+
257
240
// AddNodeGroup adds node group to test cloud provider.
258
241
func (tcp * TestCloudProvider ) AddNodeGroup (id string , min int , max int , size int ) {
259
- nodeGroup := tcp .BuildNodeGroup (id , min , max , size , false , "" , nil )
242
+ nodeGroup := tcp .BuildNodeGroup (id , min , max , size , true , false , "" , nil )
243
+ tcp .InsertNodeGroup (nodeGroup )
244
+ }
245
+
246
+ // AddUpcomingNodeGroup adds upcoming node group to test cloud provider.
247
+ func (tcp * TestCloudProvider ) AddUpcomingNodeGroup (id string , min int , max int , size int ) {
248
+ nodeGroup := tcp .BuildNodeGroup (id , min , max , size , false , false , "" , nil )
260
249
tcp .InsertNodeGroup (nodeGroup )
261
250
}
262
251
263
252
// AddNodeGroupWithCustomOptions adds node group with custom options
264
253
// to test cloud provider.
265
254
func (tcp * TestCloudProvider ) AddNodeGroupWithCustomOptions (id string , min int , max int , size int , opts * config.NodeGroupAutoscalingOptions ) {
266
- nodeGroup := tcp .BuildNodeGroup (id , min , max , size , false , "" , opts )
255
+ nodeGroup := tcp .BuildNodeGroup (id , min , max , size , true , false , "" , opts )
267
256
tcp .InsertNodeGroup (nodeGroup )
268
257
}
269
258
270
259
// AddAutoprovisionedNodeGroup adds node group to test cloud provider.
271
260
func (tcp * TestCloudProvider ) AddAutoprovisionedNodeGroup (id string , min int , max int , size int , machineType string ) * TestNodeGroup {
272
- nodeGroup := tcp .BuildNodeGroup (id , min , max , size , true , machineType , nil )
261
+ nodeGroup := tcp .BuildNodeGroup (id , min , max , size , true , true , machineType , nil )
273
262
tcp .InsertNodeGroup (nodeGroup )
274
263
return nodeGroup
275
264
}
0 commit comments