Skip to content

Latest commit

 

History

History
106 lines (85 loc) · 5.36 KB

helm_release.md

File metadata and controls

106 lines (85 loc) · 5.36 KB

helm_release

helm_release(name, chart, create_namespace, kubernetes_context, namespace, namespace_dep,
             release_name, remote_chart, set, values, values_yaml, version, wait)

Installs or upgrades a helm release of a chart in to a cluster using helm binary.

To load the rule use:

load("//helm:defs.bzl", "helm_release")

This rule builds an executable. Use run instead of build to execute it.

helm_release(
  name = "install",
  remote_chart = "oci://docker.pkg.dev/helm-charts/test_helm_chart",
  version = "0.7.5",
  namespace = "myapp",
  release_name = "helm-release-name",
  values = ["additional_values.yaml"],
)

helm_release(
  name = "install",
  chart = ":chart",
  namespace = "myapp",
  release_name = "helm-release-name",
  values = glob(["charts/myapp/values.yaml"]),
)

Example of use providing a kubernetes context config:

helm_release(
    name = "chart_install",
    chart = ":chart",
    release_name = "release-name",
    values = glob(["charts/myapp/values.yaml"]),
    kubernetes_context = "mm-k8s-c<ontext",
)

Example of use decryptying sops secrets:


sops_decrypt(
  name = "secret",
  srcs = ["secrets.yaml"],
)

helm_release(
    name = "chart_install",
    chart = ":chart",
    release_name = "release-name",
    values = glob(["charts/myapp/values.yaml"]) + [":secret"],
)

Example of use with k8s_namespace annotated with a GCP SA:

k8s_namespace(
  name = "test-namespace",
  namespace_name = "test-namespace",
  kubernetes_sa = "test-kubernetes-sa",
  kubernetes_context = "mm-k8s-context",
)

helm_release(
    name = "chart_install",
    chart = ":chart",
    namespace_dep = ":test-namespace",
    release_name = "release-name",
    values = glob(["charts/myapp/values.yaml"]),
)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
chart The packaged chart archive to be published. It can be a reference to a helm_chart rule or a reference to a helm archived file. To specify a helm chart from a remote repository use remote_chart instead. Label optional None
create_namespace A flag to indicate helm binary to create the kubernetes namespace if it is not already present in the cluster. Boolean optional True
kubernetes_context Reference to a kubernetes context file used by helm binary. Label optional None
namespace The namespace literal where to install the helm release. Set to "" to use namespace from current kube context String optional ""
namespace_dep A reference to a k8s_namespace rule from where to extract the namespace to be used to install the release.Namespace where this release is installed to. Must be a label to a k8s_namespace rule. It takes precedence over namespace Label optional None
release_name The name of the helm release to be installed or upgraded. String required
remote_chart Helm registry url of the chart to be installed. If chart attribute is also providedd, remote_chart has preference. String optional ""
set A dictionary of key value pairs consisting on yaml paths and values to be replaced in the chart via --set helm option before installing it: "yaml.path": "value" Dictionary: String -> String optional {}
values A list of value files to be provided to helm install command through -f flag. List of labels optional []
values_yaml [Deprecated] Use values attr instead List of labels optional []
version Chart version to be installed in a kubernetes cluster. This option will only be used if the remote_chart attribute is used. String optional ""
wait Helm flag to wait for all resources to be created to exit. Boolean optional True