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 on attachment.
To enable per-cluster customizations:
Reference the name of the
ConfigMap
to be applied per cluster in thespec.clusterConfigOverrides
fields. In this example, you have three different customizations specified in three differentConfigMaps
for 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-44.2.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 EOF
If you have not done so yet, create the ConfigMaps referenced in each
clusterConfigOverrides
entry.
The changes are applied only if the YAML file has a valid syntax.
Set up only one cluster override
ConfigMap
per cluster. If there are severalConfigMaps
configured for a cluster, only one will be applied.Cluster override
ConfigMaps
must 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_NAME
environment 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
ConfigMap
you want to apply to this cluster in thespec.clusterConfigOverrides
fields. You do not need to update thespec.clusterSelector
field. In this example, you have thekps-cluster1-overrides
customization specified forattached-cluster-1
and a different customization (inkps-your-attached-cluster-overrides
ConfigMap
) 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-44.2.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} EOF
If 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
ConfigMaps
must 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.