Bug 2122954 - Validation of DRPolicy without any DRClusters passess
Summary: Validation of DRPolicy without any DRClusters passess
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat OpenShift Data Foundation
Classification: Red Hat Storage
Component: odf-dr
Version: 4.11
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ODF 4.12.0
Assignee: rakesh
QA Contact: Shrivaibavi Raghaventhiran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-31 12:25 UTC by Martin Bukatovic
Modified: 2023-08-09 17:00 UTC (History)
8 users (show)

Fixed In Version: 4.12.0-152
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-02-08 14:06:28 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github red-hat-storage ramen pull 67 0 None Merged Merge upstream main to downstream 2022-09-28 17:34:20 UTC

Description Martin Bukatovic 2022-08-31 12:25:58 UTC
Description of problem
======================

Validation of DRPolicy without any DRClusters passess, but it would make more
sense if it failed, so that the validation is aligned with ODF DR web UI, which
doesn't allow one to create such empty policy.

Version-Release number of selected component
============================================

OCP:
- c1: 4.11.0-0.nightly-2022-08-19-151011
- c2: 4.11.0-0.nightly-2022-08-19-091806
- hub 4.11.0-0.nightly-2022-08-19-151011

ACM 2.5.1
ODF 4.11.0-137 (4.11 GA)

How reproducible
================

100%

Steps to Reproduce
==================

1. Deploy and configure clusters for Metro DR.
2. Create DRPolicy "testing-policy" with 2 clusters (if you alreay have a valid
   DRPolicy created, you can reuse the clusters which are part of it).
3. Edit DRPolicy "testing-policy" and drop both DR Clusters from the spec.
4. Check DRPolicy validation status.

Actual results
==============

Validation DRPolicy/testing-policy without any DR Clusters passess:

```
$ oc get DRPolicy/testing-policy -o yaml
apiVersion: ramendr.openshift.io/v1alpha1
kind: DRPolicy
metadata:
  creationTimestamp: "2022-08-31T12:08:01Z"
  finalizers:
  - drpolicies.ramendr.openshift.io/ramen
  generation: 4
  labels:
    cluster.open-cluster-management.io/backup: resource
    ocsqe: "2022-08-31"
  name: testing-policy
  resourceVersion: "22523313"
  uid: 0d005ac8-118c-4fd8-a338-1e6668cda5f6
spec:
  replicationClassSelector: {}
  schedulingInterval: 0m
  volumeSnapshotClassSelector: {}
status:
  conditions:
  - lastTransitionTime: "2022-08-31T12:12:51Z"
    message: drpolicy validated
    observedGeneration: 4
    reason: Succeeded
    status: "True"
    type: Validated
```

Expected results
================

Validation of an empty DRPolicy fails.

Comment 4 Shrivaibavi Raghaventhiran 2022-12-19 12:25:59 UTC
@rgowdege Can you please add the Fixed in version ?

Comment 16 Shrivaibavi Raghaventhiran 2023-01-09 17:13:25 UTC
Version:
--------
OCP - 4.12.0-0.nightly-2023-01-04-203333
ODF - quay.io/rhceph-dev/ocs-registry:4.12.0-156
ACM - 2.7

Test:
-----
* Removed drcluster list from drpolicy and DRpolicy validation failed as expected. hence moving this to verified

$ oc get drpolicy -o yaml
apiVersion: v1
items:
- apiVersion: ramendr.openshift.io/v1alpha1
  kind: DRPolicy
  metadata:
    creationTimestamp: "2023-01-09T13:44:56Z"
    finalizers:
    - drpolicies.ramendr.openshift.io/ramen
    generation: 3
    labels:
      cluster.open-cluster-management.io/backup: resource
    name: ocpcluster1-ocpcluster2
    resourceVersion: "6375963"
    uid: 5b8c8f24-56a1-4ae0-9313-c82e577e09bf
  spec:
    drClusters: []
    replicationClassSelector: {}
    schedulingInterval: 0m
    volumeSnapshotClassSelector: {}
  status:
    conditions:
    - lastTransitionTime: "2023-01-09T16:53:22Z"
      message: missing DRClusters list in policy
      observedGeneration: 3
      reason: ValidationFailed
      status: "False"
      type: Validated
kind: List
metadata:


Note You need to log in before you can comment on or make changes to this bug.