ConfigMap from directory of non-json files

1,523 views
Skip to first unread message

Dmitry Shultz

unread,
Jan 29, 2018, 3:43:29 PM1/29/18
to kubernetes-sig-apps
Hi All,

I want top use Helm release management to manage ConfigMap releases because i have several releases/deployments that are using configuration from the same ConfigMap.
I'm not sure if its a valid use of Helm though...

So, my templates folder doen't have anything except of _helpers.tpl, configmap.yaml files and configs folder with .txt files that i want to render in the ConfigMap.

Here is the configmap.yaml:

apiVersion: v1
kind
: ConfigMap
Metadata:
  name
: {{ template "config-chart.fullname" . }}
  labels
:
    heritage
: {{ .Release.Service }}
    release
: {{ .Release.Name }}


data
:
 
{{- $files := .Files }}
 
{{- range tuple "configs/config1.txt" "configs/config2.txt" "configs/config3.txt" }}
 
{{ . }}: |-
   
{{ $files.Get . }}
 
{{- end }}

The problem is that the content of the txt files is not rendered (they are not empty), not sure why.
apiVersion: v1
kind
: ConfigMap
Metadata:
  name
: RELEASE-NAME-config-chart
  labels
:
    heritage
: Tiller
    release
: RELEASE-NAME


data
:
  configs
/config1.txt: |-
  configs
/config2.txt: |-
  configs
/config3.txt: |-



Dmitry Shultz

unread,
Jan 29, 2018, 5:19:41 PM1/29/18
to kubernetes-sig-apps
The reason why it didn't render the content of the files is that I misplaced the 'configs' directory, it should be in the root folder of the charts. Sorry for confusion.

Dmitry Shultz

unread,
Jan 29, 2018, 8:21:12 PM1/29/18
to kubernetes-sig-apps
It is still not quite usable for me.
The installation is successful:

$helm install --name mix-config config-chart-0.2.0.tgz
NAME
:   mix-config
LAST DEPLOYED
: Mon Jan 29 17:11:38 2018
NAMESPACE
: default
STATUS
: DEPLOYED


RESOURCES
:
==> MISSING
KIND          NAME
configmaps


NOTES
:

But, the upgrade (the same chart) fails with 'Could not get information about the resource: resource name may not be empty' :

$ helm upgrade mix-config config-chart-0.2.0.tgz
Error: UPGRADE FAILED: Could not get information about the resource: resource name may not be empty

Also, after 

$helm delete --purge the mix-config

The mix-config config map is still present (using kubectl get cm)

Is there anything I'm doing wrong or the whole idea of using Helm to manage ConfigMap is not supported?


On Monday, January 29, 2018 at 12:43:29 PM UTC-8, Dmitry Shultz wrote:
Reply all
Reply to author
Forward
0 new messages