Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove provisional image drift implementation #90

Merged
merged 5 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,7 @@ func (c *CloudProvider) IsDrifted(ctx context.Context, nodeClaim *corev1beta1.No
if imageVersionDrifted != "" {
return imageVersionDrifted, nil
}
imageDrifted, err := c.isImageDrifted(ctx, nodeClaim, nodePool, nodeClass)
if err != nil {
return "", err
}
return imageDrifted, nil
return "", nil
}

// Name returns the CloudProvider implementation name.
Expand Down
19 changes: 0 additions & 19 deletions pkg/cloudprovider/drift.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/Azure/karpenter/pkg/apis/v1alpha2"
"github.com/Azure/karpenter/pkg/providers/imagefamily"
"github.com/Azure/karpenter/pkg/utils"
"github.com/samber/lo"

v1 "k8s.io/api/core/v1"

Expand Down Expand Up @@ -125,21 +124,3 @@ func (c *CloudProvider) isImageVersionDrifted(
}
return "", nil
}

// TODO: remove nolint on unparam. Added for now in order to pass "make verify"
// nolint: unparam
func (c *CloudProvider) isImageDrifted(
ctx context.Context, nodeClaim *corev1beta1.NodeClaim, nodePool *corev1beta1.NodePool, _ *v1alpha2.AKSNodeClass) (cloudprovider.DriftReason, error) {
instanceTypes, err := c.GetInstanceTypes(ctx, nodePool)
if err != nil {
return "", fmt.Errorf("getting instanceTypes, %w", err)
}
_, found := lo.Find(instanceTypes, func(instType *cloudprovider.InstanceType) bool {
return instType.Name == nodeClaim.Labels[v1.LabelInstanceTypeStable]
})
if !found {
return "", fmt.Errorf(`finding node instance type "%s"`, nodeClaim.Labels[v1.LabelInstanceTypeStable])
}

return "", nil
}
7 changes: 0 additions & 7 deletions pkg/cloudprovider/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ var _ = Describe("CloudProvider", func() {
Expect(err).ToNot(HaveOccurred())
Expect(drifted).To(BeEmpty())
})
It("should error if the NodeClaim doesn't have the instance-type label", func() {
nodeClaim.Labels = map[string]string{
corev1beta1.NodePoolLabelKey: nodePool.Name,
}
_, err := cloudProvider.IsDrifted(ctx, nodeClaim)
Expect(err).To(HaveOccurred())
})
It("should error drift if NodeClaim doesn't have provider id", func() {
nodeClaim.Status = corev1beta1.NodeClaimStatus{}
drifted, err := cloudProvider.IsDrifted(ctx, nodeClaim)
Expand Down