eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
763 stars 502 forks source link

Cannot use helm template in yaml fragments #2817

Open rechandler12 opened 7 months ago

rechandler12 commented 7 months ago

Describe the bug

When I use helm template it produce error

      {{- if .Values.schedulerName }}
      schedulerName: { { .Values.schedulerName } }
      {{- end }}

Eclipse JKube version

1.16.1

Component

Kubernetes Maven Plugin

Apache Maven version

3.8.5

Gradle version

None

Steps to reproduce

  1. use yaml fragments
  2. add code
      {{- if .Values.schedulerName }}
      schedulerName: { { .Values.schedulerName } }
      {{- end }}
  3. after build it produces error

Expected behavior

JKube should support helm template

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

Linux, macOS

Eclipse JKube Logs

[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.16.1:resource (generate-resources) on project gateway: Execution generate-resources of goal org.eclipse.jkube:kubernetes-maven-plugin:1.16.1:resource failed: while scanning a simple key
[ERROR]  in reader, line 11, column 7:
[ERROR]           {{- if .Values.schedulerName }}
[ERROR]           ^
[ERROR] could not find expected ':'
[ERROR]  in reader, line 12, column 7:
[ERROR]           schedulerName: { { .Values.sched ... 
[ERROR]           ^
[ERROR] 


### Sample Reproducer Project

_No response_

### Additional context

_No response_
rohanKanojia commented 7 months ago

@rechandler12 : Hello, have you tried putting helm template as <parameters> in <helm> configuration, then reference that property in fragment? See this example

pom.xml

src/main/jkube/deployment.yaml

rohanKanojia commented 7 months ago

Do you think this is related to https://github.com/eclipse/jkube/issues/2479 ?

rohanKanojia commented 6 months ago

@rechandler12 : polite ping, Are you still facing the issue? We would appreciate some input from your side in order to fix this.