forked from RamenDR/ramen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests application based on ocm-ramen-samples for using in drenv tests. We 2 variants: - `rbd`: for testing replication using RBD mirroring - `hostpath`: for testing replication using minikube `csi-hostpath-sc` via volsync. The application are identical except the pvc storage class and namespace. We can add another variant for CephFS once we add it to to test environment. Differences compared to ocm-ramen-samples: - Different directory layout - every app has a subscription and application directory. Both use kustomization based on a base application or subscription. - The channel is separated from the applications, since we have need only one channel pointing to the ramen repo. - The deployment uses security context so the app runs as unprivileged user. - The apps are part of ramen repo, so it is easier to maintain, an we don't need to worry about affecting users or QE when changing the applications. - Fix yamllint errors - Add SPDX headers Signed-off-by: Nir Soffer <nsoffer@redhat.com>
- Loading branch information
Showing
16 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Ramen test applications | ||
|
||
This directory contains test applications for testing disaster recovery | ||
flows using the drenv environment. | ||
|
||
The applications are kustomized for minikube based clusters. To test on | ||
OpenShift clusters, use the | ||
[RamenDR ocm-ramen-samples repository](https://github.com/RamenDR/ocm-ramen-samples). | ||
|
||
## Channel | ||
|
||
Channel pointing to ramen github repo. Must be installed to use these | ||
applications. | ||
|
||
## Bases | ||
|
||
- `busybox`: Base busybox application. To create an actual application | ||
create an overlay and kustomize namespace and the pvc | ||
storageClassName. See `*/busybox/kustomization.yaml` for example. | ||
|
||
- `subscription`: Base busybox subscription. To create an actual | ||
subscription create an overlay and kustomize the namespace and | ||
github-path annotation. See `*/subscription/kustomization.yaml` for | ||
example. | ||
|
||
## Overlays | ||
|
||
- `rbd`: busybox and subscription overlays for testing replication with | ||
RBD mirroring. | ||
|
||
- `hostpath`: busybox and subscription overlays for testing replication | ||
using `csi-hostpath-sc` storage class via `volsync`. | ||
|
||
## Deployment | ||
|
||
1. Install the channel | ||
|
||
``` | ||
kubectl apply -k channel | ||
``` | ||
|
||
This install a `ramen-gitops` channel in the `ramen-test` namespace, | ||
pointing the ramen repo on github. | ||
|
||
1. Install the subscriptions | ||
|
||
``` | ||
kubectl apply -k rbd/subscription | ||
``` | ||
|
||
This installs the `busybox-sub` subscription in in the `busybox-rbd` | ||
namespace on the 'hub' cluster, and the `busybox` application in the | ||
`busybox-rbd` namespace in cluster `dr1`. | ||
|
||
To install the `hostpath` subscription replace `rbd` with `hostpath`. | ||
The subscription and applications are installed in the | ||
`busybox-hostpath` namespace. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
appname: busybox | ||
name: busybox | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
appname: busybox | ||
template: | ||
metadata: | ||
labels: | ||
appname: busybox | ||
spec: | ||
containers: | ||
- image: docker.io/library/busybox:stable | ||
imagePullPolicy: IfNotPresent | ||
name: busybox | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
trap exit TERM | ||
while true; do | ||
date | tee -a /mnt/test/outfile | ||
sync | ||
sleep 10 & | ||
wait | ||
done | ||
volumeMounts: | ||
- name: mypvc | ||
mountPath: /mnt/test | ||
volumes: | ||
- name: mypvc | ||
persistentVolumeClaim: | ||
claimName: busybox-pvc | ||
securityContext: | ||
runAsUser: 10000 | ||
runAsGroup: 10000 | ||
fsGroup: 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
resources: | ||
- pvc.yaml | ||
- deploy.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: busybox-pvc | ||
labels: | ||
appname: busybox | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: storage-class-name | ||
resources: | ||
requests: | ||
storage: 1Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: Channel | ||
metadata: | ||
name: ramen-gitops | ||
namespace: ramen-test | ||
spec: | ||
type: GitHub | ||
pathname: https://github.com/RamenDR/ramen.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
resources: | ||
- channel.yaml | ||
- namespace.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: ramen-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
resources: | ||
- ../../busybox | ||
namespace: busybox-hostpath | ||
patches: | ||
- target: | ||
kind: PersistentVolumeClaim | ||
name: busybox-pvc | ||
patch: |- | ||
- op: replace | ||
path: /spec/storageClassName | ||
value: csi-hostpath-sc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
resources: | ||
- ../../subscription | ||
namespace: busybox-hostpath | ||
patches: | ||
- target: | ||
kind: Subscription | ||
name: busybox-sub | ||
patch: |- | ||
- op: replace | ||
path: /metadata/annotations/apps.open-cluster-management.io~1github-path | ||
value: test/apps/hostpath/busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
resources: | ||
- ../../busybox | ||
namespace: busybox-rbd | ||
patches: | ||
- target: | ||
kind: PersistentVolumeClaim | ||
name: busybox-pvc | ||
patch: |- | ||
- op: replace | ||
path: /spec/storageClassName | ||
value: rook-ceph-block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
resources: | ||
- ../../subscription | ||
namespace: busybox-rbd | ||
patches: | ||
- target: | ||
kind: Subscription | ||
name: busybox-sub | ||
patch: |- | ||
- op: replace | ||
path: /metadata/annotations/apps.open-cluster-management.io~1github-path | ||
value: test/apps/rbd/busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: ramendr.openshift.io/v1alpha1 | ||
kind: DRPlacementControl | ||
metadata: | ||
name: busybox-drpc | ||
labels: | ||
app: busybox-sample | ||
spec: | ||
preferredCluster: dr1 | ||
drPolicyRef: | ||
name: dr-policy | ||
placementRef: | ||
kind: PlacementRule | ||
name: busybox-placement | ||
pvcSelector: | ||
matchLabels: | ||
appname: busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
resources: | ||
- namespace.yaml | ||
- placementrule.yaml | ||
- subscription.yaml | ||
- drpc.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: busybox-sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: PlacementRule | ||
metadata: | ||
name: busybox-placement | ||
labels: | ||
app: busybox-sample | ||
spec: | ||
clusterConditions: | ||
- type: ManagedClusterConditionAvailable | ||
status: "True" | ||
clusterReplicas: 1 | ||
schedulerName: ramen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SPDX-FileCopyrightText: The RamenDR authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: Subscription | ||
metadata: | ||
annotations: | ||
apps.open-cluster-management.io/github-branch: main | ||
apps.open-cluster-management.io/github-path: github-path | ||
labels: | ||
app: busybox-sample | ||
name: busybox-sub | ||
spec: | ||
channel: ramen-test/ramen-gitops | ||
placement: | ||
placementRef: | ||
kind: PlacementRule | ||
name: busybox-placement |