Skip to content

Commit

Permalink
Remove PDB check in consistency controller (#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
edibble21 authored Dec 3, 2024
1 parent 4834838 commit f1190ba
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 123 deletions.
1 change: 0 additions & 1 deletion pkg/controllers/nodeclaim/consistency/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func NewController(clk clock.Clock, kubeClient client.Client, cloudProvider clou
recorder: recorder,
lastScanned: cache.New(scanPeriod, 1*time.Minute),
checks: []Check{
NewTermination(clk, kubeClient),
NewNodeShape(),
},
}
Expand Down
59 changes: 0 additions & 59 deletions pkg/controllers/nodeclaim/consistency/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package consistency_test

import (
"context"
"fmt"
"testing"
"time"

Expand All @@ -27,9 +26,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
clock "k8s.io/utils/clock/testing"
"sigs.k8s.io/controller-runtime/pkg/client"

"sigs.k8s.io/karpenter/pkg/apis"
v1 "sigs.k8s.io/karpenter/pkg/apis/v1"
Expand Down Expand Up @@ -88,62 +85,6 @@ var _ = Describe("NodeClaimController", func() {
BeforeEach(func() {
nodePool = test.NodePool()
})
Context("Termination", func() {
DescribeTable(
"Termination",
func(isNodeClaimManaged bool) {
nodeClaimOpts := []v1.NodeClaim{{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
v1.NodePoolLabelKey: nodePool.Name,
corev1.LabelInstanceTypeStable: "default-instance-type",
},
},
Status: v1.NodeClaimStatus{
ProviderID: test.RandomProviderID(),
Capacity: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("1"),
corev1.ResourceMemory: resource.MustParse("1Gi"),
corev1.ResourcePods: resource.MustParse("10"),
},
},
}}
if !isNodeClaimManaged {
nodeClaimOpts = append(nodeClaimOpts, v1.NodeClaim{
Spec: v1.NodeClaimSpec{
NodeClassRef: &v1.NodeClassReference{
Group: "karpenter.test.sh",
Kind: "UnmanagedNodeClass",
Name: "default",
},
},
})
}
nodeClaim, node := test.NodeClaimAndNode(nodeClaimOpts...)
podsLabels := map[string]string{"myapp": "deleteme"}
pdb := test.PodDisruptionBudget(test.PDBOptions{
Labels: podsLabels,
MaxUnavailable: &intstr.IntOrString{IntVal: 0, Type: intstr.Int},
})
nodeClaim.Finalizers = []string{"prevent.deletion/now"}
p := test.Pod(test.PodOptions{ObjectMeta: metav1.ObjectMeta{Labels: podsLabels}})
ExpectApplied(ctx, env.Client, nodePool, nodeClaim, node, p, pdb)
ExpectManualBinding(ctx, env.Client, p, node)
_ = env.Client.Delete(ctx, nodeClaim)
ExpectObjectReconciled(ctx, env.Client, nodeClaimConsistencyController, nodeClaim)
Expect(recorder.DetectedEvent(fmt.Sprintf("can't drain node, PDB %q is blocking evictions", client.ObjectKeyFromObject(pdb)))).To(Equal(isNodeClaimManaged))
nodeClaim = ExpectExists(ctx, env.Client, nodeClaim)
if isNodeClaimManaged {
Expect(nodeClaim.StatusConditions().Get(v1.ConditionTypeConsistentStateFound).IsFalse()).To(BeTrue())
} else {
Expect(nodeClaim.StatusConditions().Get(v1.ConditionTypeConsistentStateFound).IsUnknown()).To(BeTrue())
}
},
Entry("should detect issues with a node that is stuck deleting due to a PDB", true),
Entry("should ignore NodeClaims which aren't managed by this instance of Karpenter", false),
)
})

Context("Node Shape", func() {
DescribeTable(
"Node Shape",
Expand Down
63 changes: 0 additions & 63 deletions pkg/controllers/nodeclaim/consistency/termination.go

This file was deleted.

0 comments on commit f1190ba

Please sign in to comment.