Skip to content

Conversation

@michaelawyu
Copy link
Contributor

Description of your changes

Full draft for new feature.

I have:

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

How has this code been tested

Special notes for your reviewer

@michaelawyu michaelawyu marked this pull request as draft December 24, 2024 01:52
Comment on lines +126 to +135

if !utils.IsDriftedResourcePlacementEqual(oldBinding.Status.DriftedPlacements, newBinding.Status.DriftedPlacements) {
klog.V(2).InfoS("The binding drifted placement has changed, need to update the corresponding CRP", "oldBinding", klog.KObj(oldBinding), "newBinding", klog.KObj(newBinding))
return true
}

if !utils.IsDiffedResourcePlacementEqual(oldBinding.Status.DiffedPlacements, newBinding.Status.DiffedPlacements) {
klog.V(2).InfoS("The binding diffed placement has changed, need to update the corresponding CRP", "oldBinding", klog.KObj(oldBinding), "newBinding", klog.KObj(newBinding))
return true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any e2e cover this case?

status.DriftedPlacements = binding.Status.DriftedPlacements
}
}
// Drifts are reported regardless of the status of the Applied condition.
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any e2e cover this case?

Comment on lines +866 to +870
func (r *Reconciler) processApplyStrategyUpdates(
ctx context.Context,
crp *fleetv1beta1.ClusterResourcePlacement,
allBindings []*fleetv1beta1.ClusterResourceBinding,
) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the parameters are mostly on one line the rest of the file

Comment on lines +168 to +177
// Update the CRP with a new apply strategy.
rolloutCRP.Spec.Strategy.ApplyStrategy = &fleetv1beta1.ApplyStrategy{
ComparisonOption: fleetv1beta1.ComparisonOptionTypeFullComparison,
WhenToApply: fleetv1beta1.WhenToApplyTypeIfNotDrifted,
WhenToTakeOver: fleetv1beta1.WhenToTakeOverTypeIfNoDiff,
Type: fleetv1beta1.ApplyStrategyTypeServerSideApply,
ServerSideApplyConfig: &fleetv1beta1.ServerSideApplyConfig{
ForceConflicts: true,
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

how about add a case the CRP changed but no applyStrategy related change?

Comment on lines +362 to +363
5,
4,
Copy link
Contributor

Choose a reason for hiding this comment

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

where do those magic number come from?

ignoreFieldTypeMetaInNamespace = cmpopts.IgnoreFields(corev1.Namespace{}, "TypeMeta")
)

func TestMain(m *testing.M) {
Copy link
Contributor

Choose a reason for hiding this comment

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

where is this function called?


fleetv1beta1 "go.goms.io/fleet/apis/placement/v1beta1"
)

Copy link
Contributor

Choose a reason for hiding this comment

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

how many old test cases do we have to make sure whatever we have is backward compatible?

Comment on lines +4053 to +4062
appliedResourceMeta := []fleetv1beta1.AppliedResourceMeta{
{
WorkResourceIdentifier: fleetv1beta1.WorkResourceIdentifier{
Version: "v1",
Kind: "Namespace",
Resource: "namespaces",
Name: nsName,
},
UID: regularNS.UID,
},
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 that NS is applied when the option is "reportDiffOnly"?

Comment on lines +4002 to +4012
{
Type: fleetv1beta1.WorkConditionTypeApplied,
Status: metav1.ConditionTrue,
Reason: string(ManifestProcessingApplyResultTypeNoDiffFound),
ObservedGeneration: 0,
},
{
Type: fleetv1beta1.WorkConditionTypeAvailable,
Status: metav1.ConditionTrue,
Reason: string(ManifestProcessingAvailabilityResultTypeAvailable),
ObservedGeneration: 0,
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 the namespace applied/available?

Message: ManifestProcessingApplyResultTypeAppliedWithFailedDriftDetectionDescription,
ObservedGeneration: inMemberClusterObjGeneration,
}
case appliedResTyp == ManifestProcessingApplyResultTypeNoDiffFound:
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not seem to be right when the apply Type is ApplyStrategyTypeReportDiff. No diff does not mean applied == true

@michaelawyu
Copy link
Contributor Author

Closing this PR as the main part has been checked in.

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