kokuwaio / helm-maven-plugin

Simple plugin to package helm charts
MIT License
81 stars 55 forks source link

Recursive chart detection (subcharts) future = bug #349

Closed tipame closed 2 months ago

tipame commented 7 months ago

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Environment (plugin version, maven version, OS, ...): plugin version: 6.13.0 mvn version: 3.8.1 helm version: 3.8.0

What happened: I create simple example subchart structure from helm documentation: https://helm.sh/docs/chart_template_guide/subcharts_and_globals/ So i have directory structure:

mychart
    charts
        mysubchart

Plugin configuration:

<configuration>
    <chartDirectory>mychart</chartDirectory>
    <values>
        <yamlFile>etc/my-values.yaml</yamlFile>
    </values>    
</configuration>

I configure all values in my-values.yaml:

testKey: test1

mysubchart:
    testSubKey: test2

I ilso tryed to put values in parent (mychart) values.yaml (with the same result) in subchart template i have:

...
image: {{ .Values.testSubKey }}
...

I run mvn helm:upgrade@helm-install and get error:

[INFO] --- helm-maven-plugin:6.13.0:upgrade (helm-install) @ mychart ---
[INFO] Upgrading the chart with install C:\test-app\helm\mychart\charts\mysubchart
[ERROR] Error: UPGRADE FAILED: failed to create resource: Deployment.apps "mysubchart" is invalid: spec.template.spec.containers[0].image: Required value

So as you can see from logs - plugin start installing from subchart ("Recursive chart detection (subcharts)" future in action i think) and do not respect helm subchart values hierarchy.

What you expected to happen: I expect plugin to run install on parent chart and all subcharts will be installed by helm logic. I do not understand the reason why plagin should implement "Recursive chart detection (subcharts)" future...

How to reproduce it (as minimally and precisely as possible): Create helm subchart structure and declare values for subcharts in parent chart.

tipame commented 7 months ago

As workaround i managed to set exludes:

<excludes>
    <exclude>**/charts/**</exclude>
    <!-- duplicate pattern with different slashes - cause it not work on different OS -->
    <exclude>**\charts\**</exclude>    
</excludes>
sschnabe commented 6 months ago

@tipame Can you provide an example project?

sschnabe commented 2 months ago

Closing due missing feedback