Bazel rules for Kubernetes tooling.

Rules for the tools that sit next to Helm when operating a cluster. Today this is kubectl, fetched hermetically so helm_install / helm_upgrade failures can be debugged with bazel run @kubectl//:kubectl -- ... without a locally installed copy.

Rules

kubectl_toolchain

load("@rules_helm//k8s:defs.bzl", "kubectl_toolchain")

kubectl_toolchain(name, kubectl)

A kubectl toolchain.

Exposes the binary as KUBECTL_BIN to rules that consume @rules_helm//k8s:current_kubectl_toolchain via toolchains, e.g.

genrule(
    name = "pods",
    outs = ["pods.txt"],
    cmd = "$(KUBECTL_BIN) version --client > $@",
    toolchains = ["@rules_helm//k8s:current_kubectl_toolchain"],
)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
kubectlA kubectl binaryLabelrequired