# Kubernetes backend for Pants
![PyPI](https://img.shields.io/pypi/v/pants-backend-k8s?label=Latest%20release)
> **Warning**
> This plugin is in development. No stability is guaranteed! Contributions welcome.
This backends implements targets for working with Kubernetes clusters using raw YAML.
* [kubectl](https://github.com/kubernetes/kubectl) for cluster operations
## Targets
There's currently three targets for `pants-backend-k8s`:
* [`k8s_source`](#k8s_source)
* [`k8s_object`](#k8s_object)
* [`k8s_objects`](#k8s_objects)
### `k8s_source`
A file that can be passed into other k8s fields that are not source fields. For example, `k8s_object.template`.
``` python
k8s_source(
name="namespace.yaml",
source="namespace.yaml",
)
```
| Argument | Meaning | Default value |
| --- | --- | --- |
| `name` | The target name | Same as any other target, which is the directory name |
| `source` | The raw file | **Required** |
| `decsription` | A description of the target | |
| `tags` | List of tags | `[]` |
This'll eventually be automated like other rules once a suitable heuristic for generation with tailor is found. PRs welcome!
### `k8s_object`
Input for a kubernetes command, either generated via [`kustomize`](https://github.com/tgolsson/pants-backend-kustomize#kustomize) or via [`k8s_source`](#k8s_source).
``` python
k8s_object(
name="k8s",
description="the chat backend"
template=[":kustomize"],
namespace="chat-app",
cluster="prod",
)
```
| Argument | Meaning | Default value |
|---------------|-----------------------------|-------------------------------------------------------|
| `name` | The target name | Same as any other target, which is the directory name |
| `template` | The target to act on | **Required** |
| `namespace` | Namespace to target | Optional, will use default kubectl namespace |
| `cluster` | cluster to target | Optional, will use default kubectl cluster |
| `decsription` | A description of the target | |
| `tags` | List of tags | `[]` |
`k8s_object` is a generator for `kubernetes` target parametrized by the potential commands that are available: `apply`,
`create`, `get`, `describe`, `replace`, and `delete`.
### `k8s_objects`
A collection of kubernetes objects that should be managed together.
``` python
k8s_objects(
name="my-service",
description="all components of service-x"
objects=[":namespace", ":deployment"],
)
```
| Argument | Meaning | Default value |
|---------------|-------------------------------------------|-------------------------------------------------------|
| `name` | The target name | Same as any other target, which is the directory name |
| `objects` | k8s_object targets that should be managed | **Required** |
| `decsription` | A description of the target | |
| `tags` | List of tags | `[]` |
Like `k8s_object`, `k8s_objects` is a generator for parametrized targets for the commands that are available: `apply`,
`create`, `get`, `describe`, `replace`, and `delete`.
Raw data
{
"_id": null,
"home_page": null,
"name": "pants-backend-k8s",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "pantsbuild, pants, backend, kubernetes",
"author": null,
"author_email": "Tom Solberg <me@sbg.dev>",
"download_url": "https://files.pythonhosted.org/packages/53/b3/e12569340df77117bcde09ad713b1613ef66c23fe550e37eb1cae91224d1/pants-backend-k8s-0.4.0.tar.gz",
"platform": null,
"description": "# Kubernetes backend for Pants\n\n![PyPI](https://img.shields.io/pypi/v/pants-backend-k8s?label=Latest%20release)\n\n> **Warning**\n> This plugin is in development. No stability is guaranteed! Contributions welcome.\n\nThis backends implements targets for working with Kubernetes clusters using raw YAML.\n\n* [kubectl](https://github.com/kubernetes/kubectl) for cluster operations\n\n## Targets\n\nThere's currently three targets for `pants-backend-k8s`:\n\n* [`k8s_source`](#k8s_source)\n* [`k8s_object`](#k8s_object)\n* [`k8s_objects`](#k8s_objects)\n\n### `k8s_source`\n\nA file that can be passed into other k8s fields that are not source fields. For example, `k8s_object.template`.\n\n``` python\nk8s_source(\n name=\"namespace.yaml\",\n source=\"namespace.yaml\",\n)\n```\n\n\n| Argument | Meaning | Default value |\n| --- | --- | --- |\n| `name` | The target name | Same as any other target, which is the directory name |\n| `source` | The raw file | **Required** |\n| `decsription` | A description of the target | |\n| `tags` | List of tags | `[]` |\n\n\nThis'll eventually be automated like other rules once a suitable heuristic for generation with tailor is found. PRs welcome!\n\n\n### `k8s_object`\n\nInput for a kubernetes command, either generated via [`kustomize`](https://github.com/tgolsson/pants-backend-kustomize#kustomize) or via [`k8s_source`](#k8s_source).\n\n``` python\nk8s_object(\n name=\"k8s\",\n description=\"the chat backend\"\n template=[\":kustomize\"],\n namespace=\"chat-app\",\n cluster=\"prod\",\n)\n```\n\n\n| Argument | Meaning | Default value |\n|---------------|-----------------------------|-------------------------------------------------------|\n| `name` | The target name | Same as any other target, which is the directory name |\n| `template` | The target to act on | **Required** |\n| `namespace` | Namespace to target | Optional, will use default kubectl namespace |\n| `cluster` | cluster to target | Optional, will use default kubectl cluster |\n| `decsription` | A description of the target | |\n| `tags` | List of tags | `[]` |\n\n`k8s_object` is a generator for `kubernetes` target parametrized by the potential commands that are available: `apply`,\n`create`, `get`, `describe`, `replace`, and `delete`.\n\n### `k8s_objects`\n\nA collection of kubernetes objects that should be managed together.\n\n``` python\nk8s_objects(\n name=\"my-service\",\n description=\"all components of service-x\"\n objects=[\":namespace\", \":deployment\"],\n)\n```\n\n\n| Argument | Meaning | Default value |\n|---------------|-------------------------------------------|-------------------------------------------------------|\n| `name` | The target name | Same as any other target, which is the directory name |\n| `objects` | k8s_object targets that should be managed | **Required** |\n| `decsription` | A description of the target | |\n| `tags` | List of tags | `[]` |\n\nLike `k8s_object`, `k8s_objects` is a generator for parametrized targets for the commands that are available: `apply`,\n`create`, `get`, `describe`, `replace`, and `delete`.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Kubernetes plugin for the Pants build system",
"version": "0.4.0",
"project_urls": {
"Changelog": "https://github.com/tgolsson/pants-backends/tree/main/pants-plugins/k8s/CHANGELOG.md",
"Code": "https://github.com/tgolsson/pants-backends/tree/main/pants-plugins/k8s",
"Repository": "https://github.com/tgolsson/pants-backends"
},
"split_keywords": [
"pantsbuild",
" pants",
" backend",
" kubernetes"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cb411380e11ac963e451cd7a2ef55b6e074ff7b18b52dd065715ef602e886232",
"md5": "6d5d07ef57e21c4ba059da425b769544",
"sha256": "48c42eb9ac9329730feb262166e1ed3e3fe09bc78759215931d56c62a07707e5"
},
"downloads": -1,
"filename": "pants_backend_k8s-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6d5d07ef57e21c4ba059da425b769544",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 11313,
"upload_time": "2024-09-19T12:07:19",
"upload_time_iso_8601": "2024-09-19T12:07:19.635680Z",
"url": "https://files.pythonhosted.org/packages/cb/41/1380e11ac963e451cd7a2ef55b6e074ff7b18b52dd065715ef602e886232/pants_backend_k8s-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "53b3e12569340df77117bcde09ad713b1613ef66c23fe550e37eb1cae91224d1",
"md5": "649ea4a5d59b8d8ee1f37ab0e9809c7c",
"sha256": "65eeb5c4462f8736fedaae7bbab051550e7e9b8542076f515220dafb19f78cd6"
},
"downloads": -1,
"filename": "pants-backend-k8s-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "649ea4a5d59b8d8ee1f37ab0e9809c7c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9490,
"upload_time": "2024-09-19T12:07:20",
"upload_time_iso_8601": "2024-09-19T12:07:20.672480Z",
"url": "https://files.pythonhosted.org/packages/53/b3/e12569340df77117bcde09ad713b1613ef66c23fe550e37eb1cae91224d1/pants-backend-k8s-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-19 12:07:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tgolsson",
"github_project": "pants-backends",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pants-backend-k8s"
}