Search code examples
kubernetes-helmquarkus

how can I put template into volume deployment attribute


Following the documentation, I couldn't get it to work. I need to put the model in the volume deployment attribute.

What I can did understand, that helm can't get reference volume deployment attribute. I did this...

quarkus.helm.expressions."volumes".path=spec.template.spec.volumes
quarkus.helm.expressions."volumes".expression={{- include "deployment.volumes" . }}

And I expect this

kind: Deployment
...
spec:
  ...
  template:
  ...
  spec:
    volumes: {{- include "deployment.volumes" . }}

Please, can some help me? How can I do that?


Solution

  • I did it!!!

    {{- define "volumeMounts" -}}
      volumeMounts:
    {{- end }}
    
    {{- define "volumes" -}}
      volumes:
    {{- end }}
    
    {{- define "deployment.volumeMounts" -}}
    {{- include "volumeMounts" . | nindent 10 }}
    {{- include "volumes" . | nindent 8 }}
    {{- end }}
    
    quarkus.helm.expressions."deployment.volumeMounts".path=spec.template.spec.containers.volumeMounts
    quarkus.helm.expressions."deployment.volumeMounts".expression={{ include "deployment.volumeMounts" . }}
    

    As the volumeMounts attribute is the last to be defined in the template, I linked what I wanted through it.