Skip to content

Latest commit

 

History

History
95 lines (59 loc) · 4.02 KB

defs.md

File metadata and controls

95 lines (59 loc) · 4.02 KB

apply

apply(name, src, cfg, namespace, tags)

Performs a dry-run apply via kubectl against a resource file.

This is intended to be combined with the output of a kustomization rule though src can reference any file accepted by kubectl apply. This macro defines two additional rules:

  • <name>.run actually performs the apply.
  • <name>.diff outputs the diff against the existing configuration.

See:

PARAMETERS

Name Description Default Value
name A unique name for this rule. none
src A label. none
cfg A label referencing a kubeconfig file pointing to desired target cluster. none
namespace Optionally restrict operations to a specific namespace in the cluster defined by cfg. None
tags Sets tags on the rule. The requires-network tag must be among the tags. None

kubeconfig

kubeconfig()

Macro for genrule target named "kubeconfig" intended to uniquely identify a Kubernetes cluster.

This macro creates two rules: "kubeconfig" and "kubectl". The latter is a convenience run rule that invokes kubectl with the sibling configuration.

These rules are meant to be set in the cfg parameter of the apply rule documented below.

PARAMETERS

kustomization

kustomization(name, srcs, out, golden, visibility, autofix, plugin_dir, tags)

Builds a kustomization defined by the input srcs.

The output is a YAML multi-doc comprised of all the resources defined by the customization. This macro will create additional rules with the following suffixes:

  • <name>.autofix is a run target generated if golden is set. It synchronizes the output of
  • <name>.golden is a test target generated if golden is set.

See:

PARAMETERS

Name Description Default Value
name A unique name for this rule. none
srcs Source inputs to run kustomize build against. These are any valid Bazel labels representing.

Note that the Bazel glob() function can be used to specify which source files to include and which to exclude, e.g. glob(["*.yaml"], exclude=["golden.yaml"]).
none
out The name of the output file. none
golden Identify a file containing the expected output of the build. Defining this parameter creates a test rule named .golden that verifies the output is identical to the contents of the named file. Golden files are a materialized view of resources and can be useful if your kustomizations have many transitive dependencies. None
visibility The visibility of this rule. None
autofix Toggle creation of a .autofix rule if golden is also set. True
plugin_dir TODO None
tags Sets tags on the rule. The block-network tag is strongly recommended (but not enforced) to ensure hermeticity and reproducibility. ["block-network"]