MChorfa / porter-helm3

porter-helm3
Apache License 2.0
8 stars 10 forks source link

Helm3 Mixin for Porter

This is a Helm3 mixin for Porter. It executes the appropriate helm command based on which action it is included within: install, upgrade, or delete.

Install or Upgrade

Currently we only support the installation via --feed-url. Please make sure to install the mixin as follow:

porter mixin install helm3 --version v1.0.1 --feed-url https://mchorfa.github.io/porter-helm3/atom.xml

Mixin Configuration

Helm client version configuration. You can define others minors and patch versions up and down

- helm3:
    clientVersion: v3.8.2

Repositories

- helm3:
    repositories:
      stable:
        url: "https://charts.helm.sh/stable"

Mixin Syntax

Install

install:
  - helm3:
      description: "Description of the command"
      name: RELEASE_NAME
      chart: STABLE_CHART_NAME
      version: CHART_VERSION
      namespace: NAMESPACE
      devel: BOOL
      wait: BOOL # default true
      noHooks: BOOL # disable pre/post upgrade hooks (default false)
      skipCrds: BOOL # if set, no CRDs will be installed (default false)
      timeout:  DURATION # time to wait for any individual Kubernetes operation
      atomic: BOOL # if set to false, the install process will not roll back changes made in case the install fails (default true)
      debug: BOOL # enable verbose output (default false)
      set:
        VAR1: VALUE1
        VAR2: VALUE2
      values: # Array of paths to: Set/Override multiple values and multi-lines values
        - PATH_TO_THE_VALUES_FILE_1
        - PATH_TO_THE_VALUES_FILE_2
        - PATH_TO_THE_VALUES_FILE_3

Upgrade

upgrade:
  - helm3:
      description: "Description of the command"
      name: RELEASE_NAME
      chart: STABLE_CHART_NAME
      version: CHART_VERSION
      namespace: NAMESPACE
      resetValues: BOOL
      reuseValues: BOOL
      wait: BOOL # default true
      noHooks: BOOL # disable pre/post upgrade hooks (default false)
      skipCrds: BOOL # if set, no CRDs will be installed (default false)
      timeout:  DURATION # time to wait for any individual Kubernetes operation
      atomic: BOOL # if set to false, the upgrade process will not roll back changes made in case the upgrade fails (default true)
      debug: BOOL # enable verbose output (default false)
      set:
        VAR1: VALUE1
        VAR2: VALUE2
      values: # Array of paths to: Set/Override multiple values and multi-line values
        - PATH_TO_THE_VALUES_FILE_1
        - PATH_TO_THE_VALUES_FILE_2
        - PATH_TO_THE_VALUES_FILE_3

Uninstall

uninstall:
  - helm3:
      description: "Description of command"
      namespace: NAMESPACE
      releases:
        - RELEASE_NAME1
        - RELEASE_NAME2
      wait: BOOL # default false, if set It will wait for as long as --timeout
      noHooks: BOOL # prevent hooks from running during uninstallation
      timeout:  DURATION # time to wait for any individual Kubernetes operation
      debug: BOOL # enable verbose output (default false)

Outputs

The mixin supports saving secrets from Kubernetes as outputs.

outputs:
  - name: NAME
    secret: SECRET_NAME
    key: SECRET_KEY

The mixin also supports extracting resource metadata from Kubernetes as outputs.

outputs:
  - name: NAME
    resourceType: RESOURCE_TYPE
    resourceName: RESOURCE_TYPE_NAME
    namespace: NAMESPACE
    jsonPath: JSON_PATH_DEFINITION

Examples

Install

install:
  - helm3:
      description: "Install MySQL"
      name: mydb
      chart: stable/mysql
      version: 0.10.2
      namespace: mydb
      skipCrds: true
      set:
        mysqlDatabase: wordpress
        mysqlUser: wordpress
      values:
        - "./manifests/values_1.yaml"
        - "./manifests/values_2.yaml"
        - "./manifests/values_3.yaml"
      outputs:
        - name: mysql-root-password
          secret: mydb-mysql
          key: mysql-root-password
        - name: mysql-password
          secret: mydb-mysql
          key: mysql-password
        - name: mysql-cluster-ip
          resourceType: service
          resourceName: porter-ci-mysql-service
          namespace: "default"
          jsonPath: "{.spec.clusterIP}"

Upgrade

upgrade:
  - helm3:
      description: "Upgrade MySQL"
      name: porter-ci-mysql
      chart: stable/mysql
      version: 0.10.2
      wait: true
      resetValues: true
      reuseValues: false
      noHooks: true
      set:
        mysqlDatabase: mydb
        mysqlUser: myuser
        livenessProbe.initialDelaySeconds: 30
        persistence.enabled: true
      values:
        - "./manifests/values_1.yaml"
        - "./manifests/values_2.yaml"
        - "./manifests/values_3.yaml"

Uninstall

uninstall:
  - helm3:
      description: "Uninstall MySQL"
      namespace: mydb
      releases:
        - mydb
      wait: true
      noHooks: true

Execute

login:
  - helm3:
      description: "Login to OCI registry"
      arguments:
        - registry
        - login
        - localhost:5000
        - "--insecure"
      flags:
        u: myuser
        p: mypass