@@ -357,38 +357,35 @@ func (v CloudProjectKubeNodePoolResponse) ToMap() map[string]interface{} {
357
357
358
358
// If the template is not nil and not empty, then we need to add it to the map
359
359
if v .Template != nil && ! reflect .DeepEqual (v .Template , emptyTemplateResponse ) {
360
- obj ["template" ] = []map [string ]interface {}{{}}
361
-
362
- // template.metadata
363
- {
364
- data := map [string ]interface {}{
365
- "finalizers" : v .Template .Metadata .Finalizers ,
366
- "labels" : v .Template .Metadata .Labels ,
367
- "annotations" : v .Template .Metadata .Annotations ,
368
- }
369
-
370
- obj ["template" ].([]map [string ]interface {})[0 ]["metadata" ] = []map [string ]interface {}{data }
371
- }
372
-
373
360
// template.spec
374
- {
375
- data := map [string ]interface {}{
376
- "unschedulable" : v .Template .Spec .Unschedulable ,
377
- }
378
-
379
- var taints []map [string ]interface {}
380
- for _ , taint := range v .Template .Spec .Taints {
381
- t := map [string ]interface {}{
382
- "effect" : taint .Effect .String (),
383
- "key" : taint .Key ,
384
- "value" : taint .Value ,
385
- }
361
+ specData := map [string ]interface {}{
362
+ "unschedulable" : v .Template .Spec .Unschedulable ,
363
+ }
386
364
387
- taints = append (taints , t )
365
+ var taints []map [string ]interface {}
366
+ for _ , taint := range v .Template .Spec .Taints {
367
+ t := map [string ]interface {}{
368
+ "effect" : taint .Effect .String (),
369
+ "key" : taint .Key ,
370
+ "value" : taint .Value ,
388
371
}
389
- data ["taints" ] = taints
390
372
391
- obj ["template" ].([]map [string ]interface {})[0 ]["spec" ] = []map [string ]interface {}{data }
373
+ taints = append (taints , t )
374
+ }
375
+ specData ["taints" ] = taints
376
+
377
+ obj ["template" ] = []map [string ]interface {}{
378
+ {
379
+ // template.metadata
380
+ "metadata" : []map [string ]interface {}{
381
+ {
382
+ "finalizers" : v .Template .Metadata .Finalizers ,
383
+ "labels" : v .Template .Metadata .Labels ,
384
+ "annotations" : v .Template .Metadata .Annotations ,
385
+ },
386
+ },
387
+ "spec" : []map [string ]interface {}{specData },
388
+ },
392
389
}
393
390
}
394
391
0 commit comments