Application YAML Customizations
DKP provides the ability to configure an application for all clusters in a workspace, but also for a subset of clusters in a workspace. You can also apply customizations per cluster or workspace.
An AppDeployment
object creates a local HelmRelease YAML file that establishes how an Application is deployed. To further customiza the application, you can then create a ConfigMap
object with overriding configuration.
You can apply one and the same ConfigMap
to several clusters in a workspace, or choose to create different customizations in individual ConfigMaps
for each cluster.
The Appdeployment specifies the name of the app, the version of the app, the workspace where it applies Additionally, you can specify a subset of clusters, where it should be deployed, and if required, any customizations.
For example, this is the default AppDeployment
for the Kube Prometheus Stack Platform Application:
apiVersion: apps.kommander.d2iq.io/v1alpha3
kind: AppDeployment
metadata:
name: kube-prometheus-stack
namespace: ${WORKSPACE_NAMESPACE}
spec:
appRef:
name: kube-prometheus-stack-46.8.0
kind: ClusterApp
Override ALL Clusters within a Workspace
If you want to change the default configuration (customize an application), add a ConfigMap
with your override values. Then add that reference to the AppDeployment
by setting the configOverrides
field to the name of that ConfigMap
. When it refreshes the HelmRelease, it will add references to those ConfigMaps. This overrides the configuration of the app for all clusters within the Workspace, unless specified differently in the AppDpeloyment though the spec.clusterSelector
.
Example #1:
kind: HelmRelease
metadata:
...
name: dex
namespace: kommander
...
spec:
...
valuesFrom:
- kind: ConfigMap
name: dex-2.13.5-d2iq-defaults
- kind: ConfigMap
name: dex-cluster-overrides
Example #2:
This is an example, of how to customize the AppDeployment
of Kube Prometheus Stack:
Provide the name of a
ConfigMap
with the custom configuration in theAppDeployment
:CODEcat <<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.0 kind: ClusterApp configOverrides: name: kube-prometheus-stack-overrides-attached EOF
Line 12 references the name of the ConfigMap with the customization.
Create the
ConfigMap
with the name from the previous step, which provides the custom configuration on top of the default configuration:CODEcat <<EOF > kube-prometheus-stack-overrides-attached | kubectl apply -f - apiVersion: v1 kind: ConfigMap metadata: namespace: ${WORKSPACE_NAMESPACE} name: kube-prometheus-stack-overrides-attached data: values.yaml: | prometheus: prometheusSpec: storageSpec: volumeClaimTemplate: spec: resources: requests: storage: 150Gi EOF