This is not flattening. This will remove file name under which those key=value
pairs are present.
If you want simple flat output as you showed, you should use literals
:
configMapGenerator:
- name: the-map
literals:
- FIRST: 1
- SECOND: 2
- LAST: 3
This is explained on # Kustomization.yaml Reference
files []string
List of files to generate ConfigMap data entries from. Each item should be a path to a local file, e.g. path/to/file.config
, and the filename will appear as an entry in the ConfigMap data field with its contents as a value.
literals []string
List of literal ConfigMap data entries. Each item should be a key and literal value, e.g. somekey=somevalue
, and the key/value will appear as an entry in the ConfigMap data field.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
# generate a ConfigMap named my-java-server-props-<some-hash> where each file
# in the list appears as a data entry (keyed by base filename).
- name: my-java-server-props
files:
- application.properties
- more.properties
# generate a ConfigMap named my-java-server-env-vars-<some-hash> where each literal
# in the list appears as a data entry (keyed by literal key).
- name: my-java-server-env-vars
literals:
- JAVA_HOME=/opt/java/jdk
- JAVA_TOOL_OPTIONS=-agentlib:hprof
# generate a ConfigMap named my-system-env-<some-hash> where each key/value pair in the
# env.txt appears as a data entry (separated by \n).
- name: my-system-env
env: env.txt
EDIT:
As pointed by @Steven Liekens this answers the question:
env string
Single file to generate ConfigMap data entries from. Should be a path to a local env file, e.g. path/to/file.env, where each line of the file is a key=value pair. Each line will appear as an entry in the ConfigMap data field.