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

test: Fix bug #909

Closed
wants to merge 9 commits into from
Closed

test: Fix bug #909

wants to merge 9 commits into from

Conversation

zhiying-lin
Copy link
Contributor

Description of your changes

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@@ -180,24 +183,23 @@ func (r *Reconciler) Reconcile(ctx context.Context, req controllerruntime.Reques
Message: "All of the works are synchronized to the latest",
})
if workUpdated {
// revert the applied condition and failedPlacement if we made any changes to the work
resourceBinding.Status.FailedPlacements = nil
// revert the applied condition if we made any changes to the work
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only revert the applied? Where are applied and available set in this case? It seems they are both not there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we set the applied condition as false below. In that case, available condition nil means unknown.

In the CRP status, if the previous condition is not true, we will reset the remaining and leave them as "unknown".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why set it to false then? it seems that leaving it not set has the same effect?

Comment on lines +123 to +127
// Reset the conditions and failed placements.
for i := condition.OverriddenCondition; i < condition.TotalCondition; i++ {
resourceBinding.RemoveCondition(string(i.ResourceBindingConditionType()))
}
resourceBinding.Status.FailedPlacements = nil
Copy link
Contributor

@ryanzhang-oss ryanzhang-oss Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original design says the binding will always have all the conditions like CRP (unlike work). I am not sure if this will affect other component (i.e. CRP, rollout)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i remember it correctly, the original design is to keep the existing conditions there and only update the new ones. It won't affect other component and they all use "condition.IsConditionStatusTrue(availableCondition, binding.GetGeneration())". Nil will return false to the caller.

In the CRP code, we also reset all the existing conditions. https://github.com/Azure/fleet/blob/main/pkg/controllers/clusterresourceplacement/placement_status.go#L170

@ryanzhang-oss
Copy link
Contributor

Thanks for the help, @britaniar is resuming her PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants