This example splits the monolithic sdc.properties
file used in the previous example into two configMaps: one for properties that rarely if ever change (and that can be reused across multiple deployments), and one for dynamic properties targeted for a specific deployment.
Similar to the previous example, start by copying a clean sdc.properties
file to a local working directory.
Within that file, edit properties with values that will rarely change, and comment out properties that will need to be set for specific deployments. For example, I'll set these two properties values within the file:
http.realm.file.permission.check=false
http.enable.forwarded.requests=true
And I will comment out these two properties which I want to set specifically for a given deployment:
# sdc.base.http.url=http://<hostname>:<port>
# production.maxBatchSize=1000
One final setting: append the filename sdc-dynamic.properties
to the config.includes
property in the sdc.properties
file, like this:
config.includes=dpm.properties,vault.properties,credential-stores.properties,sdc-dynamic.properties
That setting will load the dynamic properties described below.
Save the sdc.properties
file in a configMap named sdc-static-properties
by executing the command:
$ kubectl create configmap sdc-static-properties --from-file=sdc.properties
Once again, the configMap sdc-static-properties
can be reused across multiple deployments.
Next, create a manifest named sdc-dynamic-properties.yaml
that will contain only properties specific to a given deployment, For example, my sdc-dynamic-properties.yaml
contains these two properties:
apiVersion: v1
kind: ConfigMap
metadata:
name: sdc-dynamic-properties
data:
sdc-dynamic.properties: |
sdc.base.http.url=https://sequoia.onefoursix.com
production.maxBatchSize=50000
Create the configMap by executing the command:
$ kubectl apply -f sdc-dynamic-properties.yaml
Add two Volumes to your SDC deployment manifest like this:
volumes:
- name: sdc-static-properties
configMap:
name: sdc-static-properties
items:
- key: sdc.properties
path: sdc.properties
- name: sdc-dynamic-properties
configMap:
name: sdc-dynamic-properties
items:
- key: sdc-dynamic.properties
path: sdc-dynamic.properties
And add two Volume Mounts to the SDC container, the first to overwrite the sdc.properties
file and the second to add the referenced sdc-dynamic.properties
file
volumeMounts:
- name: sdc-static-properties
mountPath: /etc/sdc/sdc.properties
subPath: sdc.properties
- name: sdc-dynamic-properties
mountPath: /etc/sdc/sdc-dynamic.properties
subPath: sdc-dynamic.properties
See sdc.yaml for the an example manifest.
Use kubectl port-forward
to confirm that the dynamically set properties are picked up by SDC: