Metadata-Version: 2.1
Name: pants_backend_k8s
Version: 0.6.1
Summary: A Kubernetes plugin for the Pants build system
Keywords: pantsbuild,pants,backend,kubernetes
Author-Email: Tom Solberg <me@sbg.dev>
License: MIT License
         
         Copyright (c) 2022 Tom Solberg
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
         
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Build Tools
Project-URL: Repository, https://github.com/tgolsson/pants-backends
Project-URL: Code, https://github.com/tgolsson/pants-backends/tree/main/pants-plugins/k8s
Project-URL: Changelog, https://github.com/tgolsson/pants-backends/tree/main/pants-plugins/k8s/CHANGELOG.md
Description-Content-Type: text/markdown

# Kubernetes backend for Pants

This release targets Pants **2.30.0**. Install it with
`pants-backend-k8s==0.6.1` in `[GLOBAL].plugins` in `pants.toml`.

![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`.
