Skip to content

Commit 4bfbdd1

Browse files
fix: add addl tags for scale to 0 support for windows nodes (#315)
* fix: add addl tags for scale to 0 support for windows nodes Signed-off-by: Jonah Back <[email protected]> * move state lookup to initial var statement Signed-off-by: Jonah Back <[email protected]> * move instancetype lookup to initial var statement Signed-off-by: Jonah Back <[email protected]> * guard numberOfIp tag with nil check for networkInfo Signed-off-by: Jonah Back <[email protected]> Co-authored-by: Eytan Avisror <[email protected]>
1 parent ffdd96a commit 4bfbdd1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

controllers/provisioners/eks/helpers.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ func (ctx *EksInstanceGroupContext) GetAddedTags(asgName string) []*autoscaling.
287287
labels = ctx.GetComputedLabels()
288288
taints = configuration.GetTaints()
289289
osFamily = ctx.GetOsFamily()
290+
state = ctx.GetDiscoveredState()
291+
instanceTypeInfo = state.GetInstanceTypeInfo()
290292
)
291293

292294
tags = append(tags, ctx.AwsWorker.NewTag("Name", asgName, asgName))
@@ -302,6 +304,13 @@ func (ctx *EksInstanceGroupContext) GetAddedTags(asgName string) []*autoscaling.
302304
switch strings.ToLower(osFamily) {
303305
case OsFamilyWindows:
304306
tags = append(tags, ctx.AwsWorker.NewTag("k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/os", "windows", asgName))
307+
tags = append(tags, ctx.AwsWorker.NewTag("k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/arch", "amd64", asgName))
308+
309+
instanceTypeNetworkInfo := awsprovider.GetInstanceTypeNetworkInfo(instanceTypeInfo, configuration.InstanceType)
310+
if instanceTypeNetworkInfo != nil {
311+
numberOfIps := aws.Int64Value(instanceTypeNetworkInfo.Ipv4AddressesPerInterface) - 1
312+
tags = append(tags, ctx.AwsWorker.NewTag("k8s.io/cluster-autoscaler/node-template/resources/vpc.amazonaws.com/PrivateIPv4Address", strconv.FormatInt(numberOfIps, 10), asgName))
313+
}
305314
default:
306315
tags = append(tags, ctx.AwsWorker.NewTag("k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/os", "linux", asgName))
307316
}

0 commit comments

Comments
 (0)