"""imports linkerd manifests""" load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory") load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file") load("@rules_oci//oci:defs.bzl", "oci_image") load("//hack/build/rules/container:index.bzl", "container_push") load("//hack/tools/fetch-digests:fetch-digests.bzl", "fetch_digests") load("//hack/tools/helm:helm.bzl", "helm_template") load(":version.bzl", "IMAGES", "PROXY_INIT_IMAGES", "PROXY_INIT_VERSION", "REGISTRY", "REPO", "VERSION") package(default_visibility = ["//visibility:public"]) # fetches digests for linkerd and prints to stdout fetch_digests( name = "print-linkerd-digests", images = IMAGES, registry = REGISTRY, repo = REPO, tag = VERSION, ) fetch_digests( name = "print-proxy-init-digests", images = PROXY_INIT_IMAGES, registry = REGISTRY, repo = REPO, tag = PROXY_INIT_VERSION, ) # copies and writes the helm chart to helm/linkerd/charts copy_to_directory( name = "cp_linkerd_manifests", srcs = ["@linkerd_manifests//:file"], out = "linkerd-helm-chart", allow_overwrites = True, exclude_srcs_patterns = [ "charts/*.yml", "charts/linkerd2-cni/**/*", ], include_external_repositories = ["**"], include_srcs_patterns = ["charts/**/*"], replace_prefixes = { "charts/": "", }, ) write_source_file( name = "write_linkerd_manifests", check_that_out_file_exists = False, # cant check a subpackage https://github.com/aspect-build/bazel-lib/blob/7a8f00cd7fc81024e26bf41cea4132ac9e080739/lib/tests/write_source_files/BUILD.bazel#L211 in_file = ":cp_linkerd_manifests", out_file = "//third_party/k8s/linkerd/helm/linkerd:charts", ) # The proxy image must be built and overwritten with the env var LINKERD2_PROXY_IDENTITY_MAX_REFRESH for lan outage requirement oci_image( name = "linkerd_proxy", base = "@linkerd_proxy", env = { "LINKERD2_PROXY_IDENTITY_MAX_REFRESH": "6h", }, tags = ["manual"], ) # bazel run third_party/k8s/linkerd/linkerd-proxy:container_push container_push( name = "container_push", image = ":linkerd_proxy", # image_name = "{0}/{1}/proxy-ha".format(REGISTRY, REPO), image_name = "ghcr.io/linkerd/proxy-ha", repository_file = "//hack/build/rules/container:thirdparty-repo", tag = VERSION, ) helm_template( name = "template_linkerd_crd_manifests", chart = "@linkerd_helm_chart//:crd_file", namespace = "linkerd", release_name = "linkerd", values_yaml = "@linkerd_helm_chart//:crd_chart_values", ) write_source_file( name = "write_rendered_crd_manifests", check_that_out_file_exists = False, # cant check a subpackage https://github.com/aspect-build/bazel-lib/blob/7a8f00cd7fc81024e26bf41cea4132ac9e080739/lib/tests/write_source_files/BUILD.bazel#L211 diff_test = False, in_file = ":template_linkerd_crd_manifests", out_file = "//config/pallets/linkerdctl/linkerd-crds:linkerd-crds.yaml", )