NealR
NealR

Reputation: 10709

Cannot get files one folder up using glob pattern

I'm positive this is going to be something mundane, but can't seem to figure it out. Using helm I'm trying to insert all files in a folder one directory up into a ConfigMap. The glob pattern works fine if the folder is in the same directory as the configmap.yaml file, however move it one level above and it finds nothing. Below is the folder structure, below that is that yaml with the helm.

enter image description here

configmap.yaml

Screen shot to illustrate the path to the file:

enter image description here

Text:

apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-configmap
data:
  {{ (.Files.Glob "../prop/*").AsConfig | indent 2 }}

Upvotes: 1

Views: 3394

Answers (1)

z.x
z.x

Reputation: 2527

The working directory of helm is the directory where Chart.yaml is located, so the relative path should be based on this.

So your configuration should be written like this:

apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-configmap
data:
{{ (.Files.Glob "prop/*").AsConfig | indent 2 }}

In addition, Some files cannot be accessed through the .Files object, usually for security reasons.

  • Files in templates/ cannot be accessed.
  • Files excluded using .helmignore cannot be accessed.

helm doc

Upvotes: 5

Related Questions