@@ -242,7 +242,67 @@ func TestNodePoolForPod(t *testing.T) {
242
242
},
243
243
InitialNodeCount : 512 ,
244
244
Locations : []string {"" },
245
- Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : true },
245
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
246
+ MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
247
+ Name : "test-pool" ,
248
+ PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
249
+ UpgradeSettings : & container.UpgradeSettings {MaxSurge : 1 },
250
+ },
251
+ },
252
+ {
253
+ desc : "spot" ,
254
+ selector : map [string ]string {
255
+ "cloud.google.com/gke-spot" : "true" ,
256
+ },
257
+ want : & containerv1beta1.NodePool {
258
+ Config : & container.NodeConfig {
259
+ Labels : map [string ]string {
260
+ "google.com/nodepool-manager" : "tpu-provisioner" ,
261
+ "google.com/tpu-provisioner-jobset-name" : "jobset-test" ,
262
+ "google.com/tpu-provisioner-jobset-namespace" : "default" ,
263
+ "google.com/tpu-provisioner-parent-kind" : "job" ,
264
+ "google.com/tpu-provisioner-parent-name" : "jobset-test-job-1-0" ,
265
+ "google.com/tpu-provisioner-parent-namespace" : "default" ,
266
+ },
267
+ MachineType : "ct5p-hightpu-4t" ,
268
+ ShieldedInstanceConfig : & container.ShieldedInstanceConfig {EnableIntegrityMonitoring : true },
269
+ Spot : true ,
270
+ Taints : []* container.NodeTaint {
271
+ {Effect : "NO_SCHEDULE" , Key : "cloud.google.com/gke-spot" , Value : "true" },
272
+ },
273
+ },
274
+ InitialNodeCount : 512 ,
275
+ Locations : []string {"" },
276
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
277
+ MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
278
+ Name : "test-pool" ,
279
+ PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
280
+ UpgradeSettings : & container.UpgradeSettings {MaxSurge : 1 },
281
+ },
282
+ },
283
+ {
284
+ desc : "spot with forced on demand" ,
285
+ gkeContext : GKEContext {ForceOnDemand : true },
286
+ selector : map [string ]string {
287
+ "cloud.google.com/gke-spot" : "true" ,
288
+ },
289
+ want : & containerv1beta1.NodePool {
290
+ Config : & container.NodeConfig {
291
+ Labels : map [string ]string {
292
+ "google.com/nodepool-manager" : "tpu-provisioner" ,
293
+ "google.com/tpu-provisioner-jobset-name" : "jobset-test" ,
294
+ "google.com/tpu-provisioner-jobset-namespace" : "default" ,
295
+ "google.com/tpu-provisioner-parent-kind" : "job" ,
296
+ "google.com/tpu-provisioner-parent-name" : "jobset-test-job-1-0" ,
297
+ "google.com/tpu-provisioner-parent-namespace" : "default" ,
298
+ },
299
+ MachineType : "ct5p-hightpu-4t" ,
300
+ ShieldedInstanceConfig : & container.ShieldedInstanceConfig {EnableIntegrityMonitoring : true },
301
+ Spot : false ,
302
+ },
303
+ InitialNodeCount : 512 ,
304
+ Locations : []string {"" },
305
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
246
306
MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
247
307
Name : "test-pool" ,
248
308
PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
@@ -272,7 +332,34 @@ func TestNodePoolForPod(t *testing.T) {
272
332
},
273
333
InitialNodeCount : 512 ,
274
334
Locations : []string {"" },
275
- Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : true },
335
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
336
+ MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
337
+ Name : "test-pool" ,
338
+ PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
339
+ UpgradeSettings : & container.UpgradeSettings {MaxSurge : 1 },
340
+ },
341
+ },
342
+ {
343
+ desc : "pod with reservation selector but on demand is forced" ,
344
+ selector : map [string ]string {"cloud.google.com/reservation-name" : "tpu-rsv" },
345
+ gkeContext : GKEContext {ForceOnDemand : true },
346
+ want : & containerv1beta1.NodePool {
347
+ Config : & container.NodeConfig {
348
+ Labels : map [string ]string {
349
+ "google.com/nodepool-manager" : "tpu-provisioner" ,
350
+ "google.com/tpu-provisioner-jobset-name" : "jobset-test" ,
351
+ "google.com/tpu-provisioner-jobset-namespace" : "default" ,
352
+ "google.com/tpu-provisioner-parent-kind" : "job" ,
353
+ "google.com/tpu-provisioner-parent-name" : "jobset-test-job-1-0" ,
354
+ "google.com/tpu-provisioner-parent-namespace" : "default" ,
355
+ },
356
+ MachineType : "ct5p-hightpu-4t" ,
357
+ ReservationAffinity : nil ,
358
+ ShieldedInstanceConfig : & container.ShieldedInstanceConfig {EnableIntegrityMonitoring : true },
359
+ },
360
+ InitialNodeCount : 512 ,
361
+ Locations : []string {"" },
362
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
276
363
MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
277
364
Name : "test-pool" ,
278
365
PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
@@ -298,7 +385,7 @@ func TestNodePoolForPod(t *testing.T) {
298
385
},
299
386
InitialNodeCount : 512 ,
300
387
Locations : []string {"" },
301
- Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : true },
388
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
302
389
MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
303
390
Name : "test-pool" ,
304
391
PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
@@ -329,7 +416,7 @@ func TestNodePoolForPod(t *testing.T) {
329
416
},
330
417
InitialNodeCount : 512 ,
331
418
Locations : []string {"" },
332
- Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : true },
419
+ Management : & container.NodeManagement {AutoRepair : true , AutoUpgrade : false },
333
420
MaxPodsConstraint : & container.MaxPodsConstraint {MaxPodsPerNode : 15 },
334
421
Name : "test-pool" ,
335
422
PlacementPolicy : & container.PlacementPolicy {TpuTopology : "8x16x16" , Type : "COMPACT" },
0 commit comments