Skip to content

Commit

Permalink
chore: Drop NodePool Owner Key from codebase (#5138)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis authored Nov 22, 2023
1 parent fe636df commit f127d0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/avast/retry-go v3.0.0+incompatible
github.com/aws/aws-sdk-go v1.48.0
github.com/aws/karpenter-core v0.32.2-0.20231121214117-c23727be4ae6
github.com/aws/karpenter-core v0.32.2-0.20231122223643-d0156e68fd30
github.com/aws/karpenter/tools/kompat v0.0.0-20231010173459-62c25a3ea85c
github.com/go-logr/zapr v1.3.0
github.com/imdario/mergo v0.3.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHS
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/aws/aws-sdk-go v1.48.0 h1:1SeJ8agckRDQvnSCt1dGZYAwUaoD2Ixj6IaXB4LCv8Q=
github.com/aws/aws-sdk-go v1.48.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/karpenter-core v0.32.2-0.20231121214117-c23727be4ae6 h1:GCHU/rgMTph307DflPV7GnstyXhBY4EkeuBZtbuJsYg=
github.com/aws/karpenter-core v0.32.2-0.20231121214117-c23727be4ae6/go.mod h1:gK9w/cwNREE8BXh41nEJ9Qsls4E5KalPVgGTdH1Kxaw=
github.com/aws/karpenter-core v0.32.2-0.20231122223643-d0156e68fd30 h1:kasY2OTqjHEbTGyZD22emDCFyb9g4HaVeEhY6VCMZzc=
github.com/aws/karpenter-core v0.32.2-0.20231122223643-d0156e68fd30/go.mod h1:gK9w/cwNREE8BXh41nEJ9Qsls4E5KalPVgGTdH1Kxaw=
github.com/aws/karpenter/tools/kompat v0.0.0-20231010173459-62c25a3ea85c h1:oXWwIttmjYLbBKhLazG21aQvpJ3NOOr8IXhCJ/p6e/M=
github.com/aws/karpenter/tools/kompat v0.0.0-20231010173459-62c25a3ea85c/go.mod h1:l/TIBsaCx/IrOr0Xvlj/cHLOf05QzuQKEZ1hx2XWmfU=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
11 changes: 7 additions & 4 deletions pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"knative.dev/pkg/logging"
"sigs.k8s.io/controller-runtime/pkg/client"

nodeclaimutil "github.com/aws/karpenter-core/pkg/utils/nodeclaim"
cloudproviderevents "github.com/aws/karpenter/pkg/cloudprovider/events"
"github.com/aws/karpenter/pkg/providers/amifamily"
"github.com/aws/karpenter/pkg/providers/instance"
Expand Down Expand Up @@ -194,9 +193,13 @@ func (c *CloudProvider) Delete(ctx context.Context, nodeClaim *corev1beta1.NodeC

func (c *CloudProvider) IsDrifted(ctx context.Context, nodeClaim *corev1beta1.NodeClaim) (cloudprovider.DriftReason, error) {
// Not needed when GetInstanceTypes removes nodepool dependency
nodePool, err := nodeclaimutil.Owner(ctx, c.kubeClient, nodeClaim)
if err != nil {
return "", client.IgnoreNotFound(fmt.Errorf("resolving owner, %w", err))
nodePoolName, ok := nodeClaim.Labels[corev1beta1.NodePoolLabelKey]
if !ok {
return "", nil
}
nodePool := &corev1beta1.NodePool{}
if err := c.kubeClient.Get(ctx, types.NamespacedName{Name: nodePoolName}, nodePool); err != nil {
return "", client.IgnoreNotFound(err)
}
if nodePool.Spec.Template.Spec.NodeClassRef == nil {
return "", nil
Expand Down

0 comments on commit f127d0b

Please sign in to comment.