I have following spring YAML structure:
catalogParamter:
- name: kota
street: xxx
- name: yyy
street: kkkk
now I want those values to come from values YAML in helm chart
in spring YAML catalogParamter: ${CATALOG_PARAMETER} and defined it in deployment yaml and config yaml
and values coming from values YAML
how to represent catalogParamter in values YAML.
There are different options here. I'd suggest putting the application.yaml in a ConfigMap. You could then expose properties in your values file with:
properties:
catalogParamter:
- name: kota
street: xxx
- name: yyy
street: kkkk
And populate the data section of your ConfigMap with:
data:
application.yaml: |-
{{ toYaml .Values.properties | indent 4 }}
You can then mount that ConfigMap into the /config
directory so that the spring boot app will automatically read it.
If instead you use environment variables then you can map complex properties to environment variables with Spring boot's relaxed binding. Coding that conversion in your chart could be tricky but your case seems to be name-value pairs so I think it could be done with helm's range function.
Another different pattern is to expose the option to set env vars directly to the user. But the disadvantage of this is the user would have to understand the env var format, which may not be intuitive with relaxed binding.