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

discard not yet reconciliated node disruption #73

Merged
merged 1 commit into from
Dec 12, 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
1 change: 1 addition & 0 deletions api/v1alpha1/nodedisruption_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type NamespacedName struct {
type NodeDisruptionState string

const (
Unknown NodeDisruptionState = ""
Pending NodeDisruptionState = "pending"
Granted NodeDisruptionState = "granted"
Rejected NodeDisruptionState = "rejected"
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/applicationdisruptionbudget_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ func (r *ApplicationDisruptionBudgetResolver) ResolveDisruption(ctx context.Cont
}

for _, nd := range nodeDisruptions.Items {
if nd.Status.State == nodedisruptionv1alpha1.Unknown {
// node disruption has just been created and hasn't been reconciliated yet
continue
}

impactedNodes, err := r.Resolver.GetNodeFromNodeSelector(ctx, nd.Spec.NodeSelector)
if err != nil {
return 0, disruptions, err
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/nodedisruption_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (ndr *SingleNodeDisruptionReconciler) Reconcile(ctx context.Context) (err e
func (ndr *SingleNodeDisruptionReconciler) TryTransitionState(ctx context.Context) (err error) {
logger := log.FromContext(ctx)
// If the state is unknown, switch it to Pending
if ndr.NodeDisruption.Status.State == "" {
if ndr.NodeDisruption.Status.State == nodedisruptionv1alpha1.Unknown {
ndr.NodeDisruption.Status.State = nodedisruptionv1alpha1.Pending

return err
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/nodedisruptionbudget_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ func (r *NodeDisruptionBudgetResolver) ResolveDisruption(ctx context.Context) (i
}

for _, nd := range nodeDisruptions.Items {
if nd.Status.State == nodedisruptionv1alpha1.Unknown {
// node disruption has just been created and hasn't been reconciliated yet
continue
}

impactedNodes, err := r.Resolver.GetNodeFromNodeSelector(ctx, nd.Spec.NodeSelector)
if err != nil {
return 0, disruptions, err
Expand Down
Loading