@rules_gitops//adapters:external_image.bzl
Implementation of external image information provider suitable for injection into manifests
Rules
external_image| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*image | string | The image location, e.g. gcr.io/foo/bar:baz |
image_name | string | Image name, e.g. exernalserver. DEPRECATED: Use full target label instead, e.g. //images:externalserver Default: "" |
*digest | string | The image digest, e.g. sha256:deadbeef |
@rules_gitops//adapters:providers.bzl
Provider definitions for container image adapters.
Providers
K8sPushInfoInformation required to inject image into a manifest and optionally push it
Fields
image_label | bazel target label of the image |
legacy_image_name | Optional: short name |
registry | registry where the image resides |
repository | repository where the image resides |
digestfile | a file containing the digest of the image |
pusher | Optional: an executable target used to push the image to a remote registry |
run_environment | Optional: a run environment info provider used for pushing the image |
@rules_gitops//adapters:rules_img.bzl
@rules_gitops//e2e/util:util.bzl
Utility macros for e2e testing with kind clusters.
Functions & Macros
e2e_testDeclares an e2e test interacting with a kind cluster
Parameters
*name | name of the test target |
*steps | a list of labels producing binaries to run |
kwargs | additional options to pass to the underlying test rule |
kubectl_cmdParameters
*name | |
*args |
@rules_gitops//gitops:defs.bzl
GitOps rules public interface
Functions & Macros
k8s_deployGenerates Kubernetes deployment targets with optional GitOps support.
This macro creates kustomization targets and kubectl binaries for deploying
Kubernetes manifests. When gitops is enabled, it also creates a gitops target
for managing deployments through a GitOps workflow.
Parameters
*name | Name of the rule. Important for gitops since it becomes part of |
cluster | Target Kubernetes cluster name. Defaults to "dev". Default: "dev" |
user | Kubernetes user for authentication. Defaults to "{BUILD_USER}" Default: "{BUILD_USER}" |
namespace | Target Kubernetes namespace. Required when gitops=True. Default: None |
configmaps_srcs | List of source files for generating ConfigMaps. Default: None |
secrets_srcs | List of source files for generating Secrets. Default: None |
configmaps_renaming | ConfigMap renaming policy. Can be None (no renaming) Default: None |
manifests | List of Kubernetes manifest files. Defaults to all .yaml and Default: None |
name_prefix | Prefix to add to all resource names via kustomize. Default: None |
name_suffix | Suffix to add to all resource names via kustomize. Default: None |
prefix_suffix_app_labels | If True, applies kustomize configuration to Default: False |
patches | List of kustomize patches to apply to the manifests. Default: None |
image_name_patches | Dict mapping original image names to new image names. Default: {} |
image_tag_patches | Dict mapping image names to new tags. Default: {} |
substitutions | Dict of template parameter substitutions. CLUSTER and Default: {} |
configurations | List of additional kustomize configuration files. Default: [] |
common_labels | Dict of labels to apply to all Kubernetes objects. Default: {} |
common_annotations | Dict of annotations to apply to all Kubernetes Default: {} |
deps | List of dependency targets. Default: [] |
deps_aliases | Dict mapping aliases to dependency targets. Default: {} |
images | List of container image targets to include in the deployment. Default: [] |
objects | List of additional Kubernetes objects to include. Default: [] |
gitops | If True, creates a gitops target for GitOps workflow. Set to Default: True |
gitops_path | Directory path for gitops manifests. Defaults to "cloud". Default: "cloud" |
deployment_branch | Git branch for deployments. If None, uses default. Default: None |
release_branch_prefix | Prefix for release branches. Defaults to "main". Default: "main" |
start_tag | Opening delimiter for template substitutions. Defaults to "{{". Default: "{{" |
end_tag | Closing delimiter for template substitutions. Defaults to "}}". Default: "}}" |
tags | List of tags to apply to all generated targets. Default: [] |
visibility | Visibility specification for generated targets. Default: None |
verify_images | Whether or not to fail if a Bazel image could not be resolved. Default: True |
Rules
gitops| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
srcs | list of labels | Default: [] |
*cluster | string | |
*namespace | string | |
deployment_branch | string | Default: "" |
gitops_path | string | Default: "" |
release_branch_prefix | string | Default: "" |
strip_prefixes | list of strings | Default: [] |
@rules_gitops//kubectl:defs.bzl
Public API for kubectl rules.
Rules
kubectl_binary| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
srcs | list of labels | Default: [] |
*cluster | string | |
*namespace | string | |
command | string | Default: "apply" |
user | string | Default: "{BUILD_USER}" |
push | boolean | Default: True |
kubectl_toolchainresolved_toolchainExposes a concrete toolchain which is the result of Bazel resolving the
toolchain for the execution or target platform.
Workaround for https://github.com/bazelbuild/bazel/issues/14009
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
Module Extensions
kubectlTag Classes
toolchain| Attribute | Type | Description |
|---|---|---|
version | string | kubectl binary version Default: "" |
@rules_gitops//kustomize:defs.bzl
Public API for kustomize rules.
Rules
kustomization| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
configmaps_srcs | list of labels | Default: [] |
secrets_srcs | list of labels | Default: [] |
deps_aliases | dictionary: String → String | Default: {} |
disable_name_suffix_hash | boolean | Default: True |
end_tag | string | Default: "}}" |
images | list of labels | a list of image pushes used in manifests Default: [] |
manifests | list of labels | Default: [] |
name_prefix | string | Default: "" |
name_suffix | string | Default: "" |
namespace | string | Default: "" |
objects | list of labels | a list of dependent kustomize objects Default: [] |
patches | list of labels | Default: [] |
image_name_patches | dictionary: String → String | set new names for selected images Default: {} |
image_tag_patches | dictionary: String → String | set new tags for selected images Default: {} |
start_tag | string | Default: "{{" |
substitutions | dictionary: String → String | Default: {} |
deps | list of labels | Default: [] |
configurations | list of labels | Default: [] |
common_labels | dictionary: String → String | Default: {} |
common_annotations | dictionary: String → String | Default: {} |
verify_images | boolean | check whether all images which point to bazel labels were resolved Default: True |
kustomize_binary| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
kustomize_toolchainModule Extensions
kustomizeTag Classes
toolchain| Attribute | Type | Description |
|---|---|---|
version | string | kustomize binary version Default: "" |
Providers
KustomizeInfoInformation about a kustomization target
Fields
image_pushes | depset of image push executables for images referenced by this kustomization |
@rules_gitops//stamper:stamp.bzl
Stamping utilities for replacing placeholders in strings.
Functions & Macros
stampStamp provided string replacing placeholders like {BUILD_USER}.
Uses an optimization shortcut for BUILD_USER
Parameters
*ctx | The rule context. |
*string | The string containing placeholders to stamp. |
*_tmpfiles | Unused, kept for API compatibility. |
*tmpfilename | Base name for temporary files. |
@rules_gitops//testing:defs.bzl
Public API for Kubernetes testing rules.
Rules
k8s_test_namespacek8s_test_setup| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
kubeconfig | label | Default: "@@[unknown repo 'k8s_test' requested from @@]//:kubeconfig" |
kubectl | label | Default: "@@[unknown repo 'k8s_test' requested from @@]//:kubectl" |
objects | list of labels | Default: [] |
portforward_services | list of strings | Default: [] |
setup_timeout | string | Default: "10m" |
wait_for_apps | list of strings | Default: [] |
cluster | label | Default: "@@[unknown repo 'k8s_test' requested from @@]//:cluster" |
@rules_gitops//tools:util.bzl
Utility functions for golden testing.
Functions & Macros
golden_testParameters
*name | |
*in_file | |
extension | Default: "" |