Skip to content

Commit

Permalink
Ensure we label the node
Browse files Browse the repository at this point in the history
  • Loading branch information
bdwyertech committed Dec 5, 2021
1 parent 012320b commit e8537a3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pkg/cloudprovider/aws/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/aws/karpenter/pkg/cloudprovider"
"github.com/aws/karpenter/pkg/cloudprovider/aws/apis/v1alpha1"
"github.com/aws/karpenter/pkg/utils/injection"
"github.com/aws/karpenter/pkg/utils/resources"
)

type InstanceProvider struct {
Expand Down Expand Up @@ -236,11 +237,17 @@ func (p *InstanceProvider) instanceToNode(instance *ec2.Instance, instanceTypes
return &v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: aws.StringValue(instance.PrivateDnsName),
Labels: map[string]string{
v1.LabelTopologyZone: aws.StringValue(instance.Placement.AvailabilityZone),
v1.LabelInstanceTypeStable: aws.StringValue(instance.InstanceType),
v1alpha5.LabelCapacityType: getCapacityType(instance),
},
Labels: func() (labels map[string]string) {
labels = map[string]string{
v1.LabelTopologyZone: aws.StringValue(instance.Placement.AvailabilityZone),
v1.LabelInstanceTypeStable: aws.StringValue(instance.InstanceType),
v1alpha5.LabelCapacityType: getCapacityType(instance),
}
if instanceType.AWSPodENI() {
labels[resources.AWSPodENI] = "true"
}
return
}(),
},
Spec: v1.NodeSpec{
ProviderID: fmt.Sprintf("aws:///%s/%s", aws.StringValue(instance.Placement.AvailabilityZone), aws.StringValue(instance.InstanceId)),
Expand Down

0 comments on commit e8537a3

Please sign in to comment.