What is in helm's values.yaml equivalent of a k8s manifest's nfs-volume?

58 Views Asked by At

I am just learning helm charts and want to slowly migrate my manifest to helm.

As far as I have understood, values.yaml is the way to get a chart customized. My current manifest contains PV's using the nfs-volumes like this:

    spec:
      containers:
      - image: linuxserver/ddclient
        imagePullPolicy: Always
        name: ddclient
        volumeMounts:
        - mountPath: /config
          name: ddclient-config
      volumes:
      - name: ddclient-config
        nfs:
          path: /home/main/ddclient
          server: 10.0.0.101

How would I go about setting up (considering the example above) /home/main/ddclient in values.yaml ? Does anybody have tutorials or examples?

1

There are 1 best solutions below

0
ha36d On

you can define a renderer function in your helper:

{{- define "application.tplvalues.render" -}}
{{- tpl (.value | toYaml) .context }}
{{- end -}}

then in your chart:

{{- if .Values.application.volumes }}
{{- range $key, $value := .Values.application.volumes  }}
      - name: {{ $key }}
{{ include "application.tplvalues.render" ( dict "value" $value "context" $ ) | indent 12 }}
{{- end }}
{{- end }}

and then in values, you can have:

volumes:
    ddclient-config:
      configMap:
        nfs:
          path: /home/main/ddclient
          server: 10.0.0.101

For a very good base of the helm chart, you can use this skeleton.