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

feat: tweak the condition behaviors in the new work applier #1039

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michaelawyu
Copy link
Contributor

Description of your changes

This PR tweaks how the new work applier sets conditions for the Work objects and their manifests.

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

// Some exported reasons. Currently only the untrackable reason is being actively used.
WorkNotTrackableReason = string(ManifestProcessingAvailabilityResultTypeNotTrackable)
// Some exported reasons for Work object conditions. Currently only the untrackable reason is being actively used.
WorkNotAllManfestsTrackableReason = "SomeManifestsAreNotAvailabilityTrackable"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
WorkNotAllManfestsTrackableReason = "SomeManifestsAreNotAvailabilityTrackable"
WorkNotAllManifestsTrackableReason = "SomeManifestsAreNotAvailabilityTrackable"

Comment on lines +151 to +153
if isManifestObjectDiffReported(bundle.reportDiffResTyp) {
diffReportedObjectsCount++
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why Is there no UT test change related to this change that count "both diff and noDiff as reported"

}

if work.Status.Conditions == nil {
work.Status.Conditions = []metav1.Condition{}
}
setWorkAppliedCondition(work, manifestCount, appliedManifestsCount)
setWorkAvailableCondition(work, manifestCount, availableAppliedObjectsCount, untrackableAppliedObjectsCount)
setWorkDiffReportedCondition(work, manifestCount, diffedObjectsCount)
setWorkAvailableCondition(work, manifestCount, appliedManifestsCount, availableAppliedObjectsCount, untrackableAppliedObjectsCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: what if the appliedCondition (say false) does not agree with appliedManifestsCount (say == manifestCount)? I think it's slightly better to use the output of the setWorkAppliedCondition to determine the appliedCondition than using "appliedManifestsCount" as they are two source of truth

Comment on lines +275 to +281
if appliedCond != nil {
meta.SetStatusCondition(&manifestCond.Conditions, *appliedCond)
} else {
// As the conditions are ported back; removal must be performed if the DiffReported
// condition is not set.
meta.RemoveStatusCondition(&manifestCond.Conditions, fleetv1beta1.WorkConditionTypeApplied)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any test changes that is related to most of the changes in this file

Comment on lines +451 to +452
case appliedManifestCount != manifestCount:
// Not all manifests have been applied; skip updating the Available condition.
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, no test change needed?

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