mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-02-14 18:09:57 +00:00
@@ -33,7 +33,8 @@ In addition, developers can leverage [Addon framework](https://github.com/open-c
|
||||
* Centrally create, update, and delete Kubernetes clusters across multiple private and public clouds.
|
||||
* Automatically deploy applications to specific clusters by subscribing to different workload (resource) channels, such as GitHub, Helm repository, ObjectStore, and resource templates.
|
||||
|
||||
The application model defines a Kubernetes-first way of describing the application. Your existing Kubernetes apps or `kustomized` apps can be adapted with the addition of a few new objects: [Channel](https://github.com/open-cluster-management-io/multicloud-operators-channel), and [Subscription](https://github.com/open-cluster-management-io/multicloud-operators-subscription). Changes made to the app are then easily delivered to managed clusters based on the dynamic placement engine.
|
||||
The application model defines a Kubernetes-first way of describing the application. Your existing Kubernetes apps or `kustomized` apps can be adapted with the addition of a few new objects: [Channel](https://github.com/open-cluster-management-io/multicloud-operators-channel), and [Subscription](https://github.com/open-cluster-management-io/multicloud-operators-subscription). Changes made to the app are then easily delivered to managed clusters based on the dynamic placement engine. See [deploy a helm chart][solutions/deploy-a-helm-chart] on how
|
||||
to install application manager addon in OCM and deploy helm charts in multiple clusters.
|
||||
|
||||
### GRC: Governance, Risk and Compliance across Kubernetes clusters
|
||||
|
||||
|
||||
37
solutions/deploy-a-helm-chart/READEME.md
Normal file
37
solutions/deploy-a-helm-chart/READEME.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Deploy a Helm Chart
|
||||
|
||||
## Prerequisite
|
||||
|
||||
Set up the dev environment in your local machine following [setup dev environment](../setup-dev-environment).
|
||||
|
||||
## Install application addon on OCM
|
||||
|
||||
Install application manager addon on the hub cluster
|
||||
|
||||
```
|
||||
kubectl config use kind-hub
|
||||
clusteradm install addons --names application-manager
|
||||
```
|
||||
|
||||
Install application manager agent on all the managed clusters
|
||||
|
||||
```
|
||||
clusteradm enable addons --names application-manager --clusters cluster1,cluster2
|
||||
```
|
||||
|
||||
You will see that all agents is available after waiting a while
|
||||
|
||||
```
|
||||
$ kubectl get managedclusteraddon --all-namespaces
|
||||
NAMESPACE NAME AVAILABLE DEGRADED PROGRESSING
|
||||
cluster1 application-manager True
|
||||
cluster2 application-manager True
|
||||
```
|
||||
|
||||
## Deploy a helm chart to cluster1
|
||||
|
||||
Run `./deploy.sh` to deploy the helm chart on cluster1
|
||||
|
||||
It will create a [channel](manifests/channel.yaml) which specifies a helm repo, a [placement](manifests/placement.yaml)
|
||||
to select one or multiple clusters, and a [subscription](manifests/subscription.yaml) to deploy the helm chart. Try
|
||||
update `placement` to see how the chart deployment is changed.
|
||||
22
solutions/deploy-a-helm-chart/deploy.sh
Executable file
22
solutions/deploy-a-helm-chart/deploy.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname ${BASH_SOURCE})
|
||||
|
||||
set -e
|
||||
|
||||
hubctx="kind-hub"
|
||||
|
||||
kubectl config use ${hubctx}
|
||||
|
||||
echo "Add cluster1, cluster2 to the clusterset"
|
||||
|
||||
kubectl label managedcluster cluster1 cluster.open-cluster-management.io/clusterset=app-demo --overwrite
|
||||
kubectl label managedcluster cluster2 cluster.open-cluster-management.io/clusterset=app-demo --overwrite
|
||||
|
||||
echo "Label cluster1 so placement will select cluster1 only"
|
||||
|
||||
kubectl label managedcluster cluster1 purpose=test --overwrite
|
||||
|
||||
echo "Deploy the application with placement"
|
||||
|
||||
kubectl apply -f manifests/
|
||||
9
solutions/deploy-a-helm-chart/manifests/channel.yaml
Normal file
9
solutions/deploy-a-helm-chart/manifests/channel.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: apps.open-cluster-management.io/v1
|
||||
kind: Channel
|
||||
metadata:
|
||||
name: demo-helmrepo
|
||||
namespace: default
|
||||
spec:
|
||||
type: HelmRepo
|
||||
pathname: https://charts.helm.sh/stable/
|
||||
insecureSkipVerify: true
|
||||
4
solutions/deploy-a-helm-chart/manifests/clusterset.yaml
Normal file
4
solutions/deploy-a-helm-chart/manifests/clusterset.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: cluster.open-cluster-management.io/v1alpha1
|
||||
kind: ManagedClusterSet
|
||||
metadata:
|
||||
name: app-demo
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: cluster.open-cluster-management.io/v1alpha1
|
||||
kind: ManagedClusterSetBinding
|
||||
metadata:
|
||||
name: app-demo
|
||||
namespace: default
|
||||
spec:
|
||||
clusterSet: app-demo
|
||||
14
solutions/deploy-a-helm-chart/manifests/placement.yaml
Normal file
14
solutions/deploy-a-helm-chart/manifests/placement.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: cluster.open-cluster-management.io/v1alpha1
|
||||
kind: Placement
|
||||
metadata:
|
||||
name: demo-placement
|
||||
namespace: default
|
||||
spec:
|
||||
numberOfClusters: 1
|
||||
clusterSets:
|
||||
- app-demo
|
||||
predicates:
|
||||
- requiredClusterSelector:
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
purpose: test
|
||||
20
solutions/deploy-a-helm-chart/manifests/subscription.yaml
Normal file
20
solutions/deploy-a-helm-chart/manifests/subscription.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: apps.open-cluster-management.io/v1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: demo-subscription
|
||||
namespace: default
|
||||
spec:
|
||||
channel: default/demo-helmrepo
|
||||
name: nginx-ingress
|
||||
placement:
|
||||
placementRef:
|
||||
name: demo-placement
|
||||
kind: Placement
|
||||
packageOverrides:
|
||||
- packageName: nginx-ingress
|
||||
packageAlias: nginx-ingress-simple
|
||||
packageOverrides:
|
||||
- path: spec
|
||||
value:
|
||||
defaultBackend:
|
||||
replicaCount: 2
|
||||
0
solutions/setup-dev-environment/local-up.sh
Normal file → Executable file
0
solutions/setup-dev-environment/local-up.sh
Normal file → Executable file
Reference in New Issue
Block a user