Skip to content

Commit

Permalink
chore: Scope list call with EC2NodeClass tag (#5545)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis authored Jan 29, 2024
1 parent 0c90c4f commit 8eb4f0f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/controllers/nodeclaim/garbagecollection/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ var _ = Describe("GarbageCollection", func() {
Key: aws.String(corev1beta1.NodePoolLabelKey),
Value: aws.String(nodePool.Name),
},
{
Key: aws.String(v1beta1.LabelNodeClass),
Value: aws.String(nodeClass.Name),
},
{
Key: aws.String(corev1beta1.ManagedByAnnotationKey),
Value: aws.String(options.FromContext(ctx).ClusterName),
Expand Down Expand Up @@ -175,6 +179,10 @@ var _ = Describe("GarbageCollection", func() {
Key: aws.String(corev1beta1.NodePoolLabelKey),
Value: aws.String("default"),
},
{
Key: aws.String(v1beta1.LabelNodeClass),
Value: aws.String("default"),
},
{
Key: aws.String(corev1beta1.ManagedByAnnotationKey),
Value: aws.String(options.FromContext(ctx).ClusterName),
Expand Down
4 changes: 4 additions & 0 deletions pkg/providers/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ func (p *Provider) List(ctx context.Context) ([]*Instance, error) {
Name: aws.String("tag-key"),
Values: aws.StringSlice([]string{corev1beta1.NodePoolLabelKey}),
},
{
Name: aws.String("tag-key"),
Values: aws.StringSlice([]string{v1beta1.LabelNodeClass}),
},
{
Name: aws.String("tag-key"),
Values: aws.StringSlice([]string{fmt.Sprintf("kubernetes.io/cluster/%s", options.FromContext(ctx).ClusterName)}),
Expand Down
4 changes: 4 additions & 0 deletions pkg/providers/instance/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ var _ = Describe("InstanceProvider", func() {
Key: aws.String(corev1beta1.NodePoolLabelKey),
Value: aws.String("default"),
},
{
Key: aws.String(v1beta1.LabelNodeClass),
Value: aws.String("default"),
},
{
Key: aws.String(corev1beta1.ManagedByAnnotationKey),
Value: aws.String(options.FromContext(ctx).ClusterName),
Expand Down
5 changes: 5 additions & 0 deletions test/suites/nodeclaim/garbage_collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
corev1beta1 "sigs.k8s.io/karpenter/pkg/apis/v1beta1"
coretest "sigs.k8s.io/karpenter/pkg/test"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
awserrors "github.com/aws/karpenter-provider-aws/pkg/errors"
"github.com/aws/karpenter-provider-aws/pkg/utils"
environmentaws "github.com/aws/karpenter-provider-aws/test/pkg/environment/aws"
Expand Down Expand Up @@ -84,6 +85,10 @@ var _ = Describe("GarbageCollection", func() {
Key: aws.String(corev1beta1.NodePoolLabelKey),
Value: aws.String(nodePool.Name),
},
{
Key: aws.String(v1beta1.LabelNodeClass),
Value: aws.String(nodeClass.Name),
},
},
},
},
Expand Down

0 comments on commit 8eb4f0f

Please sign in to comment.