Skip to content

Commit

Permalink
docs: Add documentation for namespace transformer
Browse files Browse the repository at this point in the history
Add a short description of the namespace transformer and example
usage to examples/transformerconfigs/README.md.

Closes: kubernetes-sigs#629
Signed-off-by: Lars Kellogg-Stedman <lars@oddbit.com>
  • Loading branch information
larsks committed Dec 5, 2022
1 parent 71eb865 commit d051299
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions examples/transformerconfigs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,3 +606,63 @@ metadata:
foo.k8s.io/bar: baz
```
Kustomize supports escaping special characters in path, e.g `metadata/annotations/foo.k8s.io\/bar`

## Namespace

The namespace transformer is used to update namespace references in your manifests when set the `namespace` declaration in your `kustomization.yaml`.

### Example

kustomization.yaml

```
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: example

resources:
- resources.yaml

configurations:
- namespace.yaml
```
namespace.yaml
```
namespace:
- kind: AnimalPark
path: spec/gorillaRef/namespace
create: true
```
resources.yaml
```
apiVersion: animal/v1
kind: AnimalPark
metadata:
name: ap
spec:
gorillaRef:
name: gg
kind: Gorilla
apiVersion: animal/v1
```
Output of `kustomize build`:
```
apiVersion: animal/v1
kind: AnimalPark
metadata:
name: ap
namespace: example
spec:
gorillaRef:
apiVersion: animal/v1
kind: Gorilla
name: gg
namespace: example
```

0 comments on commit d051299

Please sign in to comment.