diff --git a/packages/mco/components/modals/app-failover-relocate/argo-application-set.tsx b/packages/mco/components/modals/app-failover-relocate/argo-application-set.tsx index 164b16d3f..93d415cdf 100644 --- a/packages/mco/components/modals/app-failover-relocate/argo-application-set.tsx +++ b/packages/mco/components/modals/app-failover-relocate/argo-application-set.tsx @@ -141,14 +141,13 @@ export const ArogoApplicationSetModal = ( drPolicyName: getName(drPolicy), drPlacementControlName: getName(drPlacementControl), targetClusterName: getName(targetDRCluster), + primaryClusterName: getName(primaryCluster), isTargetClusterAvailable: !!targetClusterCondition, targetClusterAvailableTime: targetClusterCondition?.lastTransitionTime, isPrimaryClusterAvailable: !!primaryClusterCondition, isDRActionReady: checkDRActionReadiness(drPlacementControl, action), snapshotTakenTime: drPlacementControl?.status?.lastGroupSyncTime, - preferredCluster: drPlacementControl?.spec?.preferredCluster, - failoverCluster: drPlacementControl?.spec?.failoverCluster, replicationType: findDRType(drClusters), isTargetClusterFenced: isDRClusterFenced(targetDRCluster), isPrimaryClusterFenced: isDRClusterFenced(primaryDRCluster), diff --git a/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal-body.tsx b/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal-body.tsx index 7168fbf7c..5b3871c1c 100644 --- a/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal-body.tsx +++ b/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal-body.tsx @@ -299,9 +299,8 @@ export type PlacementProps = Partial<{ drPlacementControlName: string; targetClusterName: string; targetClusterAvailableTime: string; + primaryClusterName: string; snapshotTakenTime: string; - failoverCluster: string; - preferredCluster: string; isTargetClusterAvailable: boolean; isPrimaryClusterAvailable: boolean; isDRActionReady: boolean; diff --git a/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal.tsx b/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal.tsx index 66a33a477..ef555d396 100644 --- a/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal.tsx +++ b/packages/mco/components/modals/app-failover-relocate/failover-relocate-modal.tsx @@ -59,6 +59,7 @@ export const FailoverRelocateModal: React.FC = ( const onClick = () => { setFooterStatus(ModalFooterStatus.INPROGRESS); + // Prefered cluster and failover cluster should not be same for failover and relocate. const patch = [ { op: 'replace', @@ -67,11 +68,19 @@ export const FailoverRelocateModal: React.FC = ( }, { op: 'replace', - path: + path: '/spec/failoverCluster', + value: action === DRActionType.FAILOVER - ? '/spec/failoverCluster' - : '/spec/preferredCluster', - value: placement?.targetClusterName, + ? placement?.targetClusterName + : placement?.primaryClusterName, + }, + { + op: 'replace', + path: '/spec/preferredCluster', + value: + action === DRActionType.FAILOVER + ? placement?.primaryClusterName + : placement?.targetClusterName, }, ]; k8sPatch({ diff --git a/packages/mco/components/modals/app-failover-relocate/subscriptions/failover-relocate-modal.tsx b/packages/mco/components/modals/app-failover-relocate/subscriptions/failover-relocate-modal.tsx index 848a8b746..2069c0fa4 100644 --- a/packages/mco/components/modals/app-failover-relocate/subscriptions/failover-relocate-modal.tsx +++ b/packages/mco/components/modals/app-failover-relocate/subscriptions/failover-relocate-modal.tsx @@ -115,6 +115,11 @@ export const SubscriptionFailoverRelocateModal: React.FC { updateModalStatus(ModalFooterStatus.INPROGRESS); const promises: Promise[] = []; + const targetClusterName = + state.selectedTargetCluster.clusterInfo.clusterName; + const primaryClusterName = state.selectedDRPolicy.drClusters.find( + (drCluster) => drCluster !== targetClusterName + ); state.drPolicyControlState.forEach((acmToDRState) => { if ( state.selectedSubsGroups.includes( @@ -127,15 +132,21 @@ export const SubscriptionFailoverRelocateModal: React.FC