Skip to content

Commit

Permalink
panics
Browse files Browse the repository at this point in the history
  • Loading branch information
njtran committed Oct 11, 2023
1 parent a6d3838 commit f438d0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/deprovisioning/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (c *Controller) Reconcile(ctx context.Context, _ reconcile.Request) (reconc
// while it progresses in memory. If Karpenter restarts during a deprovisioning action, some nodes can be left tainted.
// Idempotently remove this taint from candidates before continuing.
nodeClaimStateNodes := lo.Filter(c.cluster.Nodes(), func(s *state.StateNode, _ int) bool {
return !s.NodeClaim.IsMachine
return s.NodeClaim != nil && !s.NodeClaim.IsMachine
})
if err := c.requireNoScheduleTaint(ctx, false, nodeClaimStateNodes...); err != nil {
return reconcile.Result{}, fmt.Errorf("removing disruption taint from nodes, %w", err)
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 @@ -98,7 +98,7 @@ type StateNode struct {
// TODO remove this when v1alpha5 APIs are deprecated. With v1beta1 APIs Karpenter relies on the existence
// of the karpenter.sh/disruption taint to know when a node is marked for deletion.
markedForDeletion bool
nominatedUntil metav1.Time
nominatedUntil metav1.Time
}

func NewNode() *StateNode {
Expand Down Expand Up @@ -350,7 +350,7 @@ func (in *StateNode) MarkedForDeletion() bool {
return v1beta1.DisruptionNoScheduleTaint.MatchTaint(&taint)
})
// TODO remove check for machine after v1alpha5 APIs are dropped.
return lo.Ternary(in.NodeClaim.IsMachine, in.markedForDeletion, ok) ||
return lo.Ternary(in.NodeClaim != nil && in.NodeClaim.IsMachine, in.markedForDeletion, ok) ||
(in.NodeClaim != nil && !in.NodeClaim.DeletionTimestamp.IsZero()) ||
(in.Node != nil && in.NodeClaim == nil && !in.Node.DeletionTimestamp.IsZero())
}
Expand Down

0 comments on commit f438d0e

Please sign in to comment.