in hack/generate_legacy_kustomizations.py [0:0]
def build_configmap_generators(kustomize_dir):
"""Return a dictionary mapping configMapGenerator name to files.
The dictionary will be used to copy over the files to the test directory
and generate an updated configMapGenerator in the kustomization.yaml
Returns:
dict: config map name to list of files used for the configmap generator
"""
kustomize_file = os.path.join(kustomize_dir, "kustomization.yaml")
with open(kustomize_file) as hf:
kustomize = yaml.load(hf)
generators = {}
for g in kustomize.get("configMapGenerator", []):
p_files = g.get("envs", [])
if "env" in g:
p_files.append(g["env"])
generators[g["name"]] = [os.path.join(kustomize_dir, f) for f in p_files]
return generators