How do you add multiple config files to configMap with kustomize configMapGenerator by using a pattern/regex/...?

Viewed 2645

Currently I do this:

configMapGenerator:
  - name: sql-config-map
    files:
      - "someDirectory/one.sql"
      - "someDirectory/two.sql"
      - "someDirectory/three.sql"

and I would like to do sth. like this:

configMapGenerator:
  - name: sql-config-map
    files:
      - "someDirectory/*.sql"

Is this somehow possible?

2 Answers

This command works fine and will edit your kustomization.yaml:

kustomize edit add configmap my-configmap --from-file="$PWD/my-files/*"

The my-files directory has to be in the same folder that the kustomization.yaml file.

Related