Skip to content

Commit

Permalink
fix: clarify state node logging (#1766)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschalo authored Oct 21, 2024
1 parent 402e477 commit ed8f88e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/controllers/disruption/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ var _ = Describe("Candidate Filtering", func() {
Expect(cluster.Nodes()).To(HaveLen(1))
_, err := disruption.NewCandidate(ctx, env.Client, recorder, fakeClock, cluster.Nodes()[0], pdbLimits, nodePoolMap, nodePoolInstanceTypeMap, queue, disruption.GracefulDisruptionClass)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal("state node does not have a nodeclaim representation"))
Expect(err.Error()).To(Equal("node is not managed by karpenter"))
})
It("should not consider candidate that has just a NodeClaim representation", func() {
nodeClaim, _ := test.NodeClaimAndNode(v1.NodeClaim{
Expand All @@ -1546,7 +1546,7 @@ var _ = Describe("Candidate Filtering", func() {
Expect(cluster.Nodes()).To(HaveLen(1))
_, err := disruption.NewCandidate(ctx, env.Client, recorder, fakeClock, cluster.Nodes()[0], pdbLimits, nodePoolMap, nodePoolInstanceTypeMap, queue, disruption.GracefulDisruptionClass)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal("state node does not have a node representation"))
Expect(err.Error()).To(Equal("nodeclaim does not have an associated node"))
})
It("should not consider candidates that are nominated", func() {
nodeClaim, node := test.NodeClaimAndNode(v1.NodeClaim{
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/state/statenode.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ func (in *StateNode) Pods(ctx context.Context, kubeClient client.Client) ([]*cor
//nolint:gocyclo
func (in *StateNode) ValidateNodeDisruptable(ctx context.Context, kubeClient client.Client) error {
if in.NodeClaim == nil {
return fmt.Errorf("state node does not have a nodeclaim representation")
return fmt.Errorf("node is not managed by karpenter")
}
if in.Node == nil {
return fmt.Errorf("state node does not have a node representation")
return fmt.Errorf("nodeclaim does not have an associated node")
}
if !in.Initialized() {
return fmt.Errorf("state node isn't initialized")
Expand Down

0 comments on commit ed8f88e

Please sign in to comment.