Skip to content

feat: enable work generator to process apply strategy updates + DiffReported condition#1016

Merged
michaelawyu merged 16 commits intoAzure:mainfrom
michaelawyu:feat/wg-2
Feb 14, 2025
Merged

feat: enable work generator to process apply strategy updates + DiffReported condition#1016
michaelawyu merged 16 commits intoAzure:mainfrom
michaelawyu:feat/wg-2

Conversation

@michaelawyu
Copy link
Contributor

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 condition

I have:

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

How has this code been tested

  • Unit tests
  • Integration tests

Special notes for your reviewer

E2E tests can only be added when the new work applier is enabled.

if err != nil {
return err
}
if updated {
Copy link
Contributor

Choose a reason for hiding this comment

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

this will revert the applied condition on the binding. It seems that it's fine but please think through.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Ryan! I've been given this some more thought; this would only happen when the apply strategy does change, which should justify the the reset of the Applied condition; for partial failures the reset also seems to make sense (i.e., works are not even synchronized).

Copy link
Contributor

Choose a reason for hiding this comment

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

for example, if the applyStrategy flipped allow Co-own from true to false, would it trigger any change on the workApplier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Ryan! It might be (if a custom owner has been added before).

@michaelawyu
Copy link
Contributor Author

Latest incorporated changes:

  • Apply strategy is always updated
  • The work generator will now populate Applied + Available condition if the apply strategy is CSA/SSA; or DiffReported condition if ReportDiff.
  • Failures, drifts, diffs are being populated based on the True/False/stale status of the Applied/Available/DiffReported conditions plus the apply strategy in use to make sure that stale failures/drifts/diffs will not leak into the new round of status reporting.
  • Added various new tests to verify the new behavior change.


driftedManifests := extractDriftedResourcePlacementsFromWork(w)
driftedResourcePlacements = append(driftedResourcePlacements, driftedManifests...)
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't it better to explicitly have a case for that and then add an unexpected error in the default case so that we know we didn't miss anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it; will send a subsequent PR.

Copy link
Contributor

@ryanzhang-oss ryanzhang-oss left a comment

Choose a reason for hiding this comment

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

Please address the comments on a follow up PR

@michaelawyu michaelawyu merged commit 9b8ed76 into Azure:main Feb 14, 2025
12 checks passed
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.

2 participants