@@ -98,6 +98,7 @@ func (ae *awsEnv) ReconcileInfraTenants() error {
98
98
if err != nil {
99
99
return err
100
100
}
101
+
101
102
if ! found {
102
103
nodeRole , err := ae .eksIC .CreateNodeIamRole (nodeName )
103
104
if err != nil {
@@ -106,7 +107,6 @@ func (ae *awsEnv) ReconcileInfraTenants() error {
106
107
if nodeRole .Role == nil {
107
108
return errors .New ("node role is nil" )
108
109
}
109
-
110
110
subnet := getNodeGroupSubnet (ae .tenantsInfra , ae .dp )
111
111
112
112
createNodeGroupOutput , err := ae .eksIC .CreateNodegroup (ae .getNodegroupInput (nodeName , * nodeRole .Role .Arn , subnet , & machineSpec ))
@@ -176,6 +176,18 @@ func (ae *awsEnv) ReconcileInfraTenants() error {
176
176
if describeNodegroupOutput != nil &&
177
177
describeNodegroupOutput .Nodegroup != nil &&
178
178
len (describeNodegroupOutput .Nodegroup .Subnets ) > 0 {
179
+
180
+ fmt .Println (describeNodegroupOutput .Nodegroup .ScalingConfig .MinSize )
181
+ if describeNodegroupOutput .Nodegroup .ScalingConfig .MinSize != & machineSpec .Min {
182
+ ae .eksIC .UpdateNodegroup (& awseks.UpdateNodegroupConfigInput {
183
+ ClusterName : describeNodegroupOutput .Nodegroup .ClusterName ,
184
+ NodegroupName : describeNodegroupOutput .Nodegroup .NodegroupName ,
185
+ ScalingConfig : & types.NodegroupScalingConfig {
186
+ MinSize : & machineSpec .Min ,
187
+ MaxSize : & machineSpec .Max ,
188
+ },
189
+ })
190
+ }
179
191
if err := ae .patchStatus (* describeNodegroupOutput .Nodegroup .NodegroupName , & v1.NodegroupStatus {
180
192
Status : string (describeNodegroupOutput .Nodegroup .Status ),
181
193
Subnet : describeNodegroupOutput .Nodegroup .Subnets [0 ],
@@ -340,40 +352,13 @@ func newClientset(cluster *types.Cluster) (*kubernetes.Clientset, error) {
340
352
return clientset , nil
341
353
}
342
354
343
- // func (ae *awsEnv) getNodeSpecForTenantSize(tenantConfig v1.TenantApplicationConfig) (*[]v1.MachineSpec, error) {
344
-
345
- // // cm := corev1.ConfigMap{}
346
- // // if err := ae.client.Get(
347
- // // ae.ctx,
348
- // // k8stypes.NamespacedName{Name: "tenant-sizes", Namespace: "kube-system"},
349
- // // &cm,
350
- // // ); err != nil {
351
- // // return nil, err
352
- // // }
353
- // // sizeJson := cm.Data["size.json"]
354
-
355
- // // var tenantInfraAppSize v1.TenantInfraAppSize
356
-
357
- // // err := json.Unmarshal([]byte(sizeJson), &tenantInfraAppSize)
358
-
359
- // // if err != nil {
360
- // // return nil, err
361
- // // }
362
-
363
- // for _, size := range tenantInfraAppSize.TenantSizes {
364
- // if size.Name == tenantConfig.Size {
365
- // return &size.MachineSpec, nil
366
- // }
367
- // }
368
-
369
- // return nil, fmt.Errorf("no NodegroupSpec for app %s & size %s", tenantConfig.AppType, tenantConfig.Size)
370
- // }
371
-
372
355
func (ae * awsEnv ) getNodegroupInput (nodeName , roleArn , subnet string , machineSpec * v1.MachineSpec ) (input * awseks.CreateNodegroupInput ) {
373
356
374
357
var taints = & []types.Taint {}
375
358
376
- taints = makeTaints (nodeName )
359
+ if machineSpec .StrictScheduling == v1 .StrictSchedulingStatusEnable {
360
+ taints = makeTaints (nodeName )
361
+ }
377
362
378
363
var capacityType types.CapacityTypes
379
364
if machineSpec .Type == v1 .MachineTypeLowPriority {
0 commit comments