add usage examples

closes #1
This commit is contained in:
2026-05-07 23:42:27 +06:00
parent 08c5d717ac
commit fa9a058a61
9 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,17 @@
# Exec Plugin Example
This example runs `YqTransformer` as an **exec KRM function**.
## Locate the plugin executable
The `config.kubernetes.io/function` annotation in `yq-transformer.yaml`
points to the plugin's executable path in the `exec.path` key.
This path is relative to `kustomization.yaml` and can be anywhere on disk.
## Build with alpha plugins and exec enabled
```bash
kustomize build --enable-alpha-plugins --enable-exec .
```
You should see a label `environment: dev` added to one of the Deployments.

View File

@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../manifests
transformers:
- yq-transformer.yaml

View File

@ -0,0 +1,18 @@
apiVersion: kustomize.bdeshi.space/v1
kind: YqTransformer
metadata:
name: yq-transformer-dev-label # this can be anything
annotations:
config.kubernetes.io/function: |
exec:
path: ../../YqTransformer.sh
targets:
- apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
serviceAccountName: dev-app
expression: |
.metadata.labels.environment = "dev"
| .spec.template.metadata.labels.environment = "dev"