set-namespace: Simple Example #
Overview #
This example demonstrates how to run
set-namespace
function
to replace the namespace
resource type in a variety of KRM resources.
Fetch the example package #
Get the example package by running the following commands:
$ kpt pkg get https://github.com/kptdev/krm-functions-catalog.git/examples/set-namespace-simple
We use the following Kptfile
to configure the function.
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
pipeline:
mutators:
- image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest
configMap:
namespace: example-ns
The function configuration is provided using a ConfigMap
. We set only one
key-value pair:
namespace: example-ns
: The desired namespace.
Function invocation #
Invoke the function by running the following commands:
$ kpt fn render set-namespace-simple
Expected result #
Check all resources have metadata.namespace
set to example-ns