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

Bug 1818021 - Implement observedDigest #842

Merged
merged 7 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app/plan/components/Wizard/VolumesForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const VolumesForm: React.FunctionComponent<IVolumesFormProps> = ({
}, []);

const discoveredPersistentVolumes = (currentPlan && currentPlan.spec.persistentVolumes) || [];

useEffect(() => {
if (discoveredPersistentVolumes.length > 0) {
getPVResourcesRequest(discoveredPersistentVolumes, values.sourceCluster || '');
Expand Down
1 change: 0 additions & 1 deletion src/app/plan/components/Wizard/WizardContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ const WizardContainer = withFormik<IOtherProps, IFormValues>({
return null;
},
validateOnBlur: false,
enableReinitialize: true,
})(WizardComponent);

const mapStateToProps = (state) => {
Expand Down
22 changes: 14 additions & 8 deletions src/app/plan/duck/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function* planUpdateRetry(action) {
JSON.stringify(getPlanRes.data.spec.srcMigClusterRef.name) !==
JSON.stringify(planValues.sourceCluster)
) {
const updatedPlanRes = yield client.patch(
yield client.patch(
new MigResource(MigResourceKind.MigPlan, migMeta.namespace),
getPlanRes.data.metadata.name,
updatedMigPlan
Expand Down Expand Up @@ -287,14 +287,20 @@ function* checkUpdatedPVs(action) {

if (updatedPlan) {
const isUpdatedPVList = () => {
const updatedGeneration = updatedPlan.metadata.generation;
const oldGeneration = currentPlan.metadata.generation;

//Generation check incremented twice: once for ui change, once for controller change.
if (isRerunPVDiscovery) {
return updatedGeneration >= oldGeneration + 2;
if (updatedPlan.status) {
if (isRerunPVDiscovery) {
const updatedGeneration = updatedPlan.status.observedDigest;
const oldGeneration = currentPlan.status.observedDigest;
if (updatedGeneration === oldGeneration) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update each of these return paths with a comment that describes the specific case?

return false;
} else {
return true;
}
} else {
return true;
}
} else {
return updatedGeneration > 1;
return false;
}
};

Expand Down