Bug 2179308

Summary: [RFE] Block disable DR for the application when peer is not ready
Product: [Red Hat Storage] Red Hat OpenShift Data Foundation Reporter: gowtham <gshanmug>
Component: management-consoleAssignee: Timothy Asir <tjeyasin>
Status: CLOSED NOTABUG QA Contact: Prasad Desala <tdesala>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.13CC: kramdoss, ocs-bugs, odf-bz-bot, skatiyar
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-28 08:17:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description gowtham 2023-03-17 09:47:27 UTC
Description of problem (please be detailed as possible and provide log
snippests):
The current 4.13 UI is allowing disabling DR at any time. Users can trigger disable DR for any applicationSet even if the DRPC peer is not in a peer-ready state.

Version of all relevant components (if applicable):


Does this issue impact your ability to continue to work with the product
(please explain in detail what is the user impact)?


Is there any workaround available to the best of your knowledge?


Rate from 1 - 5 the complexity of the scenario you performed that caused this
bug (1 - very simple, 5 - very complex)?


Can this issue reproducible?


Can this issue reproduce from the UI?
100%

If this is a regression, please provide more details to justify this:


Steps to Reproduce:
1. Configure GitOPS server

---
# Create cluster Set in openshift-gitops namespace
apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSet
metadata:
  name: all-openshift-clusters
spec:
  clusterSelector:
    labelSelector: 
      matchLabels:
        vendor: OpenShift
    selectorType: LabelSelector

---
# Creates a ManagedClusterSetBinding to the openshift-gitops project
apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSetBinding
metadata:
  name: all-openshift-clusters
  namespace: openshift-gitops
spec:
  clusterSet: all-openshift-clusters

---
# Create placement to choose managed clusters from cluster set
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
  name: all-openshift-clusters
  namespace: openshift-gitops
spec:
  predicates:
  - requiredClusterSelector:
      labelSelector:
        matchExpressions:
        - key: vendor
          operator: "In"
          values:
          - OpenShift
---
# Creates a gitopscluster resource
# Requires: Openshift-GitOps operator be installed in the project "openshift-gitops"
apiVersion: apps.open-cluster-management.io/v1beta1
kind: GitOpsCluster
metadata:
  name: gitops-cluster-sample
  namespace: openshift-gitops
spec:
  argoServer:
    cluster: local-cluster
    argoNamespace: openshift-gitops
  placementRef:
    kind: Placement
    apiVersion: cluster.open-cluster-management.io/v1beta1
    name: all-openshift-clusters

---


2. Create ApplicationSet type application from ACM application page.

3. Apply DRPolicy to this newly created application using "Manage ApplicationSet" dual list selection modal. (Move applicaitonSet from left to right and click save).

4. Once the application is protected, down the target cluster will make the peer not ready.

5. Try to disable DR using the same "Manage ApplicationSet" dual list selection modal. (Move applicaitonSet from right to left and click save).


Actual results:
UI allows the user to disable DR even when a peer is not in a ready state.

Expected results:
UI should block and disable DR operation when a peer is not in a ready state.

Additional info:
Allow disabling only when the below conditions are satisfied(status: 'True') in DRPC CR:
status:
  conditions:
    - lastTransitionTime: '2023-03-17T09:28:11Z'
      message: Ready
      observedGeneration: 1
      reason: Success
      status: 'True'
      type: PeerReady
    - lastTransitionTime: '2023-03-17T09:28:11Z'
      message: Initial deployment completed
      observedGeneration: 1
      reason: Deployed
      status: 'True'
      type: Available