tencent cloud

Localization/Globalization
Last updated:2025-04-17 19:48:14
Localization/Globalization
Last updated: 2025-04-17 19:48:14

Overview

Distributed Application Management supports distributing K8s resources across multiple clusters for unified management, reducing redundant definitions for users, and enabling streamlined and convenient configuration. In the process of deploying applications to multiple clusters, scenarios such as batch configuration, differentiated configuration, gray-scale updates, and change rollbacks are common. Using the Localization/Globalization can effectively address these scenarios, for example:
Provides a unified tag for all distributed resources. For example, apps.my.company/deployed-by: my-platform.
Configures cluster information for the resource instances distributed to a cluster. For example, apps.my.company/running-in: cluster-01.
Individually adjust configurations such as the number of replicas and image names for an application in each cluster, for instance, for a Deployment application named my-nginx (with a declared replica number of 3), specifying the number of replicas distributed to clusters cluster-01, cluster-02, and cluster-03 as 3, 5, and 7, respectively.
Before you distribute the application to cluster-01, you can adjust some configurations of the application in the cluster. For example, you can inject a Sidecar container.
In scenarios such as major promotion campaigns, sudden traffic peak and urgent scaling, you can release modifications to specified clusters to shorten the risky scope. You can also roll back the modifications.
If you define multiple localization/globalization configurations, you can set weight for them by specifying the priority to avoid conflicts.

Concepts

Localization/Globalization

Distributed Application Management offers two types of differentiation strategies for differentiating configurations between clusters:

Globalization Policy

It defines cluster-scoped configurations, and is used to manage the global configurations among clusters. For example, you can configure same tags for resources in batch.

Localization Policy

It defines namespace-scoped configurations, and is used to manage the configurations specific to a cluster. For example, you can modify the number of Deployment replicas in a cluster, upgrade an image and add a Sidecar image.

Priority

You can manage and configure resources based on the priority specified by the localization policy and globalization policy. The priority can be defined on a scale from 0 to 1,000. A smaller value indicates a lower priority. The default value is 500. When you perform localization and globalization rendering, the Clusternet applies the policies in the order of Globalization (low priority) > Globalization (high priority) > Localization (low priority) > Localization (high priority).

Override Policy

It provides two policy types, including ApplyLater (default) and ApplyNow. ApplyLater indicates the localization/globalization policy does not take effect to the resources immediately, but will take effect in the next time when the resources are modified or updated. ApplyNow indicates the policy takes effect immediately to the resources.

Override Type

Supports both MergePatch and JSONPatch formats, used to describe changes in specified resource configurations. Definitions of the two formats are as follows:
For more information about the comparison between the two formats, see JSON Patch and JSON Merge Patch.

Configuration Instructions

Method 1: Using YAML

All application resources distributed through Distributed Application Management can be configured with Localization/Globalization, supporting the creation, update, and deletion of Localization/Globalization. Localization/Globalization support configuration via YAML. Click Creating Localization/Globalization or Updating Localization/Globalization to enter the policy editing page and edit the Localization policy. For example:
apiVersion: apps.clusternet.io/v1alpha1
kind: Localization
metadata:
name: my-nginx-overrides
namespace: clusternet-b5vgv
spec:
priority: 300
feed:
apiVersion: apps/v1
kind: Deployment
name: my-nginx
namespace: nginx-test
overridePolicy: ApplyLater
overrides:
- name: update-image-version
type: JSONPatch
value: |-
- path: "/spec/template/spec/containers/0/image"
value: "nginx:1.14.2"
op: replace
The spec.feed field describes the application resources associated with the Localization/Globalization. The spec.overridePolicy field specifies whether the Override policy is ApplyLater or ApplyNow. The spec.overrides definition addresses the differentiation configurations to be processed, supporting both MergePatch and JSONPatch formats. Enter the patch in the value field.
In the Localization/Globalization YAML configuration above, it is indicated for the Deployment bb application resource to undergo differentiation configuration using the JSONPatch format patch. The number of replicas for this application at /spec/replicas is set to 1. The priority of this Localization/Globalization is set at 300. If there is a policy with a higher priority that also modifies the /spec/replicas configuration of the application, the current policy's modification will be overridden.
Note
The content of the spec.overrides.value field follows the MergePatch and JSONPatch standards. Users can use corresponding tools to help generate the patch content, such as JSON Patch Builder Online.

Method 2: Via the Console

Configuring differentiation strategies through the console's visual page will be introduced in future versions. Please stay tuned.

Related Resources

The Localization/Globalization is based on the open-source multi-cluster application governance Clusternet project. For more information, please visit the open-source project website.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback