Skip to content

Commit

Permalink
respond to pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rschalo committed Jul 8, 2024
1 parent 4484dfb commit 9be1f46
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ test: ## Run tests
-cover -coverprofile=coverage.out -outputdir=. -coverpkg=./... \
--ginkgo.focus="${FOCUS}" \
--ginkgo.randomize-all \
--ginkgo.v \
--ginkgo.fail-fast \
--ginkgo.vv

deflake: ## Run randomized, racing tests until the test fails to catch flakes
ginkgo \
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ func (c *CloudProvider) instanceToNodeClaim(i *instance.Instance, instanceType *
if v, ok := i.Tags[corev1beta1.NodePoolLabelKey]; ok {
labels[corev1beta1.NodePoolLabelKey] = v
}
if v, ok := i.Tags[v1beta1.LabelNodeClass]; ok {
annotations[v1beta1.LabelNodeClass] = v
if v, ok := i.Tags[corev1beta1.NodePoolLabelKey]; ok {
annotations[corev1beta1.NodePoolLabelKey] = v
}
nodeClaim.Labels = labels
nodeClaim.Annotations = annotations
Expand Down
3 changes: 1 addition & 2 deletions pkg/controllers/nodeclaim/garbagecollection/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"fmt"
"time"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"github.com/awslabs/operatorpkg/singleton"
"github.com/samber/lo"
"go.uber.org/multierr"
Expand Down Expand Up @@ -62,7 +61,7 @@ func (c *Controller) Reconcile(ctx context.Context) (reconcile.Result, error) {
return reconcile.Result{}, fmt.Errorf("listing cloudprovider machines, %w", err)
}
managedRetrieved := lo.Filter(retrieved, func(nc *corev1beta1.NodeClaim, _ int) bool {
return nc.Annotations[v1beta1.LabelNodeClass] != "" && nc.DeletionTimestamp.IsZero()
return nc.Annotations[corev1beta1.NodePoolLabelKey] != "" && nc.DeletionTimestamp.IsZero()
})
nodeClaimList := &corev1beta1.NodeClaimList{}
if err = c.kubeClient.List(ctx, nodeClaimList); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions pkg/controllers/nodeclaim/garbagecollection/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ var _ = Describe("GarbageCollection", func() {
awsEnv.EC2API.Instances.Store(aws.StringValue(instance.InstanceId), instance)

ExpectSingletonReconciled(ctx, garbageCollectionController)
nc, err := cloudProvider.Get(ctx, providerID)
fmt.Println(nc)
_, err := cloudProvider.Get(ctx, providerID)
Expect(err).To(HaveOccurred())
Expect(corecloudprovider.IsNodeClaimNotFoundError(err)).To(BeTrue())
})
Expand Down Expand Up @@ -291,7 +290,7 @@ var _ = Describe("GarbageCollection", func() {
It("should not delete an instance if it was not launched by a NodeClaim", func() {
// Remove the nodepool tag (this isn't launched by a machine)
instance.Tags = lo.Reject(instance.Tags, func(t *ec2.Tag, _ int) bool {
return aws.StringValue(t.Key) == v1beta1.LabelNodeClass
return aws.StringValue(t.Key) == corev1beta1.NodePoolLabelKey
})

// Launch time was 1m ago
Expand Down

0 comments on commit 9be1f46

Please sign in to comment.