From 588d770469b51d77920ae989a808a12914603385 Mon Sep 17 00:00:00 2001 From: Di Xu Date: Thu, 14 Jul 2022 11:50:13 +0800 Subject: [PATCH] add docs on dynamic scheduling and status aggregation (#26) Signed-off-by: Di Xu --- .../multi-cluster-apps/aggregated-status.md | 92 ++++++++++++++++++ ...dynamic-scheduling-to-multiple-clusters.md | 96 +++++++++++++++++++ ...ication-scheduling-to-multiple-clusters.md | 19 ++-- .../multi-cluster-apps/setting-overrides.md | 4 +- ...-weight-scheduling-to-multiple-clusters.md | 20 +++- .../tutorials/multi-cluster-apps/_index.md | 4 +- .../multi-cluster-apps/aggregated-status.md | 92 ++++++++++++++++++ ...dynamic-scheduling-to-multiple-clusters.md | 96 +++++++++++++++++++ ...ication-scheduling-to-multiple-clusters.md | 41 ++++---- .../multi-cluster-apps/setting-overrides.md | 29 +++--- ...-weight-scheduling-to-multiple-clusters.md | 20 +++- 11 files changed, 458 insertions(+), 55 deletions(-) create mode 100644 content/en/docs/tutorials/multi-cluster-apps/aggregated-status.md create mode 100644 content/en/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md create mode 100644 content/zh-cn/docs/tutorials/multi-cluster-apps/aggregated-status.md create mode 100644 content/zh-cn/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md diff --git a/content/en/docs/tutorials/multi-cluster-apps/aggregated-status.md b/content/en/docs/tutorials/multi-cluster-apps/aggregated-status.md new file mode 100644 index 0000000..2787097 --- /dev/null +++ b/content/en/docs/tutorials/multi-cluster-apps/aggregated-status.md @@ -0,0 +1,92 @@ +--- +title: "Checking Aggregated Status" +description: "Aggregating resource status from child clusters" +date: 2022-07-13 +draft: false +weight: 8 +--- + +In Clusternet, you can check the aggregated status of all deployed resources by visiting the status of Subscription. For +every feed/resource, you can check the detailed status (field `feedStatusDetails`) per cluster and the summarized +status (field `feedStatusSummary`) of all clusters in `status.aggregatedStatuses`. + +```yaml +status: + aggregatedStatuses: + - apiVersion: v1 + feedStatusDetails: + - available: true + clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 + clusterName: clusternet-cluster-bb2xp + replicaStatus: { } + - available: true + clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc + clusterName: clusternet-cluster-skxd4 + replicaStatus: { } + feedStatusSummary: + available: true + replicaStatus: { } + kind: Namespace + name: qux + - apiVersion: v1 + feedStatusDetails: + - available: true + clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 + clusterName: clusternet-cluster-bb2xp + replicaStatus: { } + - available: true + clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc + clusterName: clusternet-cluster-skxd4 + replicaStatus: { } + feedStatusSummary: + available: true + replicaStatus: { } + kind: Service + name: my-nginx-svc + namespace: qux + - apiVersion: apps/v1 + feedStatusDetails: + - available: true + clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 + clusterName: clusternet-cluster-bb2xp + replicaStatus: + availableReplicas: 1 + observedGeneration: 9 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + - available: true + clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc + clusterName: clusternet-cluster-skxd4 + replicaStatus: + availableReplicas: 2 + observedGeneration: 5 + readyReplicas: 2 + replicas: 2 + updatedReplicas: 2 + feedStatusSummary: + available: true + replicaStatus: + availableReplicas: 3 + observedGeneration: 9 + readyReplicas: 3 + replicas: 3 + updatedReplicas: 3 + kind: Deployment + name: my-nginx + namespace: qux + bindingClusters: + - clusternet-v7wzq/clusternet-cluster-bb2xp + - clusternet-wlf5b/clusternet-cluster-skxd4 + desiredReleases: 2 + replicas: + apps/v1/Deployment/qux/my-nginx: + - 1 + - 2 + v1/Namespace/qux: [ ] + v1/Service/qux/my-nginx-svc: [ ] + specHash: 3893382778 +``` + +From above example, we can see Deployment `qux/my-nginx` with total 3 replicas has been deployed to 2 clusters. +From `feedStatusSummary`, we can see total 3 replicas are available and running healthy. diff --git a/content/en/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md b/content/en/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md new file mode 100644 index 0000000..f610d95 --- /dev/null +++ b/content/en/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md @@ -0,0 +1,96 @@ +--- +title: "Deploying Applications to Multiple Clusters with Dynamic Scheduling" +description: "Scheduling applications of multiple replicas to several clusters by cluster capacity" +date: 2022-07-13 +draft: false +weight: 3 +--- + +This tutorial will walk you through how to deploy applications to multiple clusters with dynamic scheduling. It is +different from static dividing scheduling. When using dynamic scheduling, the replicas of an application will be split +based on cluster capacity. + +## Defining Your Applications + +Let's see an example using dynamic scheduling. Below `Subscription` "dynamic-dividing-scheduling-demo" defines the +target child clusters to be distributed to, and the resources to be deployed with. + +```yaml +# examples/dynamic-dividing-scheduling/subscription.yaml +apiVersion: apps.clusternet.io/v1alpha1 +kind: Subscription +metadata: + name: dynamic-dividing-scheduling-demo + namespace: default +spec: + subscribers: # filter out a set of desired clusters + - clusterAffinity: + matchExpressions: + - key: clusters.clusternet.io/cluster-id + operator: Exists + schedulingStrategy: Dividing + dividingScheduling: + type: Dynamic + dynamicDividing: + strategy: Spread # currently we only support Spread dividing strategy + feeds: # defines all the resources to be deployed with + - apiVersion: v1 + kind: Namespace + name: qux + - apiVersion: v1 + kind: Service + name: my-nginx-svc + namespace: qux + - apiVersion: apps/v1 # with a total of 6 replicas + kind: Deployment + name: my-nginx + namespace: qux +``` + +The `Deployment` qux/my-nginx above will run in a set of clusters with a total of 6 replicas. For example, if we've got +three matching clusters as below. + +- `cluster-01` can run 3 replicas of Deployment `qux/my-nginx` +- `cluster-02` can run 6 replicas of Deployment `qux/my-nginx` +- `cluster-03` can run 9 replicas of Deployment `qux/my-nginx` + +`clusternet-scheduler` will assign replicas to each matching cluster by their capacity. As a result, these three clusters +will run 1, 2, 3 replicas respectively. + +You can get the scheduling result by checking the status of Subscription `dynamic-dividing-scheduling-demo`. + +```yaml +bindingClusters: + - clusternet-v7wzq/clusternet-cluster-bb2xp + - clusternet-wlf5b/clusternet-cluster-skxd4 + - clusternet-bbf20/clusternet-cluster-aqx3b + desiredReleases: 6 + replicas: + apps/v1/Deployment/qux/my-nginx: + - 1 + - 2 + - 3 + v1/Namespace/qux: [] + v1/Service/qux/my-nginx-svc: [] +``` + +If you want to apply overrides per cluster, please +follow [How to Set Overrides in Clusternet](/docs/tutorials/multi-cluster-apps/setting-overrides/). + +## Applying Your Applications + +After installing kubectl plugin [kubectl-clusternet](/docs/kubectl-clusternet/), you could run commands below to +distribute this application to child clusters. + +```bash +$ kubectl clusternet apply -f examples/dynamic-dividing-scheduling/ +namespace/qux created +deployment.apps/my-nginx created +service/my-nginx-svc created +subscription.apps.clusternet.io/dynamic-dividing-scheduling-demo created +$ # or +$ # kubectl-clusternet apply -f examples/dynamic-dividing-scheduling/ +``` + +You can [check aggregated status](docs/tutorials/multi-cluster-apps/aggregated-status/) of feeds/resources running in +each child clusters. diff --git a/content/en/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md b/content/en/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md index e963448..72fdbe2 100644 --- a/content/en/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md +++ b/content/en/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md @@ -2,7 +2,7 @@ title: "Deploying Applications to Multiple Clusters with Replication Scheduling" date: 2022-04-11 draft: false -weight: 3 +weight: 1 description: "Scheduling applications to multiple clusters" --- @@ -17,7 +17,7 @@ First, let's see an example application. Below `Subscription` "app-demo" defines distributed to, and the resources to be deployed with. ```yaml -# examples/applications/subscription.yaml +# examples/replication-scheduling/subscription.yaml apiVersion: apps.clusternet.io/v1alpha1 kind: Subscription metadata: @@ -47,7 +47,7 @@ spec: ``` Before applying this `Subscription`, please -modify [examples/applications/subscription.yaml](https://github.com/clusternet/clusternet/blob/main/examples/applications/subscription.yaml) +modify [examples/replication-scheduling/subscription.yaml](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/subscription.yaml) with your clusterID. {{% alert title="Note" color="primary" %}} @@ -56,11 +56,11 @@ If you want to install a helm chart from a private helm repository, please set a {{% /alert %}} Clusternet also supports using [OCI-based registries](https://helm.sh/docs/topics/registries/) for Helm charts. Please -refer [this oci-based helm chart](../../examples/oci/oci-chart-mysql.yaml). +refer [this oci-based helm chart](https://github.com/clusternet/clusternet/blob/main/examples/oci/oci-chart-mysql.yaml). If you want to apply overrides per cluster, please follow [How to Set Overrides in Clusternet](setting-overrides.md). Before applying these Localization(s), please -modify [examples/applications/localization.yaml](https://github.com/clusternet/clusternet/blob/main/examples/applications/localization.yaml) +modify [examples/replication-scheduling/localization.yaml](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/localization.yaml) with your `ManagedCluster` namespace, such as `clusternet-5l82l`. ## Applying Your Applications @@ -69,17 +69,20 @@ After installing kubectl plugin [kubectl-clusternet](https://github.com/clustern below commands to distribute this application to child clusters. ```bash -$ kubectl clusternet apply -f examples/applications/ +$ kubectl clusternet apply -f examples/replication-scheduling/ helmchart.apps.clusternet.io/mysql created namespace/foo created deployment.apps/my-nginx created service/my-nginx-svc created subscription.apps.clusternet.io/app-demo created $ # or -$ # kubectl-clusternet apply -f examples/applications/ +$ # kubectl-clusternet apply -f examples/replication-scheduling/ ``` -## Checking Status +You can [check aggregated status](docs/tutorials/multi-cluster-apps/aggregated-status/) of feeds/resources running in +each child clusters. + +## Checking Subscription Status Then you can view the resources just created, diff --git a/content/en/docs/tutorials/multi-cluster-apps/setting-overrides.md b/content/en/docs/tutorials/multi-cluster-apps/setting-overrides.md index aca4a12..69e9a31 100644 --- a/content/en/docs/tutorials/multi-cluster-apps/setting-overrides.md +++ b/content/en/docs/tutorials/multi-cluster-apps/setting-overrides.md @@ -24,7 +24,7 @@ Meanwhile, below override policies are supported, Here you can refer below samples to learn more, -- [Localization Sample](https://github.com/clusternet/clusternet/blob/main/examples/applications/localization.yaml) -- [Globalization Sample](https://github.com/clusternet/clusternet/blob/main/examples/applications/globalization.yaml) +- [Localization Sample](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/localization.yaml) +- [Globalization Sample](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/globalization.yaml) Please remember to modify the namespace to your `ManagedCluster` namespace, such as `clusternet-5l82l`. diff --git a/content/en/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md b/content/en/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md index c7cc5e6..e39fd6a 100644 --- a/content/en/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md +++ b/content/en/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md @@ -3,7 +3,7 @@ title: "Deploying Applications to Multiple Clusters with Static Weight Schedulin description: "Scheduling applications of multiple replicas to several clusters by static cluster weight" date: 2022-04-11 draft: false -weight: 4 +weight: 2 --- This tutorial will walk you through how to deploy applications to multiple clusters with static weight scheduling. It is @@ -54,6 +54,21 @@ spec: The `Deployment` bar/my-nginx above will run in two clusters with a total of 6 replicas, while 2 replicas run in cluster with ID `dc91021d-2361-4f6d-a404-7c33b9e01118`, 4 replicas in cluster with ID `5f9da921-0437-4fea-a89d-42aa1ede9b25`. +You can get the scheduling result by checking the status of Subscription `static-dividing-scheduling-demo`. + +```yaml +bindingClusters: + - clusternet-v7wzq/clusternet-cluster-bb2xp + - clusternet-wlf5b/clusternet-cluster-skxd4 + desiredReleases: 6 + replicas: + apps/v1/Deployment/qux/my-nginx: + - 2 + - 4 + v1/Namespace/qux: [] + v1/Service/qux/my-nginx-svc: [] +``` + Before applying this `Subscription`, please modify [examples/static-dividing-scheduling/subscription.yaml](https://github.com/clusternet/clusternet/blob/main/examples/static-dividing-scheduling/subscription.yaml) with your clusterID. @@ -74,3 +89,6 @@ subscription.apps.clusternet.io/static-dividing-scheduling-demo created $ # or $ # kubectl-clusternet apply -f examples/static-dividing-scheduling/ ``` + +You can [check aggregated status](docs/tutorials/multi-cluster-apps/aggregated-status/) of feeds/resources running in +each child clusters. diff --git a/content/zh-cn/docs/tutorials/multi-cluster-apps/_index.md b/content/zh-cn/docs/tutorials/multi-cluster-apps/_index.md index b9d7e66..223800d 100644 --- a/content/zh-cn/docs/tutorials/multi-cluster-apps/_index.md +++ b/content/zh-cn/docs/tutorials/multi-cluster-apps/_index.md @@ -1,7 +1,7 @@ --- -title: "Multi-Cluster Applications" +title: "多集群应用分发" weight: 2 -description: "Deploying applications to multiple clusters with various scheduling strategies" +description: "通过多种调度策略将应用分发到多集群中" --- Clusternet支持通过一组API将应用程序从托管集群部署到多个集群。 diff --git a/content/zh-cn/docs/tutorials/multi-cluster-apps/aggregated-status.md b/content/zh-cn/docs/tutorials/multi-cluster-apps/aggregated-status.md new file mode 100644 index 0000000..2787097 --- /dev/null +++ b/content/zh-cn/docs/tutorials/multi-cluster-apps/aggregated-status.md @@ -0,0 +1,92 @@ +--- +title: "Checking Aggregated Status" +description: "Aggregating resource status from child clusters" +date: 2022-07-13 +draft: false +weight: 8 +--- + +In Clusternet, you can check the aggregated status of all deployed resources by visiting the status of Subscription. For +every feed/resource, you can check the detailed status (field `feedStatusDetails`) per cluster and the summarized +status (field `feedStatusSummary`) of all clusters in `status.aggregatedStatuses`. + +```yaml +status: + aggregatedStatuses: + - apiVersion: v1 + feedStatusDetails: + - available: true + clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 + clusterName: clusternet-cluster-bb2xp + replicaStatus: { } + - available: true + clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc + clusterName: clusternet-cluster-skxd4 + replicaStatus: { } + feedStatusSummary: + available: true + replicaStatus: { } + kind: Namespace + name: qux + - apiVersion: v1 + feedStatusDetails: + - available: true + clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 + clusterName: clusternet-cluster-bb2xp + replicaStatus: { } + - available: true + clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc + clusterName: clusternet-cluster-skxd4 + replicaStatus: { } + feedStatusSummary: + available: true + replicaStatus: { } + kind: Service + name: my-nginx-svc + namespace: qux + - apiVersion: apps/v1 + feedStatusDetails: + - available: true + clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 + clusterName: clusternet-cluster-bb2xp + replicaStatus: + availableReplicas: 1 + observedGeneration: 9 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + - available: true + clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc + clusterName: clusternet-cluster-skxd4 + replicaStatus: + availableReplicas: 2 + observedGeneration: 5 + readyReplicas: 2 + replicas: 2 + updatedReplicas: 2 + feedStatusSummary: + available: true + replicaStatus: + availableReplicas: 3 + observedGeneration: 9 + readyReplicas: 3 + replicas: 3 + updatedReplicas: 3 + kind: Deployment + name: my-nginx + namespace: qux + bindingClusters: + - clusternet-v7wzq/clusternet-cluster-bb2xp + - clusternet-wlf5b/clusternet-cluster-skxd4 + desiredReleases: 2 + replicas: + apps/v1/Deployment/qux/my-nginx: + - 1 + - 2 + v1/Namespace/qux: [ ] + v1/Service/qux/my-nginx-svc: [ ] + specHash: 3893382778 +``` + +From above example, we can see Deployment `qux/my-nginx` with total 3 replicas has been deployed to 2 clusters. +From `feedStatusSummary`, we can see total 3 replicas are available and running healthy. diff --git a/content/zh-cn/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md b/content/zh-cn/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md new file mode 100644 index 0000000..f610d95 --- /dev/null +++ b/content/zh-cn/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md @@ -0,0 +1,96 @@ +--- +title: "Deploying Applications to Multiple Clusters with Dynamic Scheduling" +description: "Scheduling applications of multiple replicas to several clusters by cluster capacity" +date: 2022-07-13 +draft: false +weight: 3 +--- + +This tutorial will walk you through how to deploy applications to multiple clusters with dynamic scheduling. It is +different from static dividing scheduling. When using dynamic scheduling, the replicas of an application will be split +based on cluster capacity. + +## Defining Your Applications + +Let's see an example using dynamic scheduling. Below `Subscription` "dynamic-dividing-scheduling-demo" defines the +target child clusters to be distributed to, and the resources to be deployed with. + +```yaml +# examples/dynamic-dividing-scheduling/subscription.yaml +apiVersion: apps.clusternet.io/v1alpha1 +kind: Subscription +metadata: + name: dynamic-dividing-scheduling-demo + namespace: default +spec: + subscribers: # filter out a set of desired clusters + - clusterAffinity: + matchExpressions: + - key: clusters.clusternet.io/cluster-id + operator: Exists + schedulingStrategy: Dividing + dividingScheduling: + type: Dynamic + dynamicDividing: + strategy: Spread # currently we only support Spread dividing strategy + feeds: # defines all the resources to be deployed with + - apiVersion: v1 + kind: Namespace + name: qux + - apiVersion: v1 + kind: Service + name: my-nginx-svc + namespace: qux + - apiVersion: apps/v1 # with a total of 6 replicas + kind: Deployment + name: my-nginx + namespace: qux +``` + +The `Deployment` qux/my-nginx above will run in a set of clusters with a total of 6 replicas. For example, if we've got +three matching clusters as below. + +- `cluster-01` can run 3 replicas of Deployment `qux/my-nginx` +- `cluster-02` can run 6 replicas of Deployment `qux/my-nginx` +- `cluster-03` can run 9 replicas of Deployment `qux/my-nginx` + +`clusternet-scheduler` will assign replicas to each matching cluster by their capacity. As a result, these three clusters +will run 1, 2, 3 replicas respectively. + +You can get the scheduling result by checking the status of Subscription `dynamic-dividing-scheduling-demo`. + +```yaml +bindingClusters: + - clusternet-v7wzq/clusternet-cluster-bb2xp + - clusternet-wlf5b/clusternet-cluster-skxd4 + - clusternet-bbf20/clusternet-cluster-aqx3b + desiredReleases: 6 + replicas: + apps/v1/Deployment/qux/my-nginx: + - 1 + - 2 + - 3 + v1/Namespace/qux: [] + v1/Service/qux/my-nginx-svc: [] +``` + +If you want to apply overrides per cluster, please +follow [How to Set Overrides in Clusternet](/docs/tutorials/multi-cluster-apps/setting-overrides/). + +## Applying Your Applications + +After installing kubectl plugin [kubectl-clusternet](/docs/kubectl-clusternet/), you could run commands below to +distribute this application to child clusters. + +```bash +$ kubectl clusternet apply -f examples/dynamic-dividing-scheduling/ +namespace/qux created +deployment.apps/my-nginx created +service/my-nginx-svc created +subscription.apps.clusternet.io/dynamic-dividing-scheduling-demo created +$ # or +$ # kubectl-clusternet apply -f examples/dynamic-dividing-scheduling/ +``` + +You can [check aggregated status](docs/tutorials/multi-cluster-apps/aggregated-status/) of feeds/resources running in +each child clusters. diff --git a/content/zh-cn/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md b/content/zh-cn/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md index a545ba2..3bdd814 100644 --- a/content/zh-cn/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md +++ b/content/zh-cn/docs/tutorials/multi-cluster-apps/replication-scheduling-to-multiple-clusters.md @@ -2,8 +2,8 @@ title: "通过复制调度将应用部署到多个集群" date: 2022-07-04 draft: false -weight: 3 -description: "Scheduling applications to multiple clusters" +weight: 1 +description: "将应用调度到多个集群" --- This tutorial will walk you through how to deploy applications to multiple clusters with replication scheduling, which @@ -16,7 +16,7 @@ then every cluster will run such a `Deployment` with 5 replicas respectively. 首先,我们先看下引用示例应用的定义,在 `Subscription` "app-demo" 下面定义了要分发的目标子集群以及要部署的资源。 ```yaml -# examples/applications/subscription.yaml +# examples/replication-scheduling/subscription.yaml apiVersion: apps.clusternet.io/v1alpha1 kind: Subscription metadata: @@ -46,29 +46,18 @@ spec: ``` 在应用`Subscription`前,请将修改clusterID。 -[examples/applications/subscription.yaml](https://github.com/clusternet/clusternet/blob/main/examples/applications/subscription.yaml) +[examples/replication-scheduling/subscription.yaml](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/subscription.yaml) +{{% alert title="提示" color="primary" %}} +如果要从私有 helm 仓库安装 helm chart,请参考[这个例子](https://github.com/clusternet/clusternet/blob/main/deploy/templates/helm-chart-private-repo.yaml)设置有效的 `chartPullSecret`。 +{{% /alert %}} -> :bulb: :bulb: -> 如果要从私有 helm 仓库安装 helm chart,请参考[这个例子](https://github.com/clusternet/clusternet/blob/main/deploy/templates/helm-chart-private-repo.yaml)设置有效的 `chartPullSecret`。 - -## 设置覆盖值 - -`Clusternet` 还提供了***基于两阶段优先级的***覆盖策略。 你可以定义有优先级的命名空间范围的`Localization`和集群范围的`Globalization`(范围从0到1000,默认为为 500), -其中较低的数字被认为是较低的优先级。这些`Globalization`和`Localization`将被应用按优先级从低到高的顺序。这意味着较低的`Globalization`中的覆盖值将被那些覆盖在更高的`Globalization` -中。首先是`Globalization`,然后是`Localization`。 - -> :dizzy: :dizzy: 举例, -> -> Globalization (优先级 : 100) -> Globalization (优先级: 600) -> Localization (优先级: 100) -> Localization (优先级 500) - -同时,支持以下覆盖策略。 - -- `ApplyNow` 将立即为匹配的对象应用覆盖,包括那些已经填充的对象。 -- 默认覆盖策略`ApplyLater`只会在下次更新时应用覆盖匹配的对象(包括更新在 `Subscription`、`HelmChart` 等)或新创建的对象。 +Clusternet 也支持使用在 Helm Chart 中使用[OCI标准的镜像仓库仓库](https://helm.sh/docs/topics/registries/). +请参考[这个 OCI 类型的 Helm Chart 示例](https://github.com/clusternet/clusternet/blob/main/examples/oci/oci-chart-mysql.yaml). +如果你想设置一些覆盖值(overrides),请参考[在 Clusternet 中如何设置 Overrides](setting-overrides.md). 在应用这些`Localization`之前,请 -修改[examples/applications/localization.yaml](https://github.com/clusternet/clusternet/blob/main/examples/applications/localization.yaml) +修改[examples/replication-scheduling/localization.yaml](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/localization.yaml) 使用您的`ManagedCluster`命名空间,例如`clusternet-5l82l`。 ## 应用你的应用程序 @@ -76,17 +65,19 @@ spec: 安装 kubectl 插件 [kubectl-clusternet](/docs/kubectl-clusternet/) 后,您可以运行下面的命令将此应用程序分发到子集群。 ```bash -$ kubectl clusternet apply -f examples/applications/ +$ kubectl clusternet apply -f examples/replication-scheduling/ helmchart.apps.clusternet.io/mysql created namespace/foo created deployment.apps/my-nginx created service/my-nginx-svc created subscription.apps.clusternet.io/app-demo created $ # or -$ # kubectl-clusternet apply -f examples/applications/ +$ # kubectl-clusternet apply -f examples/replication-scheduling/ ``` -## 检查状态 +你可以查看各个子集群中[汇聚的资源状态](docs/tutorials/multi-cluster-apps/aggregated-status/)。 + +## 检查 Subscription 状态 接下来就可以查看刚刚创建的资源了, diff --git a/content/zh-cn/docs/tutorials/multi-cluster-apps/setting-overrides.md b/content/zh-cn/docs/tutorials/multi-cluster-apps/setting-overrides.md index aca4a12..1ea27a1 100644 --- a/content/zh-cn/docs/tutorials/multi-cluster-apps/setting-overrides.md +++ b/content/zh-cn/docs/tutorials/multi-cluster-apps/setting-overrides.md @@ -1,30 +1,27 @@ --- -title: "How to Set Overrides in Clusternet" -description: "Setting priority based overrides" +title: "在 Clusternet 中如何设置 Overrides" +description: "设置基于优先级的 Overrides" date: 2022-04-11 draft: false weight: 10 --- -`Clusternet` provides a ***two-stage priority based*** override strategy. You can define namespace-scoped `Localization` -and cluster-scoped `Globalization` with priorities (ranging from 0 to 1000, default to be 500), where lower numbers are -considered lower priority. These Globalization(s) and Localization(s) will be applied by order from lower priority to -higher. That means override values in lower `Globalization` will be overridden by those in higher `Globalization`. -Globalization(s) come first and then Localization(s). +`Clusternet` 还提供了***基于两阶段优先级的***覆盖策略。 你可以定义有优先级的命名空间范围的`Localization`和集群范围的`Globalization`(范围从0到1000,默认为为 500), +其中较低的数字被认为是较低的优先级。这些`Globalization`和`Localization`将被应用按优先级从低到高的顺序。这意味着较低的`Globalization`中的覆盖值将被那些覆盖在更高的`Globalization` +中。首先是`Globalization`,然后是`Localization`。 -{{% alert title="For example" color="primary" %}} -Globalization (priority: 100) -> Globalization (priority: 600) -> Localization (priority: 100) -> Localization (priority 500) +{{% alert title="举例" color="primary" %}} +Globalization (优先级 : 100) -> Globalization (优先级: 600) -> Localization (优先级: 100) -> Localization (优先级 500) {{% /alert %}} -Meanwhile, below override policies are supported, +同时,支持以下覆盖策略。 -- `ApplyNow` will apply overrides for matched objects immediately, including those are already populated. -- Default override policy `ApplyLater` will only apply override for matched objects on next updates (including updates - on `Subscription`, `HelmChart`, etc) or new created objects. +- `ApplyNow` 将立即为匹配的对象应用覆盖,包括那些已经填充的对象。 +- 默认覆盖策略`ApplyLater`只会在下次更新时应用覆盖匹配的对象(包括更新在 `Subscription`、`HelmChart` 等)或新创建的对象。 Here you can refer below samples to learn more, -- [Localization Sample](https://github.com/clusternet/clusternet/blob/main/examples/applications/localization.yaml) -- [Globalization Sample](https://github.com/clusternet/clusternet/blob/main/examples/applications/globalization.yaml) +- [Localization 例子](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/localization.yaml) +- [Globalization 例子](https://github.com/clusternet/clusternet/blob/main/examples/replication-scheduling/globalization.yaml) -Please remember to modify the namespace to your `ManagedCluster` namespace, such as `clusternet-5l82l`. +请记得修改你的 `ManagedCluster` 命名空间, 比如 `clusternet-5l82l`. diff --git a/content/zh-cn/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md b/content/zh-cn/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md index c7cc5e6..e39fd6a 100644 --- a/content/zh-cn/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md +++ b/content/zh-cn/docs/tutorials/multi-cluster-apps/static-weight-scheduling-to-multiple-clusters.md @@ -3,7 +3,7 @@ title: "Deploying Applications to Multiple Clusters with Static Weight Schedulin description: "Scheduling applications of multiple replicas to several clusters by static cluster weight" date: 2022-04-11 draft: false -weight: 4 +weight: 2 --- This tutorial will walk you through how to deploy applications to multiple clusters with static weight scheduling. It is @@ -54,6 +54,21 @@ spec: The `Deployment` bar/my-nginx above will run in two clusters with a total of 6 replicas, while 2 replicas run in cluster with ID `dc91021d-2361-4f6d-a404-7c33b9e01118`, 4 replicas in cluster with ID `5f9da921-0437-4fea-a89d-42aa1ede9b25`. +You can get the scheduling result by checking the status of Subscription `static-dividing-scheduling-demo`. + +```yaml +bindingClusters: + - clusternet-v7wzq/clusternet-cluster-bb2xp + - clusternet-wlf5b/clusternet-cluster-skxd4 + desiredReleases: 6 + replicas: + apps/v1/Deployment/qux/my-nginx: + - 2 + - 4 + v1/Namespace/qux: [] + v1/Service/qux/my-nginx-svc: [] +``` + Before applying this `Subscription`, please modify [examples/static-dividing-scheduling/subscription.yaml](https://github.com/clusternet/clusternet/blob/main/examples/static-dividing-scheduling/subscription.yaml) with your clusterID. @@ -74,3 +89,6 @@ subscription.apps.clusternet.io/static-dividing-scheduling-demo created $ # or $ # kubectl-clusternet apply -f examples/static-dividing-scheduling/ ``` + +You can [check aggregated status](docs/tutorials/multi-cluster-apps/aggregated-status/) of feeds/resources running in +each child clusters.