Skip to content

Commit 4f0f251

Browse files
committed
enhance drpolicy-crd doc
Signed-off-by: rakeshgm <rakeshgm@redhat.com>
1 parent 4891fff commit 4f0f251

1 file changed

Lines changed: 46 additions & 197 deletions

File tree

docs/drpolicy-crd.md

Lines changed: 46 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ the DR relationship between two managed clusters.
1515
A DRPolicy specifies:
1616

1717
- Which two clusters participate in DR
18-
- The replication schedule (for async DR)
18+
- The replication schedule for Async (Regional DR)
1919
- Storage class selectors for volume replication
20-
- Whether to use async (VolumeReplication) or sync (VolSync) replication
20+
- Whether to use async (Regional DR) or sync (Metro DR)
2121

2222
**Lifecycle:** DRPolicy resources are created once during DR setup and are
23-
typically long-lived. Multiple DRPlacementControl resources can reference
24-
the same DRPolicy.
23+
typically long-lived.
2524

2625
## API Group and Version
2726

@@ -36,12 +35,12 @@ the same DRPolicy.
3635

3736
#### `drClusters` ([]string)
3837

39-
List of exactly two managed cluster names that participate in this DR policy.
38+
List of exactly two DRCluster resource names that participate in this DR policy.
4039

4140
**Requirements:**
4241

43-
- Must contain exactly 2 cluster names
44-
- Cluster names must match OCM ManagedCluster resource names
42+
- Must contain exactly 2 DRCluster resource names
43+
- DRCluster resources must exist on the hub cluster (see [DRCluster](drcluster-crd.md))
4544
- Immutable after creation
4645

4746
**Example:**
@@ -57,7 +56,7 @@ drClusters:
5756
#### `schedulingInterval` (string)
5857

5958
Defines how frequently to replicate volume data between clusters for
60-
async replication.
59+
Async (Regional DR).
6160

6261
**Format:** `<number><m|h|d>` where:
6362

@@ -67,8 +66,8 @@ async replication.
6766

6867
**Behavior:**
6968

70-
- Empty string (`""`) = synchronous replication (Metro DR / VolSync)
71-
- Non-empty = asynchronous replication (Regional DR / VolumeReplication)
69+
- Empty string (`""`) = Sync (Metro DR)
70+
- Non-empty = Async (Regional DR)
7271
- Immutable after creation
7372

7473
**Examples:**
@@ -82,16 +81,16 @@ schedulingInterval: "" # Synchronous (no scheduling)
8281

8382
**Typical values:**
8483

85-
- Production async: `"1h"` or `"30m"`
84+
- Production Async (Regional DR): `"1h"` or `"30m"`
8685
- Testing: `"5m"` or `"10m"`
87-
- Sync DR: `""` (empty)
86+
- Sync (Metro DR): `""` (empty)
8887

8988
#### `replicationClassSelector` (metav1.LabelSelector)
9089

9190
Label selector to identify VolumeReplicationClass resources for
92-
async replication.
91+
Async (Regional DR).
9392

94-
**When to use:** Set this for async (Regional DR) when using
93+
**When to use:** Set this for Async (Regional DR) when using
9594
VolumeReplication with schedulingInterval.
9695

9796
**How it works:**
@@ -112,11 +111,11 @@ replicationClassSelector:
112111

113112
#### `volumeSnapshotClassSelector` (metav1.LabelSelector)
114113

115-
Label selector to identify VolumeSnapshotClass resources for sync
116-
replication.
114+
Label selector to identify VolumeSnapshotClass resources for
115+
Async (Regional DR).
117116

118-
**When to use:** Set this for sync (Metro DR) when using VolSync
119-
without schedulingInterval.
117+
**When to use:** Set this for Async (Regional DR) when using VolSync
118+
with schedulingInterval.
120119

121120
**How it works:**
122121

@@ -137,9 +136,9 @@ volumeSnapshotClassSelector:
137136
#### `volumeGroupSnapshotClassSelector` (metav1.LabelSelector)
138137

139138
Label selector to identify VolumeGroupSnapshotClass resources for grouped
140-
snapshot operations with VolSync.
139+
snapshot operations with VolSync in Async (Regional DR).
141140

142-
**When to use:** For workloads with multiple PVCs that need
141+
**When to use:** For Async (Regional DR) workloads with multiple PVCs that need
143142
consistent point-in-time snapshots.
144143

145144
**Example:**
@@ -164,23 +163,23 @@ Standard Kubernetes conditions indicating the policy validation state.
164163

165164
### `async` (Async)
166165

167-
Status of async replication details between clusters (for Regional DR).
166+
Status of async (Regional DR) details between clusters.
168167

169168
**Fields:**
170169

171170
- `peerClasses` ([]PeerClass) - List of common StorageClasses with async relationships
172171

173172
### `sync` (Sync)
174173

175-
Status of sync replication details between clusters (for Metro DR).
174+
Status of sync (Metro DR) details between clusters.
176175

177176
**Fields:**
178177

179178
- `peerClasses` ([]PeerClass) - List of common StorageClasses with sync relationships
180179

181180
### PeerClass Structure
182181

183-
Discovered storage class relationships between peer clusters:
182+
Discovered peer relationship information between peer clusters:
184183

185184
- `storageClassName` - Common StorageClass name across peers
186185
- `replicationID` - Common replication ID from VolumeReplicationClass labels
@@ -192,10 +191,10 @@ Discovered storage class relationships between peer clusters:
192191

193192
## Examples
194193

195-
### Example 1: Async Regional DR Policy
194+
### Example 1: Async (Regional DR)
196195

197-
For asynchronous replication between geographically distributed
198-
clusters using Ceph RBD mirroring:
196+
This policy configures Async (Regional DR) between geographically distributed
197+
clusters:
199198

200199
```yaml
201200
apiVersion: ramendr.openshift.io/v1alpha1
@@ -211,15 +210,15 @@ spec:
211210
- us-east-cluster
212211
- us-west-cluster
213212
214-
# Select VolumeReplicationClass for Ceph RBD
213+
# Select VolumeReplicationClass
215214
replicationClassSelector:
216215
matchLabels:
217216
ramendr.openshift.io/replication-class: rbd-replication
218217
```
219218

220-
### Example 2: Sync Metro DR Policy
219+
### Example 2: Sync (Metro DR)
221220

222-
For synchronous replication between clusters in the same metro area using VolSync:
221+
This policy configures Sync (Metro DR) between clusters in the same metro area:
223222

224223
```yaml
225224
apiVersion: ramendr.openshift.io/v1alpha1
@@ -234,75 +233,38 @@ spec:
234233
drClusters:
235234
- metro-cluster-1
236235
- metro-cluster-2
237-
238-
# Select VolumeSnapshotClass for VolSync
239-
volumeSnapshotClassSelector:
240-
matchLabels:
241-
ramendr.openshift.io/snapshot-class: csi-snapclass
242236
```
243237

244-
### Example 3: Multi-Policy Setup
245-
246-
You can have multiple DRPolicies for different cluster pairs:
238+
**Note:** Sync (Metro DR) uses synchronous replication at the storage level.
239+
VolSync is used for Async (Regional DR) and should not be used with
240+
Sync (Metro DR).
247241

248-
```yaml
249-
# Policy for US East <-> US West
250-
apiVersion: ramendr.openshift.io/v1alpha1
251-
kind: DRPolicy
252-
metadata:
253-
name: us-regional-dr
254-
spec:
255-
schedulingInterval: "1h"
256-
drClusters:
257-
- us-east
258-
- us-west
259-
replicationClassSelector:
260-
matchLabels:
261-
class: rbd-replication
262-
---
263-
# Policy for EU clusters
264-
apiVersion: ramendr.openshift.io/v1alpha1
265-
kind: DRPolicy
266-
metadata:
267-
name: eu-regional-dr
268-
spec:
269-
schedulingInterval: "1h"
270-
drClusters:
271-
- eu-north
272-
- eu-south
273-
replicationClassSelector:
274-
matchLabels:
275-
class: rbd-replication
276-
```
242+
## Troubleshooting
277243

278-
## Usage
244+
### DRPolicy Not Validated
279245

280-
### Creating a DRPolicy
246+
Check the DRPolicy status:
281247

282-
**Prerequisites:**
248+
```bash
249+
kubectl get drpolicy <name> -o yaml
250+
```
283251

284-
1. Two managed clusters registered with OCM hub
285-
1. Storage with replication support on both clusters
286-
1. VolumeReplicationClass (async) or VolumeSnapshotClass (sync) configured
252+
**Common issues:**
287253

288-
**Steps:**
254+
1. Clusters not registered in OCM
289255

290-
1. Verify managed clusters are ready:
256+
Verify managed clusters are registered:
291257

292258
```bash
293259
kubectl get managedclusters
294260
```
295261

296-
1. Create the DRPolicy:
297-
298-
```bash
299-
kubectl apply -f drpolicy.yaml
300-
```
262+
1. DRCluster resources not validated
301263

302-
1. Verify the policy is validated:
264+
Verify DRCluster resources referenced in the DRPolicy are validated:
303265

304266
```bash
305-
kubectl get drpolicy regional-dr-policy -o yaml
267+
kubectl get drcluster <cluster-name> -o yaml
306268
```
307269

308270
Check for `Validated` condition in status:
@@ -314,125 +276,12 @@ spec:
314276
status: "True"
315277
```
316278

317-
1. Check discovered peer classes:
318-
319-
```bash
320-
kubectl get drpolicy regional-dr-policy -o jsonpath='{.status.async.peerClasses}' | jq
321-
```
322-
323-
### Referencing a DRPolicy
324-
325-
DRPlacementControl resources reference DRPolicy by name:
326-
327-
```yaml
328-
apiVersion: ramendr.openshift.io/v1alpha1
329-
kind: DRPlacementControl
330-
metadata:
331-
name: my-app-drpc
332-
namespace: my-app
333-
spec:
334-
drPolicyRef:
335-
name: regional-dr-policy # References the DRPolicy
336-
# ... other DRPC fields
337-
```
338-
339-
## Validation Rules
340-
341-
The DRPolicy has built-in validation:
342-
343-
1. **drClusters must contain exactly 2 clusters**
344-
345-
- Error: "drClusters requires a list of 2 clusters"
346-
347-
1. **Fields are immutable after creation:**
348-
349-
- `drClusters` - Cannot change cluster list
350-
- `schedulingInterval` - Cannot switch between sync/async
351-
- `replicationClassSelector` - Presence cannot change
352-
- `volumeSnapshotClassSelector` - Presence cannot change
353-
354-
1. **schedulingInterval format validation:**
355-
- Must match pattern: `^\d+[mhd]$` or empty string
356-
- Examples: `5m`, `1h`, `2d`, or `""`
357-
358-
## Troubleshooting
359-
360-
### DRPolicy Not Validated
361-
362-
**Check:**
363-
364-
```bash
365-
kubectl get drpolicy <name> -o yaml
366-
```
367-
368-
**Common issues:**
369-
370-
1. Clusters not registered in OCM
371-
372-
```bash
373-
kubectl get managedclusters
374-
```
375-
376-
1. VolumeReplicationClass or VolumeSnapshotClass not found
377-
378-
```bash
379-
# On each managed cluster
380-
kubectl get volumereplicationclass
381-
kubectl get volumesnapshotclass
382-
```
383-
384-
1. Storage classes not properly labeled
385-
386-
```bash
387-
kubectl get sc -o yaml | grep "ramendr.openshift.io"
388-
```
389-
390279
### No PeerClasses in Status
391280

392-
**Cause:** Storage classes may not have required labels or replication isn't configured.
393-
394-
**Check storage class labels on managed clusters:**
395-
396-
```bash
397-
kubectl get sc <storage-class-name> -o yaml
398-
```
399-
400-
**Required labels:**
401-
402-
- `ramendr.openshift.io/storageid` - Storage backend identifier
403-
- `ramendr.openshift.io/replicationid` - Replication backend identifier (on VolumeReplicationClass)
404-
405-
### Cannot Delete DRPolicy
406-
407-
**Cause:** DRPlacementControl resources are still referencing it.
408-
409-
**Check references:**
410-
411-
```bash
412-
kubectl get drpc -A -o yaml | grep drPolicyRef
413-
```
414-
415-
**Solution:** Delete all referencing DRPCs first, then delete the DRPolicy.
416-
417-
## Best Practices
418-
419-
1. **Use descriptive names** - Include location or purpose in the
420-
name (e.g., `us-regional-dr`, `metro-dr-policy`)
421-
422-
1. **Set appropriate scheduling intervals:**
423-
424-
- Production: 30m to 1h for most workloads
425-
- High-frequency: 5m to 15m for critical workloads
426-
- Low-frequency: 6h to 24h for large datasets
427-
428-
1. **Label storage classes consistently** across clusters for peer class discovery
429-
430-
1. **Create separate policies** for different DR requirements
431-
(e.g., one for US clusters, one for EU clusters)
432-
433-
1. **Test policies** with non-production workloads before using in production
281+
**Cause:** Classes available on managed clusters may not have required labels
282+
or annotations, or replication isn't configured.
434283

435-
1. **Monitor policy status** regularly to ensure validation remains successful
284+
**For details on required labels and annotations, see [DRClusterConfig](drclusterconfig-crd.md).**
436285

437286
## Related Resources
438287

0 commit comments

Comments
 (0)