-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: enable work generator to process apply strategy updates + DiffReported condition #1016
base: main
Are you sure you want to change the base?
Conversation
@@ -700,15 +703,16 @@ func (r *Reconciler) upsertWork(ctx context.Context, newWork, existingWork *flee | |||
} else { | |||
// we already checked the label in fetchAllResourceSnapShots function so no need to check again | |||
resourceIndex, _ := labels.ExtractResourceIndexFromClusterResourceSnapshot(resourceSnapshot) | |||
if workResourceIndex == resourceIndex { | |||
// no need to do anything if the work is generated from the same resource/override snapshots | |||
if workResourceIndex == resourceIndex && equality.Semantic.DeepEqual(existingWork.Spec.ApplyStrategy, newWork.Spec.ApplyStrategy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also check applyStrategy in the areAllWorkSynced() function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is actually a tricky one; to avoid apply strategy inconsistencies the refresh has to be handled before the check. I will some edits
It("can update work status", func() { | ||
work := retrieveWork(memberClusterNamespaceName, fmt.Sprintf(placementv1beta1.FirstWorkNameFmt, testCRPName)) | ||
|
||
diffReportedCond := &metav1.Condition{ | ||
Type: string(placementv1beta1.WorkConditionTypeDiffReported), | ||
Status: metav1.ConditionTrue, | ||
Reason: string(workapplier.ManifestProcessingReportDiffResultTypeNoDiffFound), | ||
ObservedGeneration: work.GetGeneration(), | ||
} | ||
refreshWorkStatus(work, nil, nil, diffReportedCond, nil) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we won't need this (which simulated a behavior of another controller) if we explicitly set the applied to be false ourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ryan! Part of the code tests the status populator, which is why the condition is being set (summarizing all DiffReported
conditions from work objects).
Description of your changes
This PR:
a) fixes the issue where work generator will not refresh apply strategies; and
b) enables work generator to process
DiffReported
conditionI have:
make reviewable
to ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer
E2E tests can only be added when the new work applier is enabled.