Customize an Application per Cluster

Prerequisites
Ensure you have reviewed the prerequisites section.
Enable a Custom Configuration of an Application for a Cluster
You can customize the application for each cluster occurrence of said application. If you want to customize the application for a cluster that is not yet attached, refer to the instructions below, so the application is deployed with the custom configuration during attachment.
To enable per-cluster customizations:
Reference the name of the
ConfigMapto be applied per cluster in thespec.clusterConfigOverridesfields. In this example, you have three different customizations specified in three differentConfigMapsfor three different clusters in one workspace:YAMLcat <<EOF | kubectl apply -f - apiVersion: apps.kommander.d2iq.io/v1alpha3 kind: AppDeployment metadata: name: kube-prometheus-stack namespace: ${WORKSPACE_NAMESPACE} spec: appRef: name: kube-prometheus-stack-46.8.1 kind: ClusterApp clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster1 - attached-cluster2 - attached-cluster3-new clusterConfigOverrides: - configMapName: kps-cluster1-overrides clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster1 - configMapName: kps-cluster2-overrides clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster2 - configMapName: kps-cluster3-overrides clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster3-new EOFIf you have not done so yet, create the ConfigMaps referenced in each
clusterConfigOverridesentry.
The changes are applied only if the YAML file has a valid syntax.
Set up only one cluster override
ConfigMapper cluster. If there are severalConfigMapsconfigured for a cluster, only one will be applied.Cluster override
ConfigMapsmust be created on the Management cluster.
Enable a Custom Configuration of an Application for a Cluster at Attachment
You can customize the application configuration for a cluster prior to its attachment, so that the application is deployed with this custom configuration on attachment. This is preferable, if you do not want to redeploy the application with an updated configuration after it has been initially installed, which may cause downtime.
To enable per-cluster customizations, follow these steps before attaching the cluster:
Set the
CLUSTER_NAMEenvironment variable to the cluster name that you will give your to-be-attached cluster:CODEexport CLUSTER_NAME=<your_attached_cluster_name>Reference the name of the
ConfigMapyou want to apply to this cluster in thespec.clusterConfigOverridesfields. You do not need to update thespec.clusterSelectorfield. In this example, you have thekps-cluster1-overridescustomization specified forattached-cluster-1and a different customization (inkps-your-attached-cluster-overridesConfigMap) for your to-be-attached cluster:YAMLcat <<EOF | kubectl apply -f - apiVersion: apps.kommander.d2iq.io/v1alpha3 kind: AppDeployment metadata: name: kube-prometheus-stack namespace: ${WORKSPACE_NAMESPACE} spec: appRef: name: kube-prometheus-stack-46.8.1 kind: ClusterApp clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster1 clusterConfigOverrides: - configMapName: kps-cluster1-overrides clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - attached-cluster1 - configMapName: kps-your-attached-cluster-overrides clusterSelector: matchExpressions: - key: kommander.d2iq.io/cluster-name operator: In values: - ${CLUSTER_NAME} EOFIf you have not done so yet, create the ConfigMap referenced for your to-be-attached cluster.
The changes are applied only if the YAML file has a valid syntax.
Cluster override
ConfigMapsmust be created on the Management cluster.
Verify the Current Configuration of your Application
Refer to the Verify applications help to connect to the managed or attached cluster and check the status of the deployments.
If you want to know how the AppDeployment resource is currently configured, refer to the Print and review the state of your AppDeployment section.