Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for setting Kubernetes labels and annotations #3687

Merged
merged 8 commits into from
May 13, 2024
29 changes: 29 additions & 0 deletions docs/docs/30-administration/22-backends/40-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,23 @@ backend_options:
AppArmor syntax follows [KEP-24](https://github.com/kubernetes/enhancements/blob/fddcbb9cbf3df39ded03bad71228265ac6e5215f/keps/sig-node/24-apparmor/README.md).
:::

### Annotations and labels

You can specify arbitrary `meta.annotations` and `meta.labels` to be set on the Pod definition for a given workflow step using the following configuration:
dominic-p marked this conversation as resolved.
Show resolved Hide resolved

```yaml
backend_options:
kubernetes:
annotations:
workflow-group: alpha
io.kubernetes.cri-o.Devices: /dev/fuse
labels:
environment: ci
app.kubernetes.io/name: builder
```

In order to enable this configuration, you need to add the appropriate environment variables to the agent config as shown below.
dominic-p marked this conversation as resolved.
Show resolved Hide resolved

## Tips and tricks

### CRI-O
Expand Down Expand Up @@ -260,3 +277,15 @@ Determines if containers must be required to run as non-root users.
> Default: empty

Secret names to pull images from private repositories. See, how to [Pull an Image from a Private Registry](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/).

### `WOODPECKER_BACKEND_K8S_POD_LABELS_ALLOW_FROM_STEP`
dominic-p marked this conversation as resolved.
Show resolved Hide resolved

> Default: `false`

Determines if additional Pod labels can be defined from a step's backend options.

### `WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS_ALLOW_FROM_STEP`
dominic-p marked this conversation as resolved.
Show resolved Hide resolved

> Default: `false`

Determines if Pod annotations can be defined from a step's backend options.