{"id":13452328,"url":"https://github.com/bazelbuild/rules_k8s","last_synced_at":"2025-03-23T19:34:06.634Z","repository":{"id":37405697,"uuid":"101780554","full_name":"bazelbuild/rules_k8s","owner":"bazelbuild","description":"This repository contains rules for interacting with Kubernetes configurations / clusters.","archived":true,"fork":false,"pushed_at":"2023-05-12T13:44:37.000Z","size":795,"stargazers_count":291,"open_issues_count":82,"forks_count":137,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-20T13:12:43.295Z","etag":null,"topics":["bazel","bazel-rules","docker","docker-image","k8s","kubernetes","kubernetes-deployment"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazelbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS"}},"created_at":"2017-08-29T16:05:44.000Z","updated_at":"2024-11-20T09:12:24.000Z","dependencies_parsed_at":"2024-01-16T03:57:27.203Z","dependency_job_id":null,"html_url":"https://github.com/bazelbuild/rules_k8s","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Frules_k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Frules_k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Frules_k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Frules_k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazelbuild","download_url":"https://codeload.github.com/bazelbuild/rules_k8s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245159302,"owners_count":20570359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","bazel-rules","docker","docker-image","k8s","kubernetes","kubernetes-deployment"],"created_at":"2024-07-31T07:01:20.763Z","updated_at":"2025-03-23T19:34:06.212Z","avatar_url":"https://github.com/bazelbuild.png","language":"Starlark","funding_links":[],"categories":["Starlark","Python"],"sub_categories":[],"readme":"# (ARCHIVED) Bazel Kubernetes Rules\n\n**This repository is no longer maintained.**\n\nProw | Bazel CI\n:---: | :---:\n[![Build status](https://prow.k8s.io/badge.svg?jobs=pull-rules-k8s-*)](https://prow.k8s.io/?repo=bazelbuild%2Frules_k8s) | [![Build status](https://badge.buildkite.com/4eafd3b619b9febae679bac4ce75b6b74643d48384e7f36eeb.svg)](https://buildkite.com/bazel/k8s-rules-k8s-postsubmit)\n\n## Rules\n\n* [k8s_defaults](#k8s_defaults)\n* [k8s_object](#k8s_object)\n* [k8s_objects](#k8s_objects)\n\n## Overview\n\nThis repository contains rules for interacting with Kubernetes\nconfigurations / clusters.\n\n## Setup\n\nAdd the following to your `WORKSPACE` file to add the necessary external dependencies:\n\n* Info for [rules_docker](https://github.com/bazelbuild/rules_docker/#setup)\n\n\n```python\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\n# https://github.com/bazelbuild/rules_docker/#setup\n# http_archive(\"io_bazel_rules_docker\", ...)\n\nhttp_archive(\n    name = \"io_bazel_rules_k8s\",\n    strip_prefix = \"rules_k8s-0.5\",\n    urls = [\"https://github.com/bazelbuild/rules_k8s/archive/v0.5.tar.gz\"],\n    sha256 = \"773aa45f2421a66c8aa651b8cecb8ea51db91799a405bd7b913d77052ac7261a\",\n)\n\nload(\"@io_bazel_rules_k8s//k8s:k8s.bzl\", \"k8s_repositories\")\n\nk8s_repositories()\n\nload(\"@io_bazel_rules_k8s//k8s:k8s_go_deps.bzl\", k8s_go_deps = \"deps\")\n\nk8s_go_deps()\n```\n\n## Kubernetes Authentication\n\nAs is somewhat standard for Bazel, the expectation is that the\n`kubectl` toolchain is preconfigured to authenticate with any clusters\nyou might interact with.\n\nFor more information on how to configure `kubectl` authentication, see the\nKubernetes [documentation](https://kubernetes.io/docs/admin/authentication/).\n\n*NOTE: we are currently experimenting with toolchain features in these rules\nso there will be changes upcoming to how this configuration is performed*\n\n### Container Engine Authentication\n\nFor Google Container Engine (GKE), the `gcloud` CLI provides a [simple\ncommand](https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials)\nfor setting up authentication:\n```shell\ngcloud container clusters get-credentials \u003cCLUSTER NAME\u003e\n```\n\n*NOTE: we are currently experimenting with toolchain features in these rules\nso there will be changes upcoming to how this configuration is performed*\n\n## Dependencies\n\n*New: Starting https://github.com/bazelbuild/rules_k8s/commit/ff2cbf09ae1f0a9c7ebdfc1fa337044158a7f57b*\n\nThese rules can either use a pre-installed `kubectl` tool (default) or\nbuild the `kubectl` tool from sources.\n\nThe `kubectl` tool is used when executing the `run` action from bazel.\n\nThe `kubectl` tool is configured via a toolchain rule. Read more about\nthe kubectl toolchain [here](toolchains/kubectl#kubectl-toolchain).\n\nIf GKE is used, also the `gcloud` sdk needs to be installed.\n\n*NOTE: we are currently experimenting with toolchain features in these rules\nso there will be changes upcoming to how this configuration is performed*\n\n## Examples\n\n### Basic \"deployment\" objects\n\n```python\nload(\"@io_bazel_rules_k8s//k8s:object.bzl\", \"k8s_object\")\n\nk8s_object(\n  name = \"dev\",\n  kind = \"deployment\",\n\n  # A template of a Kubernetes Deployment object yaml.\n  template = \":deployment.yaml\",\n\n  # An optional collection of docker_build images to publish\n  # when this target is bazel run.  The digest of the published\n  # image is substituted as a part of the resolution process.\n  images = {\n    \"gcr.io/rules_k8s/server:dev\": \"//server:image\"\n  },\n)\n```\n\n### Aliasing (e.g. `k8s_deploy`)\n\nIn your `WORKSPACE` you can set up aliases for a more readable short-hand:\n```python\nload(\"@io_bazel_rules_k8s//k8s:k8s.bzl\", \"k8s_defaults\")\n\nk8s_defaults(\n  # This becomes the name of the @repository and the rule\n  # you will import in your BUILD files.\n  name = \"k8s_deploy\",\n  kind = \"deployment\",\n  # This is the name of the cluster as it appears in:\n  #   kubectl config view --minify -o=jsonpath='{.contexts[0].context.cluster}'\n  cluster = \"my-gke-cluster\",\n)\n```\n\nThen in place of the above, you can use the following in your `BUILD` file:\n\n```python\nload(\"@k8s_deploy//:defaults.bzl\", \"k8s_deploy\")\n\nk8s_deploy(\n  name = \"dev\",\n  template = \":deployment.yaml\",\n  images = {\n    \"gcr.io/rules_k8s/server:dev\": \"//server:image\"\n  },\n)\n```\n\nNote that in `load(\"@k8s_deploy//:defaults.bzl\", \"k8s_deploy\")` both `k8s_deploy`'s are references to the `name` parameter passed to `k8s_defaults`. If you change `name = \"k8s_deploy\"` to something else, you will need to change the `load` statement in both places.\n\n### Multi-Object Actions\n\nIt is common practice in the Kubernetes world to have multiple objects that\ncomprise an application.  There are two main ways that we support interacting\nwith these kinds of objects.\n\nThe first is to simply use a template file that contains your N objects\ndelimited with `---`, and omitting `kind=\"...\"`.\n\nThe second is through the use of `k8s_objects`, which aggregates N `k8s_object`\nrules:\n```python\n# Note the plurality of \"objects\" here.\nload(\"@io_bazel_rules_k8s//k8s:objects.bzl\", \"k8s_objects\")\n\nk8s_objects(\n   name = \"deployments\",\n   objects = [\n      \":foo-deployment\",\n      \":bar-deployment\",\n      \":baz-deployment\",\n   ]\n)\n\nk8s_objects(\n   name = \"services\",\n   objects = [\n      \":foo-service\",\n      \":bar-service\",\n      \":baz-service\",\n   ]\n)\n\n# These rules can be nested\nk8s_objects(\n   name = \"everything\",\n   objects = [\n      \":deployments\",\n      \":services\",\n      \":configmaps\",\n      \":ingress\",\n   ]\n)\n```\n\nThis can be useful when you want to be able to stand up a full environment,\nwhich includes resources that are expensive to recreate (e.g. LoadBalancer),\nbut still want to be able to quickly iterate on parts of your application.\n\n\n### Developer Environments\n\nA common practice to avoid clobbering other users is to do your development\nagainst an isolated environment.  Two practices are fairly common-place.\n1. Individual development clusters\n1. Development \"namespaces\"\n\nTo support these scenarios, the rules support using \"stamping\" variables to\ncustomize these arguments to `k8s_defaults` or `k8s_object`.\n\nFor per-developer clusters, you might use:\n```python\nk8s_defaults(\n  name = \"k8s_dev_deploy\",\n  kind = \"deployment\",\n  cluster = \"gke_dev-proj_us-central5-z_{BUILD_USER}\",\n)\n```\n\nFor per-developer namespaces, you might use:\n```python\nk8s_defaults(\n  name = \"k8s_dev_deploy\",\n  kind = \"deployment\",\n  cluster = \"shared-cluster\",\n  namespace = \"{BUILD_USER}\",\n)\n```\n\nYou can customize the stamp variables that are available at a repository level\nby leveraging `--workspace_status_command`.  One pattern for this is to check in\nthe following:\n```shell\n$ cat .bazelrc\nbuild --workspace_status_command=\"bash ./print-workspace-status.sh\"\n\n$ cat print-workspace-status.sh\ncat \u003c\u003cEOF\nVAR1 value1\n# This can be overriden by users if they \"export VAR2_OVERRIDE\"\nVAR2 ${VAR2_OVERRIDE:-default-value2}\nEOF\n```\n\nFor more information on \"stamping\", you can see also the `rules_docker`\ndocumentation on stamping [here](\nhttps://github.com/bazelbuild/rules_docker#stamping).\n\n\n#### Don't tread on my tags\n\nAnother ugly problem remains, which is that image references are still\nshared across developers, and while our resolution to digests avoids races, we\nmay not want them trampling on the same tag, or on production tags if shared\ntemplates are being used.\n\nMoreover, developers may not have access to push to the images referenced in a\nparticular template, or the development cluster to which they are deploying may\nnot be able to pull them (e.g. clusters in different GCP projects).\n\nTo resolve this, we enable developers to \"chroot\" the image references,\npublishing them instead to that reference under another repository.\n\nConsider the following, where developers use GCP projects named\n`company-{BUILD_USER}`:\n```python\nk8s_defaults(\n  name = \"k8s_dev_deploy\",\n  kind = \"deployment\",\n  cluster = \"gke_company-{BUILD_USER}_us-central5-z_da-cluster\",\n  image_chroot = \"us.gcr.io/company-{BUILD_USER}/dev\",\n)\n```\nIn this example, the `k8s_dev_deploy` rules will target the developer's cluster\nin their project, and images will all be published under the `image_chroot`.\n\nFor example, if the BUILD file contains:\n```python\nk8s_deploy(\n  name = \"dev\",\n  template = \":deployment.yaml\",\n  images = {\n    \"gcr.io/rules_k8s/server:dev\": \"//server:image\"\n  },\n)\n```\n\nThen the references to `gcr.io/rules_k8s/server:dev` will be replaced with one\nto: `us.gcr.io/company-{BUILD_USER}/dev/gcr.io/rules_k8s/server@sha256:...`.\n\n\n### Custom resolvers\n\nSometimes, you need to replace additional runtime parameters in the YAML file.\nWhile you can use `expand_template` for parameters known to the build system,\nyou'll need a custom resolver if the parameter is determined at deploy time.\nA common example is Google Cloud Endpoints service versions, which are\ndetermined by the server.\n\nYou can pass a custom resolver executable as the `resolver` argument of all\nrules:\n\n```python\nsh_binary(\n  name = \"my_script\",\n  ...\n)\n\nk8s_deploy(\n  name = \"dev\"\n  template = \":deployment.yaml\",\n  images = {\n    \"gcr.io/rules_k8s/server:dev\": \"//server:image\"\n  },\n  resolver = \"//my_script\",\n)\n```\n\nThis script may need to invoke the default resolver (`//k8s/go/cmd/resolver`) with all\nits arguments. It may capture the default resolver's output and apply additional\nmodifications to the YAML, printing the final YAML to stdout.\n\n\n## Usage\n\nThe `k8s_object[s]` rules expose a collection of actions.  We will follow the `:dev`\ntarget from the example above.\n\n### Build\n\nBuild builds all of the constituent elements, and makes the template available\nas `{name}.yaml`.  If `template` is a generated input, it will be built.\nLikewise, any `docker_build` images referenced from the `images={}` attribute\nwill be built.\n\n```shell\nbazel build :dev\n```\n\n### Resolve\n\nDeploying with tags, especially in production, is a bad practice because they\nare mutable.  If a tag changes, it can lead to inconsistent versions of your app\nrunning after auto-scaling or auto-healing events.  Thankfully in v2 of the\nDocker Registry, digests were introduced.  Deploying by digest provides\ncryptographic guarantees of consistency across the replicas of a deployment.\n\nYou can \"resolve\" your resource `template` by running:\n\n```shell\nbazel run :dev\n```\n\nThe resolved `template` will be printed to `STDOUT`.\n\nThis command will publish any `images = {}` present in your rule, substituting\nthose exact digests into the yaml template, and for other images resolving the\ntags to digests by reaching out to the appropriate registry.  Any images that\ncannot be found or accessed are left unresolved.\n\n**This process only supports fully-qualified tag names.**  This means you must\nalways specify tag and registry domain names (no implicit `:latest`).\n\n\n### Create\n\nUsers can create an environment by running:\n```shell\nbazel run :dev.create\n```\n\nThis deploys the **resolved** template, which includes publishing images.\n\n### Update\n\nUsers can update (replace) their environment by running:\n```shell\nbazel run :dev.replace\n```\n\nLike `.create` this deploys the **resolved** template, which includes\nrepublishing images.  **This action is intended to be the workhorse\nof fast-iteration development** (rebuilding / republishing / redeploying).\n\n### Apply\n\nUsers can \"apply\" a configuration by running:\n```shell\nbazel run :dev.apply\n```\n\n`:dev.apply` maps to `kubectl apply`, which will create or replace an existing\nconfiguration.  For more information see the `kubectl` documentation.\n\nThis applies the **resolved** template, which includes republishing images.\n**This action is intended to be the workhorse of fast-iteration development**\n(rebuilding / republishing / redeploying).\n\n### Delete\n\nUsers can tear down their environment by running:\n```shell\nbazel run :dev.delete\n```\n\nIt is notable that despite deleting the deployment, this will NOT delete\nany services currently load balancing over the deployment; this is intentional\nas creating load balancers can be slow.\n\n### Describe (`k8s_object`-only)\n\nUsers can \"describe\" their environment by running:\n\n```shell\nbazel run :dev.describe\n```\n\n### Diff\n\nUsers can \"diff\" a configuration by running:\n```shell\nbazel run :dev.diff\n```\n\n`:dev.diff` maps to `kubectl diff`, which will diff the live against the would-be applied version.\nFor more information see the `kubectl` documentation.\n\nThis diffs the **resolved** template, but does not include republishing images.\n\n\u003ca name=\"k8s_object\"\u003e\u003c/a\u003e\n## k8s_object\n\n```python\nk8s_object(name, kind, template)\n```\n\nA rule for interacting with Kubernetes objects.\n\n\u003ctable class=\"table table-condensed table-bordered table-params\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"param-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth colspan=\"2\"\u003eAttributes\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eName, required\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eUnique name for this rule.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ekind\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eKind, required\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe kind of the Kubernetes object in the yaml.\u003c/p\u003e\n        \u003cp\u003e\u003cb\u003eIf this is omitted, the \u003ccode\u003eapply, create, replace, delete,\n          describe\u003c/code\u003e actions will not exist.\u003c/b\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ecluster\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe name of the cluster to which \u003ccode\u003ecreate, replace, delete,\n          describe\u003c/code\u003e should speak. Subject to \"Make\" variable substitution.\u003c/p\u003e\n        \u003cp\u003e\u003cb\u003eIf this is omitted, the \u003ccode\u003eapply, create, replace, delete,\n          describe\u003c/code\u003e actions will not exist.\u003c/b\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003econtext\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe name of a kubeconfig context to use. Subject to \"Make\" variable\n          substitution.\u003c/p\u003e\n        \u003cp\u003e\u003cb\u003eIf this is omitted, the current context will be used.\u003c/b\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003enamespace\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe namespace on the cluster within which the actions are\n          performed. Subject to \"Make\" variable substitution.\u003c/p\u003e\n        \u003cp\u003e\u003cb\u003eIf this is omitted, it will default to the value specified\n          in the template or if also unspecified there, to the value\n          \u003ccode\u003e\"default\"\u003c/code\u003e.\u003c/b\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe user to authenticate to the cluster as configured with kubectl.\n          Subject to \"Make\" variable substitution.\u003c/p\u003e\n        \u003cp\u003e\u003cb\u003eIf this is omitted, kubectl will authenticate as the user from the\n          current context.\u003c/b\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ekubeconfig\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003ekubeconfig file, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe kubeconfig file to pass to the `kubectl` tool via the\n          `--kubeconfig` option. Can be useful if the `kubeconfig` is generated\n          by another target.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003esubstitutions\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring_dict, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eSubstitutions to make when expanding the template.\u003c/p\u003e\n        \u003cp\u003eFollows the same rules as\n          \u003ca href=\"https://docs.bazel.build/versions/master/skylark/lib/actions.html#expand_template\"\u003eexpand_template\u003c/a\u003e\n          Values are \u003ca href=\"https://docs.bazel.build/versions/master/be/make-variables.html\"\u003e\"make variable substituted.\"\u003c/a\u003e\n          You can also use the Bazel command line option \u003ccode\u003e--define\u003c/code\u003e\n          to define your own custom variables.\n        \u003c/p\u003e\n        \u003cp\u003e\u003cpre\u003e\n  # Example\n  k8s_object(\n    name = \"my_ingress\",\n    kind = \"ingress\",\n\n    # A template of a Kubernetes ingress object yaml.\n    template = \":ingress.yaml\",\n\n    # An optional collection of docker_build images to publish\n    # when this target is bazel run.  The digest of the published\n    # image is substituted as a part of the resolution process.\n    substitutions = {\n      \"%{expand_template_variable}\": \"$(make_expanded_variable}\",\n    })\n  \u003c/pre\u003e\u003c/p\u003e\n        \u003cp\u003eWhich is then invoked with \u003ccode\u003ebazel run --define make_expanded_variable=value :target\u003c/code\u003e\n        and will replace any occurrences of the literal token \u003ccode\u003e%{expand_template_variable}\u003c/code\u003e in your\n        template with the value \"value\" by way of first make variable\n        substitution and then string replacement.\n        \u003c/p\u003e\n        \u003cp\u003eAny stamp variables are also replaced with their values. This is done\n        after make variable substitution.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eyaml or json file; required\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe yaml or json for a Kubernetes object.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eimages\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring to label dictionary\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eWhen this target is \u003ccode\u003ebazel run\u003c/code\u003e the images\n          referenced by label will be published to the tag key.\u003c/p\u003e\n       \u003cp\u003eThe published digests of these images will be substituted\n          directly, so as to avoid a race in the resolution process\u003c/p\u003e\n       \u003cp\u003eSubject to \"Make\" variable substitution\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eimage_chroot\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe repository under which to actually publish Docker images.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eresolver\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003etarget, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eA build target for the binary that's called to resolves references\n           inside the Kubernetes YAML files.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eargs\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring_list, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eAdditional arguments to pass to the kubectl command at execution.\u003c/p\u003e\n        \u003cp\u003eNOTE: You can also pass args via the cli by run something like:\n\t      \u003ccode\u003ebazel run some_target -- some_args\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eNOTE: Not all options are available for all kubectl commands. To view the list of global options run: \u003ccode\u003ekubectl options\u003c/code\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eresolver_args\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring_list, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eAdditional arguments to pass to the resolver directly.\u003c/p\u003e\n        \u003cp\u003eNOTE: This option is to pass the specific arguments to the resolver directly, such as \u003ccode\u003e--allow_unused_images\u003c/code\u003e.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003ca name=\"k8s_objects\"\u003e\u003c/a\u003e\n## k8s_objects\n\n```python\nk8s_objects(name, objects)\n```\n\nA rule for interacting with multiple Kubernetes objects.\n\n\u003ctable class=\"table table-condensed table-bordered table-params\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"param-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth colspan=\"2\"\u003eAttributes\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eName, required\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eUnique name for this rule.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eobjects\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eLabel list or dict; required\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe list of objects on which actions are taken.\u003c/p\u003e\n\t\u003cp\u003eWhen \u003ccode\u003ebazel run\u003c/code\u003e this target resolves each of the object\n\t   targets which includes publishing their associated images, and will\n\t   print a \u003ccode\u003e---\u003c/code\u003e delimited yaml.\u003c/p\u003e\n        \u003cp\u003e If a dict is provided it will be converted to a \u003ca href=\"https://docs.bazel.build/versions/master/be/functions.html\"\u003eselect\u003c/a\u003e statement.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003ca name=\"k8s_defaults\"\u003e\u003c/a\u003e\n## k8s_defaults\n\n```python\nk8s_defaults(name, kind)\n```\n\nA repository rule that allows users to alias `k8s_object` with default values.\n\n\u003ctable class=\"table table-condensed table-bordered table-params\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"param-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth colspan=\"2\"\u003eAttributes\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eName, required\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe name of the repository that this rule will create.\u003c/p\u003e\n        \u003cp\u003eAlso the name of rule imported from\n          \u003ccode\u003e@name//:defaults.bzl\u003c/code\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ekind\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003eKind, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe kind of objects the alias of \u003ccode\u003ek8s_object\u003c/code\u003e handles.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ecluster\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe name of the cluster to which \u003ccode\u003ecreate, replace, delete,\n           describe\u003c/code\u003e should speak.\u003c/p\u003e\n\t\u003cp\u003eThis should match the cluster name as it would appear in\n           \u003ccode\u003ekubectl config view --minify -o=jsonpath='{.contexts[0].context.cluster}'\u003c/code\u003e\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003econtext\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe name of a kubeconfig context to use.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003enamespace\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe namespace on the cluster within which the actions are\n           performed.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe user to authenticate to the cluster as configured with kubectl.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eimage_chroot\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003estring, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eThe repository under which to actually publish Docker images.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eresolver\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cp\u003e\u003ccode\u003etarget, optional\u003c/code\u003e\u003c/p\u003e\n        \u003cp\u003eA build target for the binary that's called to resolves references\n           inside the Kubernetes YAML files.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n## Testing\n\nTo test rules_k8s, you can run the provided e2e tests locally on Linux by\nfollowing these [instructions](examples/#running-rules_k8s-e2e-tests-locally).\n\n## Support\n\nUsers find on stackoverflow, slack and Google Group mailing list.\n\n### Stackoverflow\n\nStackoverflow is a great place for developers to help each other.\n\nSearch through [existing questions] to see if someone else has had the same issue as you.\n\nIf you have a new question, please [ask] the stackoverflow community. Include `rules_k8s` in the title and add `[bazel]` and `[kubernetes]` tags.\n\n### Google group mailing list\n\nThe general [bazel support] options links to the official [bazel-discuss] Google group mailing list.\n\n\n### Slack and IRC\n\nSlack and IRC are great places for developers to chat with each other.\n\nThere is a `#bazel` channel in the kubernetes slack. Visit the [kubernetes community] page to find the [slack.k8s.io] invitation link.\n\nThere is also a `#bazel` channel on [Freenode IRC], although we have found the slack channel more engaging.\n\n\n[Freenode IRC]: https://freenode.net/\n[bazel support]: https://bazel.build/support.html\n[bazel-discuss]: https://groups.google.com/forum/#!forum/bazel-discuss\n[existing questions]: https://stackoverflow.com/search?q=rules_k8s\n[kubernetes community]: https://kubernetes.io/community/\n[slack.k8s.io]: http://slack.k8s.io/\n\n## Adopters\nHere's a (non-exhaustive) list of companies that use `rules_k8s` in production. Don't see yours? [You can add it in a PR!](https://github.com/bazelbuild/rules_k8s/edit/master/README.md)\n  * [Etsy](https://www.etsy.com)\n  * [Jetstack](https://www.jetstack.io/)\n  * [Prow](https://github.com/kubernetes/test-infra/tree/master/prow)\n  * [Tink](https://tink.com/)\n  * [Cookies](https://cookies.co/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Frules_k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazelbuild%2Frules_k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Frules_k8s/lists"}