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

Conversation

nirs
Copy link
Member

@nirs nirs commented Jun 3, 2024

  • 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.

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 <[email protected]>
Move current dr samples to dr/managed, making rook for dr/discovered
samples.

Signed-off-by: Nir Soffer <[email protected]>
@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 <[email protected]>
@nirs nirs marked this pull request as ready for review June 4, 2024 19:51
@ShyamsundarR
Copy link
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
Copy link
Member Author

nirs commented Jun 5, 2024

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.

namespace in cluster `dr1`:

```
kubectl get vrg -l app=deployment-rbd -n ramen-ops --context dr1
Copy link
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.

Example output:

```
$ kubectl get vrg deployment-rbd-drpc -n ramen-ops --context dr1
Copy link
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.

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
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

cluster, *OCM* delete the application from the cluster and deploy it on
the other cluster.

### OCM discovered applications*
Copy link
Member Author

Choose a reason for hiding this comment

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

Trailing *

The application is still running on the primary cluster:

```
$ kubectl get deploy,pod,pvc -n deployment-rbd --context dr1
Copy link
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
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.

--type merge \
--namespace ramen-ops \
--context hub
```
Copy link
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
### OCM managed applications

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

Choose a reason for hiding this comment

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

s/take/takes


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
Member

Choose a reason for hiding this comment

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

s/return/returns

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
Member

Choose a reason for hiding this comment

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

s/control/controls

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
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

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
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
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 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

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