Skip to content

Add discovered application samples#53

Draft
nirs wants to merge 3 commits into
RamenDR:mainfrom
nirs:discovered-apps
Draft

Add discovered application samples#53
nirs wants to merge 3 commits into
RamenDR:mainfrom
nirs:discovered-apps

Conversation

@nirs

@nirs nirs commented Jun 3, 2024

Copy link
Copy Markdown
Member
  • Introduce discovered applications
  • Make room for discovered applications dr resources
  • Add sample for deployment-rbd
  • Document complete DR flow for discovered application

Since this PR is big enough, I will post another PR for the kubevirt samples.

Comment thread dr/discovered/deployment-rbd/drpc.yaml
Comment thread dr/discovered/deployment-rbd/placement-decision.yaml Outdated
Comment thread dr/discovered/deployment-rbd/drpc.yaml Outdated
Comment thread dr/discovered/deployment-rbd/placement.yaml Outdated
@nirs nirs force-pushed the discovered-apps branch from 3921bef to 28e09bc Compare June 4, 2024 17:13
nirs added 2 commits June 4, 2024 21:37
Add a section about the difference between managed and discovered
applications and update the titles to make it clear that the current
instructions are for OCM managed applications.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Move current dr samples to dr/managed, making rook for dr/discovered
samples.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
@nirs nirs force-pushed the discovered-apps branch 2 times, most recently from 043ea92 to 97df338 Compare June 4, 2024 19:38
The ManagedClusterBinding belongs to the ramen-ops namespace and
not to the application, so we keep it in the ramen-ops directory.

The rest of the resources are in the deployment-rbd directory. I'm not
sure how easy it will be to share a base kustomization with other
workloads so lets start with something simple.

The README was updated to describe complete DR flow for discovered
application using the new resources.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
@nirs nirs force-pushed the discovered-apps branch from 97df338 to 6bc74a5 Compare June 4, 2024 19:49
@nirs nirs marked this pull request as ready for review June 4, 2024 19:51
@ShyamsundarR

Copy link
Copy Markdown
Member

Here is what I suggest as the directory structure for discovered:

├── dr
│   ├── base
│   │   ├── drpc.yaml
│   │   └── kustomization.yaml
│   ├── discovered (new)
│   │   ├── kustomization.yaml (new)
│   │   └── placement.yaml (new)
├── ramen
│   ├── binding.yaml (new)
│   ├── dr-clusters.yaml
│   ├── dr-policy.yaml
│   ├── kustomization.yaml
│   └── ramen-ops-ns.yaml (new)

The above presents one dr enabling set of resources for any discovered application. The kustomization would hold the templates for required values that need to change, for example the protectedNS, kubeObjectProtection specification etc.

Also, the common setup for supporting discovered workloads is moved to the ramen directory, to be used as part of setup.

This PR attempts to separate this into a managed/discovered seems to lead back to creating a overlay for each type of workload that we have in the repository, which is excessive and something we want to avoid.

@nirs

nirs commented Jun 5, 2024

Copy link
Copy Markdown
Member Author

Here is what I suggest as the directory structure for discovered:

├── dr
│   ├── base
│   │   ├── drpc.yaml
│   │   └── kustomization.yaml
│   ├── discovered (new)
│   │   ├── kustomization.yaml (new)
│   │   └── placement.yaml (new)

Do yo suggest discovered/kustomization will customize base/ resources?

├── ramen
│   ├── binding.yaml (new)

Sure we can move binding.yaml here. It is needed only for discovered apps but we document the simple command to deploy it in the right section.

│   ├── dr-clusters.yaml
│   ├── dr-policy.yaml
│   ├── kustomization.yaml
│   └── ramen-ops-ns.yaml (new)

We don't need ramen-ops-ns - it is already created by ramen. At least we don't need to do anything in drenv for this. If we want to help users create ramen-ops with the binding we can add something like this:

ramen
  ramen-ops
    ns.yaml
    binding.yaml
    kustomization.yaml

The above presents one dr enabling set of resources for any discovered application. The kustomization would hold the templates for required values that need to change, for example the protectedNS, kubeObjectProtection specification etc.
This PR attempts to separate this into a managed/discovered seems to lead back to creating a overlay for each type of workload that we have in the repository, which is excessive and something we want to avoid.

But we need an overlay for each application (e.g deloyment, deadonset, statefulset, vm-pvc, vm-dv, vm-dvt). If we don't add it the user will have to add it manually which makes testing and experimenting too hard. This is what we have now for other workloads.

Comment thread README.md
namespace in cluster `dr1`:

```
kubectl get vrg -l app=deployment-rbd -n ramen-ops --context dr1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This does not work:

$ kubectl get vrg -l app=deployment-rbd -n ramen-ops --context dr1
No resources found in ramen-ops namespace.

Because ramen does not label the vrg with the same label of the drpc. I think this works for OCM managed apps.

Comment thread README.md
Example output:

```
$ kubectl get vrg deployment-rbd-drpc -n ramen-ops --context dr1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Command should move up, this is just the output.

Comment thread README.md
placementdecision.cluster.open-cluster-management.io/deployment-rbd-placement-decision patched (no change)
```

At this point *Ramen* take over and start protecting the application.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For completeness, we should show the drpc at this stage:

kubectl get drpc -l app=deployment-rbd -n ramen-ops --context hub

Example output:

NAME                  AGE   PREFERREDCLUSTER   FAILOVERCLUSTER   DESIREDSTATE   CURRENTSTATE
deployment-rbd-drpc   11m   dr1                                                 Deployed

Comment thread README.md
cluster, *OCM* delete the application from the cluster and deploy it on
the other cluster.

### OCM discovered applications*

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Trailing *

Comment thread README.md
The application is still running on the primary cluster:

```
$ kubectl get deploy,pod,pvc -n deployment-rbd --context dr1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Leading $ unneeded - breaks copy and paste from rendered page.

@@ -0,0 +1,6 @@
apiVersion: cluster.open-cluster-management.io/v1beta1

@nirs nirs Jun 6, 2024

Copy link
Copy Markdown
Member Author

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.

Comment thread README.md
--type merge \
--namespace ramen-ops \
--context hub
```

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This step should not be needed if we remove the placemnt-decision.yaml - ramen will create a new configured resource automatically.
https://github.com/RamenDR/ramen/blob/d475bc759f4cb84b0fd823b9eea2b0b54b7c0364/controllers/drplacementcontrol_controller.go#L2116

@nirs nirs marked this pull request as draft June 6, 2024 21:56
Comment thread README.md
### OCM managed applications

Deployed and undeployed by *OCM*, using either *Subsription* or
*ApplciationSet* resources. *Ramen* take ownership of the application

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/take/takes

Comment thread README.md

Deployed and undeployed by *OCM*, using either *Subsription* or
*ApplciationSet* resources. *Ramen* take ownership of the application
when enabling DR, and return ownership to OCM when disabling DR. When DR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/return/returns

Comment thread README.md
Deployed and undeployed by *OCM*, using either *Subsription* or
*ApplciationSet* resources. *Ramen* take ownership of the application
when enabling DR, and return ownership to OCM when disabling DR. When DR
is enabled, *Ramen* control the placement of the application and backup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/control/controls

Comment thread README.md
and restore the application PVCs.

When failing over or relocating an *OCM managed application* to another
cluster, *OCM* delete the application from the cluster and deploy it on

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/delete/deletes and s/deploy/deploys

Comment thread README.md
repository using kubectl. Another example is creating a virtual machine
using KubeVirt console.

*Ramen* take ownership of the application when enabling DR and return

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

plural changes in this and next paragraph too

@@ -0,0 +1,8 @@
---

Copy link
Copy Markdown
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.

Comment thread README.md
Comment on lines +85 to +86
imperative means. An example is deploying one of the workloads in this
repository using kubectl. Another example is creating a virtual machine

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
imperative means. An example is deploying one of the workloads in this
repository using kubectl. Another example is creating a virtual machine
imperative means. An example is directly supplying one of the workload definitions in this
repository (Deployment, for example) to `kubectl apply`. Another example is creating a virtual machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants