Skip to content

Commit 31b15bb

Browse files
authored
fixes to ng taints (#107)
1 parent f1b768f commit 31b15bb

File tree

4 files changed

+22
-39
lines changed

4 files changed

+22
-39
lines changed

cli/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import (
88
)
99

1010
func main() {
11-
_, exists := os.LookupEnv("BAAZ_URL")
12-
if !exists {
13-
log.Error("Env BAAZ_URL does not exist")
14-
os.Exit(1)
15-
}
11+
// _, exists := os.LookupEnv("BAAZ_URL")
12+
// if !exists {
13+
// log.Error("Env BAAZ_URL does not exist")
14+
// os.Exit(1)
15+
// }
1616
// _, exists := os.LookupEnv("BAAZ_USERNAME")
1717
// if !exists {
1818
// os.Exit(1)

cli/pkg/tenantsinfra/tenantsinfra.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ func CreateTenantsInfra(filePath string, dataplane string) (string, error) {
206206
return "", err
207207
}
208208

209-
fmt.Println(string(tiByte))
210-
211-
fmt.Println(makeTenantInfraPath(dataplane))
212209
resp, err := http.Post(
213210
makeTenantInfraPath(dataplane),
214211
"application/json",

internal/tenantinfra_controller/aws_eks.go

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func (ae *awsEnv) ReconcileInfraTenants() error {
9898
if err != nil {
9999
return err
100100
}
101+
101102
if !found {
102103
nodeRole, err := ae.eksIC.CreateNodeIamRole(nodeName)
103104
if err != nil {
@@ -106,7 +107,6 @@ func (ae *awsEnv) ReconcileInfraTenants() error {
106107
if nodeRole.Role == nil {
107108
return errors.New("node role is nil")
108109
}
109-
110110
subnet := getNodeGroupSubnet(ae.tenantsInfra, ae.dp)
111111

112112
createNodeGroupOutput, err := ae.eksIC.CreateNodegroup(ae.getNodegroupInput(nodeName, *nodeRole.Role.Arn, subnet, &machineSpec))
@@ -176,6 +176,18 @@ func (ae *awsEnv) ReconcileInfraTenants() error {
176176
if describeNodegroupOutput != nil &&
177177
describeNodegroupOutput.Nodegroup != nil &&
178178
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+
}
179191
if err := ae.patchStatus(*describeNodegroupOutput.Nodegroup.NodegroupName, &v1.NodegroupStatus{
180192
Status: string(describeNodegroupOutput.Nodegroup.Status),
181193
Subnet: describeNodegroupOutput.Nodegroup.Subnets[0],
@@ -340,40 +352,13 @@ func newClientset(cluster *types.Cluster) (*kubernetes.Clientset, error) {
340352
return clientset, nil
341353
}
342354

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-
372355
func (ae *awsEnv) getNodegroupInput(nodeName, roleArn, subnet string, machineSpec *v1.MachineSpec) (input *awseks.CreateNodegroupInput) {
373356

374357
var taints = &[]types.Taint{}
375358

376-
taints = makeTaints(nodeName)
359+
if machineSpec.StrictScheduling == v1.StrictSchedulingStatusEnable {
360+
taints = makeTaints(nodeName)
361+
}
377362

378363
var capacityType types.CapacityTypes
379364
if machineSpec.Type == v1.MachineTypeLowPriority {

pkg/aws/eks/system.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func (ec *eks) DescribeNodegroup(nodeGroupName string) (output *awseks.DescribeN
3636
}
3737
return nil, false, err
3838
}
39+
3940
return describeNodeGroupOutput, true, nil
4041
}
4142

0 commit comments

Comments
 (0)