I'm writing a K8s configmap for my Spring Boot application. This is my application.yaml file:
app:
config:
paths:
- id: a
uri: http://localhost:8080
args:
- x=1
- y=2
- id: b
uri: http://localhost:8081
args:
- x=3
- y=4
I tried to convert it into Kubernetes configmap as below (I followed this document https://github.com/spring-projects/spring-boot/wiki/Relaxed-Binding-2.0):
apiVersion: v1
kind: ConfigMap
metadata:
name: my-configmap
data:
app.config.paths_0_id: a
app.config.paths_0_uri: "http://a-service"
app.config.paths_0_args_0_: "x=1"
app.config.paths_0_args_1_: "y=2"
app.config.paths_1_id: b
app.config.paths_1_uri: "http://b-service"
app.config.paths_1_args_0_: "x=3"
app.config.paths_1_args_1_: "y=4"
And in the deployment file I defined configmap:
...
envFrom:
- configMapRef:
my-configmap
...
But when I deployed my application, it was not working, the configmap did not override the application.yaml, for example: the first uri of app.config.paths still is http://localhost:8080 not http://a-service.
So anyone has experience with that, please help me! How can I define an array in K8S configmap?
Thanks