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

Add discovered application samples #53

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
475 changes: 469 additions & 6 deletions README.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions dr/discovered/deployment-rbd/drpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: ramendr.openshift.io/v1alpha1
kind: DRPlacementControl
metadata:
name: drpc
spec:
preferredCluster: dr1
drPolicyRef:
name: dr-policy
placementRef:
kind: Placement
# Match kustomization namePrefix
name: deployment-rbd-placement
nirs marked this conversation as resolved.
Show resolved Hide resolved
namespace: ramen-ops
pvcSelector:
matchLabels:
appname: busybox
protectedNamespaces:
- deployment-rbd
kubeObjectProtection:
kubeObjectSelector:
matchExpressions:
- key: appname
operator: In
values:
- busybox
9 changes: 9 additions & 0 deletions dr/discovered/deployment-rbd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
namespace: ramen-ops
namePrefix: deployment-rbd-
commonLabels:
app: deployment-rbd
resources:
- drpc.yaml
- placement.yaml
- placement-decision.yaml
6 changes: 6 additions & 0 deletions dr/discovered/deployment-rbd/placement-decision.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: cluster.open-cluster-management.io/v1beta1
Copy link
Member Author

@nirs nirs Jun 6, 2024

Choose a reason for hiding this comment

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

Ramen already has code to create a placement decision with the right decision set:
https://github.com/RamenDR/ramen/blob/d475bc759f4cb84b0fd823b9eea2b0b54b7c0364/controllers/drplacementcontrol_controller.go#L2116

So this file should not be needed.

kind: PlacementDecision
metadata:
labels:
cluster.open-cluster-management.io/placement: deployment-rbd-placement
name: placement-decision
11 changes: 11 additions & 0 deletions dr/discovered/deployment-rbd/placement.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
annotations:
cluster.open-cluster-management.io/experimental-scheduling-disable: "true"
name: placement
spec:
clusterSets:
- default
numberOfClusters: 1
8 changes: 8 additions & 0 deletions dr/discovered/ramen-ops/binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

If ACM is never to look at the placement and placementdecision, then we don't need the managedClusterSetBinding.

apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSetBinding
metadata:
name: default
namespace: ramen-ops
spec:
clusterSet: default
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions workloads/kubevirt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ the included SSH public key with your own public key.
1. If you are not using the `main` branch update
`subscription/base/subscription.yaml` to point to the right branch.

## Deploying the VM subscription
## Deploying an OCM managed VM

To start a PVC based VM `vm-pvc` use the
`subscription/kubevirt/vm-pvc-k8s-regional` overlay:
Expand Down Expand Up @@ -89,7 +89,7 @@ NAME PROVISIONED USED
csi-vol-a3fdb384-2e31-49f1-bd48-a97b2d79f981 128 MiB 80 MiB
```

## Enabling DR for the VM
## Enabling DR for an OCM managed VM

To allow *Ramen* to protect the VM, you need to disable *OCM*
scheduling by adding an annotation to the VM placement:
Expand All @@ -104,7 +104,7 @@ kubectl annotate placement placement \
Deploy the DR resources to enable DR:

```sh
kubectl apply -k dr/kubevirt/vm-pvc-k8s-regional --context hub
kubectl apply -k dr/managed/kubevirt/vm-pvc-k8s-regional --context hub
```

At this point *Ramen* controls the VM placement and protects the VM data
Expand Down Expand Up @@ -209,7 +209,7 @@ csi-vol-a3fdb384-2e31-49f1-bd48-a97b2d79f981 128 MiB 80 MiB
In case of a disaster in the primary cluster, we can start the VM using
the replica on the secondary cluster.

## Failing over to another cluster
## Failing over an OCM managed VM to another cluster

In case of disaster you can force the VM to run on the other cluster.
The VM will start on the other cluster using the data from the last
Expand Down Expand Up @@ -351,12 +351,12 @@ kubectl wait drpc drpc \
--context hub
```

## Disable DR for the VM
## Disable DR for an OCM managed VM

Delete the `dr` resources to disable DR:

```sh
kubectl delete -k dr/kubevirt/vm-pvc-k8s-regional --context hub
kubectl delete -k dr/managed/kubevirt/vm-pvc-k8s-regional --context hub
```

Enable *OCM* scheduling again by deleting the placement annotation we
Expand All @@ -372,7 +372,7 @@ kubectl annotate placement placement \
At this point *OCM* controls the VM and the storage used for replicating
the VM data on the DR clusters will be reclaimed.

## Undeploying the VM
## Undeploying an OCM managed VM

Delete the subscription to stop and delete the VM:

Expand Down