Helm Operator and Flux

Helm Operator is a kubernetes operator that is built around the Helm tool to release charts to Kuberenetes cluster without using the helm command.

The essential mechanism is this: the declaration of a HelmRelease is represented by a custom resource, specifying the chart and its values. Flux will apply it to the cluster, and once it's in the cluster, the Helm Operator will make sure the release exists by installing or upgrading it.

The HelmRelease custom resource

Each release of a chart is declared by a HelmRelease resource. The schema for these resources is given in the custom resource definitionopen in new window. They look like this:

apiVersion: flux.weave.works/v1beta1
kind: HelmRelease
  name: rabbit
  namespace: default
  releaseName: rabbitmq
    repository: https://kubernetes-charts.storage.googleapis.com/
    name: rabbitmq
    version: 3.3.6
    replicas: 1

The releaseName will be given to Helm as the release name. If not supplied, it will be generated by affixing the namespace to the resource name. In the above example, if releaseName were not given, it would be generated as default-rabbitmq. Because of the way Helm works, release names must be unique in the cluster.

The chart section gives a pointer to the chart; in this case, to a chart in a Helm repo. Since the helm operator is running in your cluster, and doesn't have access to local configuration, the repository is given as a URL rather than an alias (the URL in the example is what's usually aliased as stable). The name and version specify the chart to release.

The values section is where you provide the value overrides for the chart. This is as you would put in a values.yaml file, but inlined into the structure of the resource.

Stakater HelmRelease Workflow

Repositories contain yaml files of kind HelmRelease like mentioned in the above section. Charts are pulled by their name and version form the repositories referenced from the URL mentioned in the repository field. Values are passed in the values section which overrides the values from the charts pulled. kubectl command applies the HelmRelease resource. When the Helm Operator sees a HelmRelease resource in the cluster, it either installs or upgrades the named Helm release so that the chart is released as specified. It will also notice when a HelmRelease resource is updated, and take action accordingly.