I am using Spring Cloud Data flow for microservice orchestration and deploying them in Kubernetes. My apps pipeline looks something like below: Source-app --> Processor-app --> Sink-app
I am able to create and deploy the stream and it successfully creates deployments and pods and my pipeline works fine with below SCDF deployer properties:
app.Source-app.deployer.kubernetes.livenessProbePath=/api/v1/actuator/health
app.Source-app.deployer.kubernetes.readinessProbePath=/api/v1/actuator/info
app.Source-app.server.port=8080
app.Processor-app.deployer.kubernetes.livenessProbePath=/api/v1/actuator/health
app.Processor-app.deployer.kubernetes.readinessProbePath=/api/v1/actuator/info
app.Processor-app.server.port=8080
app.Sink-app.deployer.kubernetes.livenessProbePath=/api/v1/actuator/health
app.Sink-app.deployer.kubernetes.readinessProbePath=/api/v1/actuator/info
app.Sink-app.server.port=8080
deployer.*.kubernetes.liveness-probe-path=/api/v1/actuator/health
deployer.*.kubernetes.readiness-probe-path=/api/v1/actuator/infoNow my requirement is, I want to store all the above configurations in a ConfigMap in Kubernetes and just refer or mount that ConfigMap in SCDF deployer properties window. I know we can refer using configMapKeyRefs as environment variable(with limitation for only String values) like:
deployer.Source-app.kubernetes.configMapKeyRefs=[{envVarName: 'LIVENESSPROBEPATH', configMapName: 'test-conf', dataKey: 'livenessProbePath }]
app.Source-app.deployer.kubernetes.livenessProbePath=$(LIVENESSPROBEPATH) ... So on for each property...
But this we need to do for each and every property. I am looking for something like, mention all the properties in a configMap and just refer or mount that ConfigMap while deploying stream in SCDF and voila! all your properties are passed to the apps. I was referring the official docs and reading about volumeMounts and persistentVolumes but not very clear. If someone could provide a solution for my usecase, it would be of great help.
consider you have configmap something like this :
apiVersion: v1
data:
USER_ID: "1"
USER_EMAIL: user@mail.com
IS_DATA_ENABLED : "True"
kind: ConfigMap
metadata:
name: staging-configmap
namespace: defaultyou can inject all property in deployment with
envFrom:
- secretRef:
name: test-secret
- configMapRef:
name: staging-configmapif you have secret also you can mount or inject secret also to deployment and its variable set OS. using configMapRef it will add all the properties of config-map to deployment.