Skip to content

Openet-Labs/helm-maven-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What?

This is a Maven plugin for testing, packaging and uploading HELM charts.

"HELM is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources."

Visit https://docs.helm.sh for detailed information.

Currently the upload to ChartMuseum and Artifactory is supported.

Maven Central

Build Status

Why?

Currently (October 2017) there is no simple Maven plugin to package existing HELM charts.

How?

The plugin downloads HELM in a specific version and runs the tool in the background.

Add following dependency to your pom.xml:

<dependency>
  <groupId>com.kiwigrid</groupId>
  <artifactId>helm-maven-plugin</artifactId>
  <version>2.7</version>
</dependency>

Configure plugin with explicit credentials:

...
<properties>
  <helm.download.url>https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz</helm.download.url>
  <repoBaseUrl>>https://repo.example.com/artifactory</repoBaseUrl>
</properties>
...
<build>
  <plugins>
  ...
    <plugin>
      <groupId>com.kiwigrid</groupId>
      <artifactId>helm-maven-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <chartDirectory>${project.basedir}</chartDirectory>
        <chartVersion>${project.version}</chartVersion>
        <uploadRepoStable>
            <name>stable-repo</name>
            <url>${repoBaseUrl}/helm-stable</url>
            <!-- Artifacotry requires basic authentication --> 
            <!-- which is supported from HELM version >= 2.9 -->
            <type>ARTIFACTORY</type>
            <username>foo</username>
            <password>bar</password>
        </uploadRepoStable>
        <uploadRepoSnapshot>
            <name>snapshot-repo</name>
            <url>${repoBaseUrl}/helm-snapshots</url>
            <type>CHARTMUSEUM</type>
        </uploadRepoSnapshot>
        <helmDownloadUrl>${helm.download.url}</helmDownloadUrl>
        <helmHomeDirectory>${project.basedir}/target/helm/home</helmHomeDirectory>
        <skipRefresh>false</skipRefresh>
        <excludes>
          <exclude>${project.basedir}/excluded</exclude>
        </excludes>
        <helmExtraRepos>
          <helmRepo>
            <name>incubator</name>
            <url>https://kubernetes-charts-incubator.storage.googleapis.com</url>
          </helmRepo>
        </helmExtraRepos>
      </configuration>
    </plugin>
  ...
  </plugins>
</build>

Configure plugin using credentials from settings.xml:

...
<properties>
  <helm.download.url>https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz</helm.download.url>
  <repoBaseUrl>>https://repo.example.com/artifactory</repoBaseUrl>
</properties>
...
<build>
  <plugins>
  ...
    <plugin>
      <groupId>com.kiwigrid</groupId>
      <artifactId>helm-maven-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <chartDirectory>${project.basedir}</chartDirectory>
        <chartVersion>${project.version}</chartVersion>
        <uploadRepoStable>
            <name>stable-repo</name>
            <url>${repoBaseUrl}/helm-stable</url>
            <type>ARTIFACTORY</type>
        </uploadRepoStable>
        <uploadRepoSnapshot>
            <name>snapshot-repo</name>
            <url>${repoBaseUrl}/helm-snapshots</url>
            <type>CHARTMUSEUM</type>
        </uploadRepoSnapshot>
        <helmDownloadUrl>${helm.download.url}</helmDownloadUrl>
        <helmHomeDirectory>${project.basedir}/target/helm/home</helmHomeDirectory>
      </configuration>
    </plugin>
  ...
  </plugins>
</build>

Features

  • Package Helm charts from standard folder structure
  • Test Helm charts (Helm lint)
  • Recursive chart detection (subcharts)
  • Helm does not need to be installed
  • Upload to ChartMuseum or Artifactory
  • Repository names are interpreted as server ids to retrieve basic authentication from server list in settings.xml.

Usage

Goals

  • helm:init initializes Helm by downloading a specific version
  • helm:dependency-build resolves the chart dependencies
  • helm:package packages the given charts (chart.tar.gz)
  • helm:lint tests the given charts
  • helm:dry-run simulates an install
  • helm:upload upload charts via HTTP PUT

Configuration

Parameter Type User Property Required Description
<chartDirectory> string helm.chartDirectory true root directory of your charts
<chartVersion> string helm.chartVersion true Version of the charts. The version have to be in the SEMVER-Format, required by helm.
<appVersion> string helm.appVersion false Version of the Application. The version have to be in the SEMVER-Format, required by helm.
<helmDownloadUrl> string helm.downloadUrl false URL to download helm
<excludes> list of strings helm.excludes false list of chart directories to exclude
<helmExecutableDirectory> string helm.executableDirectory false directory of your helm installation (default: ${project.build.directory}/helm)
<helmExecutable> string helm.executable false path to your helm executable (default: ${project.build.directory}/helm/linux-amd64/helm)
<outputDirectory> string helm.outputDirectory false chart output directory (default: ${project.build.directory}/helm/repo)
<helmHomeDirectory> string helm.homeDirectory false path to helm home directory; useful for concurrent Jenkins builds! (default: ~/.helm)
<helmExtraRepos> list of HelmRepository helm.extraRepos false adds extra repositories while init
<uploadRepoStable> HelmRepository helm.uploadRepo.stable true Upload repository for stable charts
<uploadRepoSnapshot> HelmRepository helm.uploadRepo.snapshot false Upload repository for snapshot charts (determined by version postfix 'SNAPSHOT')
<skipRefresh> boolean helm.init.skipRefresh false do not refresh (download) the local repository cache while init

About

Simple plugin to package helm charts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%