To connect container images built with rules_img to your k8s_deploy targets, use the k8s_push_info adapter. This ensures that image pushes and registry information are correctly associated with the deployment.
load("@rules_gitops//adapters:rules_img.bzl", "k8s_push_info")
load("@rules_gitops//gitops:defs.bzl", "k8s_deploy")
load("@rules_img//img:image.bzl", "image_manifest")
load("@rules_img//img:push.bzl", "image_push")
image_manifest(
name = "my_image",
# ... image configuration
)
image_push(
name = "push",
image = ":my_image",
registry = "my-registry.com",
repository = "my-org/my-image",
)
k8s_push_info(
name = "k8s_image",
image = ":my_image",
push = ":push",
registry = "my-registry.com",
repository = "my-org/my-image",
)
k8s_deploy(
name = "my_deployment",
cluster = "my-cluster",
images = [":k8s_image"],
manifests = ["deployment.yaml"],
namespace = "{BUILD_USER}",
)