Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Deploy applications to multi-cluster via RHCAM #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
33 changes: 33 additions & 0 deletions RHACM-apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Demonstrate deploy applications to multi cluster via RHACM
## Tool Requirements
- OpenShift CLI Version >= 4.3.0<br>_Needed for kustomize_
```bash
oc version
```

## Summary
Deploy applications to multi cluster via Red Hat Advanced Cluster Management (RHACM)

## Prerequisite
- Red Hat Advanced Cluster Management installed
- 1+ managed-clusters
- A fork of this repository.

#### Run Command
1. Log in the OCP with RHACM from a terminal window.
```bash
oc login --token=<token> --server=<server>
```

2. Apply the below command in this folder.

```bash
oc apply -k .
```

### Viewing
- Navigate on the left navigation menu to `Managed applications` in RHACM
- Click any application name.
- View the Topology
- Click the `Route` nodes to obtain the application URL
- Click the URL to view those demo applications
66 changes: 66 additions & 0 deletions RHACM-apps/helloworld/deploy-all-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: v1
kind: Namespace
metadata:
name: helloworld-ns
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: helloworld
namespace: helloworld-ns
spec:
componentKinds:
- group: apps.open-cluster-management.io
kind: Subscription
descriptor: {}
selector:
matchExpressions:
- key: app
operator: In
values:
- helloworld
---
apiVersion: v1
kind: Namespace
metadata:
name: ggithubcom-open-cluster-management-application-samples-ns
---
apiVersion: apps.open-cluster-management.io/v1
kind: Channel
metadata:
name: ggithubcom-open-cluster-management-application-samples
namespace: ggithubcom-open-cluster-management-application-samples-ns
spec:
type: Git
pathname: 'https://github.com/open-cluster-management/application-samples.git'
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
annotations:
apps.open-cluster-management.io/git-branch: main
apps.open-cluster-management.io/git-path: helloworld
apps.open-cluster-management.io/reconcile-option: merge
labels:
app: helloworld
name: helloworld-subscription-1
namespace: helloworld-ns
spec:
channel: ggithubcom-open-cluster-management-application-samples-ns/ggithubcom-open-cluster-management-application-samples
placement:
placementRef:
kind: PlacementRule
name: helloworld-placement-1
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
labels:
app: helloworld
name: helloworld-placement-1
namespace: helloworld-ns
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"

66 changes: 66 additions & 0 deletions RHACM-apps/helloworld/deploy-local-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: v1
kind: Namespace
metadata:
name: helloworld-ns
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: helloworld
namespace: helloworld-ns
spec:
componentKinds:
- group: apps.open-cluster-management.io
kind: Subscription
descriptor: {}
selector:
matchExpressions:
- key: app
operator: In
values:
- helloworld
---
apiVersion: v1
kind: Namespace
metadata:
name: ggithubcom-open-cluster-management-application-samples-ns
---
apiVersion: apps.open-cluster-management.io/v1
kind: Channel
metadata:
name: ggithubcom-open-cluster-management-application-samples
namespace: ggithubcom-open-cluster-management-application-samples-ns
spec:
type: Git
pathname: 'https://github.com/open-cluster-management/application-samples.git'
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
annotations:
apps.open-cluster-management.io/git-branch: main
apps.open-cluster-management.io/git-path: helloworld
apps.open-cluster-management.io/reconcile-option: merge
labels:
app: helloworld
name: helloworld-subscription-1
namespace: helloworld-ns
spec:
channel: ggithubcom-open-cluster-management-application-samples-ns/ggithubcom-open-cluster-management-application-samples
placement:
placementRef:
kind: PlacementRule
name: helloworld-placement-1
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
labels:
app: helloworld
name: helloworld-placement-1
namespace: helloworld-ns
spec:
clusterSelector:
matchLabels:
'local-cluster': 'true'

4 changes: 4 additions & 0 deletions RHACM-apps/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- helloworld/deploy-all-cluster.yaml
#- mortgage/deploy-all-cluster.yaml
- pacman/deploy-all-cluster.yaml
65 changes: 65 additions & 0 deletions RHACM-apps/mortgage/deploy-all-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: v1
kind: Namespace
metadata:
name: mortgage-ns
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: mortgage
namespace: mortgage-ns
spec:
componentKinds:
- group: apps.open-cluster-management.io
kind: Subscription
descriptor: {}
selector:
matchExpressions:
- key: app
operator: In
values:
- mortgage
---
apiVersion: v1
kind: Namespace
metadata:
name: ggithubcom-open-cluster-management-application-samples-ns
---
apiVersion: apps.open-cluster-management.io/v1
kind: Channel
metadata:
name: ggithubcom-open-cluster-management-application-samples
namespace: ggithubcom-open-cluster-management-application-samples-ns
spec:
type: Git
pathname: 'https://github.com/open-cluster-management/application-samples.git'
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
annotations:
apps.open-cluster-management.io/git-branch: main
apps.open-cluster-management.io/git-path: mortgage
apps.open-cluster-management.io/reconcile-option: merge
labels:
app: mortgage
name: mortgage-subscription-1
namespace: mortgage-ns
spec:
channel: ggithubcom-open-cluster-management-application-samples-ns/ggithubcom-open-cluster-management-application-samples
placement:
placementRef:
kind: PlacementRule
name: mortgage-placement-1
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
labels:
app: mortgage
name: mortgage-placement-1
namespace: mortgage-ns
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
66 changes: 66 additions & 0 deletions RHACM-apps/mortgage/deploy-local-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: v1
kind: Namespace
metadata:
name: mortgage-ns
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: mortgage
namespace: mortgage-ns
spec:
componentKinds:
- group: apps.open-cluster-management.io
kind: Subscription
descriptor: {}
selector:
matchExpressions:
- key: app
operator: In
values:
- mortgage
---
apiVersion: v1
kind: Namespace
metadata:
name: ggithubcom-open-cluster-management-application-samples-ns
---
apiVersion: apps.open-cluster-management.io/v1
kind: Channel
metadata:
name: ggithubcom-open-cluster-management-application-samples
namespace: ggithubcom-open-cluster-management-application-samples-ns
spec:
type: Git
pathname: 'https://github.com/open-cluster-management/application-samples.git'
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
annotations:
apps.open-cluster-management.io/git-branch: main
apps.open-cluster-management.io/git-path: mortgage
apps.open-cluster-management.io/reconcile-option: merge
labels:
app: mortgage
name: mortgage-subscription-1
namespace: mortgage-ns
spec:
channel: ggithubcom-open-cluster-management-application-samples-ns/ggithubcom-open-cluster-management-application-samples
placement:
placementRef:
kind: PlacementRule
name: mortgage-placement-1
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
labels:
app: mortgage
name: mortgage-placement-1
namespace: mortgage-ns
spec:
clusterSelector:
matchLabels:
'local-cluster': 'true'

68 changes: 68 additions & 0 deletions RHACM-apps/pacman/deploy-all-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: v1
kind: Namespace
metadata:
name: pacman-ns
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: pacman
namespace: pacman-ns
spec:
componentKinds:
- group: apps.open-cluster-management.io
kind: Subscription
descriptor: {}
selector:
matchExpressions:
- key: app
operator: In
values:
- pacman
---
apiVersion: v1
kind: Namespace
metadata:
name: ggithubcom-ocp-power-demos-open-cluster-management-ns
---
apiVersion: apps.open-cluster-management.io/v1
kind: Channel
metadata:
annotations:
apps.open-cluster-management.io/reconcile-rate: medium
name: ggithubcom-ocp-power-demos-open-cluster-management
namespace: ggithubcom-ocp-power-demos-open-cluster-management-ns
spec:
type: Git
pathname: 'https://github.com/ocp-power-demos/open-cluster-management'
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
annotations:
apps.open-cluster-management.io/git-branch: main
apps.open-cluster-management.io/git-path: application-samples/pacman
apps.open-cluster-management.io/reconcile-option: merge
labels:
app: pacman
name: pacman-subscription-1
namespace: pacman-ns
spec:
channel: ggithubcom-ocp-power-demos-open-cluster-management-ns/ggithubcom-ocp-power-demos-open-cluster-management
placement:
placementRef:
kind: PlacementRule
name: pacman-placement-1
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
labels:
app: pacman
name: pacman-placement-1
namespace: pacman-ns
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"

Loading