Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically handling multiple charts in one mvn module #38

Open
gintautassulskus opened this issue Apr 20, 2018 · 3 comments
Open

Automatically handling multiple charts in one mvn module #38

gintautassulskus opened this issue Apr 20, 2018 · 3 comments
Assignees
Labels

Comments

@gintautassulskus
Copy link

I would like to create a maven module called build-service containing the following charts:

  1. artifactory
  2. docker-registry
  3. jenkins

Is there a way to package and install/uninstall all three charts automatically using the maven helm plugin? I got the impression that the plugin expects a specific chart.
If not, would it make sense to introduce such a functionality? E.g. chartContentsUri could accept an array of URIs, ideally with a wildcard support. That would enable cases such as:

  1. Array of paths:
  [ 
    "file:${project.basedir}/src/helm/charts/chart1/",
    "file:${project.basedir}/src/helm/charts/chart2"
  ]
  1. Handling of all charts in a directory:
    file:${project.basedir}/src/helm/charts/*

In some instances helm:install could then potentially fail due to a subset of target charts being already installed to the environment. Similarly, helm:uninstall would fail if one of the charts has not been installed. This could be rectified manually or with some pre-settable behavirous, e.g. continueOnFailure.

At the moment I can package artifactory, docker-registry and jenkins in a single chart, but then the management thereof becomes more difficult.

@ljnelson
Copy link
Member

Hi; thanks for using the microBean Helm Maven Plugin.

No, I'm not going to support this because you can create as many <execution>s as you want, each with different paths, etc. That's just Maven configuration and I wouldn't want to duplicate that.

@ljnelson ljnelson self-assigned this Apr 20, 2018
@gintautassulskus
Copy link
Author

Thanks for the response, @ljnelson.

tl;dr:

A solution is to use a single chart with sub-charts/dependencies. It assigns a release ID for the all the sub-charts, which are then treated as a single deployment.

my use case

The execution tag ties helm plugin execution to a certain phase(s) and makes the build process inflexible.

To give some context: my project contains microservice source code, infrastructure helm charts and documentation:

./src
    /helm/ - helm charts for the infrastructure, required by the microservice
    /main/java/ - microservice java srouces
    /main/fabric8/ - k8s snippets for microservice's docker container
    /main/docs/ - documentation sources

I should then be able run these separately:

  1. Install/uninstall helm charts
  2. Build microservice's sources
  3. Build microservice's docker image and deploy it to k8s

I am just trying to work out a good development workflow model using this plugin.

@ljnelson
Copy link
Member

If you want to simply install a helm chart from the Maven command line, you don't need to run a Maven lifecycle phase. You can just invoke the helm:install goal directly (as you can do with any Maven plugin):

mvn helm:install

To answer your original question ("Is there a way to package and install/uninstall all three charts automatically using the maven helm plugin?") you would use normal Maven constructs for that:

<plugin>
  <groupId>org.microbean</groupId>
  <artifactId>helm-maven-plugin</artifactId>
  <version>2.8.2.1.0.4</version>
  <executions>
    <execution>
      <id>Build chart 1</id>
      <phase>whatever</phase>
      <goals>
        <goal>install</goal> <!-- or whatever -->
      </goals>
      <configuration>
        <!-- configuration for building chart 1, such as its chartUrl, etc. -->
      </configuration>
    </execution>
    <execution>
      <id>Build chart 2</id>
      <phase>whatever</phase>
      <!-- and so on -->
    </execution>
  </executions>
</plugin>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants