mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 01:46:23 +00:00
rename run-fns to run
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
generated Resources -- e.g. 1. the function generates a Deployment, but doesn't
|
||||
specify `cpu`, 2. the user sets the `cpu` on the generated Resource, 3. the
|
||||
function should keep the `cpu` when regenerating the Resource a second time.
|
||||
- Functions **SHOULD** be usable outside `kustomize config run-fns` -- e.g. though pipeline
|
||||
- Functions **SHOULD** be usable outside `kustomize config run` -- e.g. though pipeline
|
||||
mechanisms such as Tekton.
|
||||
|
||||
#### Input Format
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
#### Container Environment
|
||||
|
||||
When run by `kustomize config run-fns`, functions are run in containers with the
|
||||
When run by `kustomize config run`, functions are run in containers with the
|
||||
following environment:
|
||||
|
||||
- Network: `none`
|
||||
@@ -138,7 +138,7 @@
|
||||
`nginx-template.sh` is a simple bash script which uses a *heredoc* as a templating solution
|
||||
for generating Resources from the functionConfig input fields.
|
||||
|
||||
The script wraps itself using `config run-fns wrap -- $0` which will:
|
||||
The script wraps itself using `config run wrap -- $0` which will:
|
||||
|
||||
1. Parse the `ResourceList.functionConfig` (provided to the container stdin) into env vars
|
||||
2. Merge the stdout into the original list of Resources
|
||||
@@ -147,11 +147,11 @@
|
||||
4. Format the output
|
||||
|
||||
#!/bin/bash
|
||||
# script must run wrapped by `kustomize config run-fns wrap`
|
||||
# script must run wrapped by `kustomize config run wrap`
|
||||
# for parsing input the functionConfig into env vars
|
||||
if [ -z ${WRAPPED} ]; then
|
||||
export WRAPPED=true
|
||||
config run-fns wrap -- $0
|
||||
config run wrap -- $0
|
||||
exit $?
|
||||
fi
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
|
||||
### Example Function Usage
|
||||
|
||||
Following is an example of running the `kustomize config run-fns` using the preceding API.
|
||||
Following is an example of running the `kustomize config run` using the preceding API.
|
||||
|
||||
#### `nginx.yaml` (Input)
|
||||
|
||||
@@ -233,7 +233,7 @@ Following is an example of running the `kustomize config run-fns` using the prec
|
||||
- `annotations[config.kubernetes.io/local-config]`: mark this as not a Resource that should
|
||||
be applied
|
||||
|
||||
#### `kustomize config run-fns dir/` (Output)
|
||||
#### `kustomize config run dir/` (Output)
|
||||
|
||||
`dir/my-instance_deployment.yaml` contains the Deployment:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## run-fns
|
||||
## run
|
||||
|
||||
[Alpha] Reoncile config functions to Resources.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
[Alpha] Reconcile config functions to Resources.
|
||||
|
||||
run-fns sequentially invokes all config functions in the directly, providing Resources
|
||||
run sequentially invokes all config functions in the directly, providing Resources
|
||||
in the directory as input to the first function, and writing the output of the last
|
||||
function back to the directory.
|
||||
|
||||
@@ -23,7 +23,7 @@ order they appear in the file).
|
||||
#### Config Functions:
|
||||
|
||||
Config functions are specified as Kubernetes types containing a metadata.configFn.container.image
|
||||
field. This fields tells run-fns how to invoke the container.
|
||||
field. This fields tells run how to invoke the container.
|
||||
|
||||
Example config function:
|
||||
|
||||
@@ -40,7 +40,7 @@ order they appear in the file).
|
||||
spec:
|
||||
configField: configValue
|
||||
|
||||
In the preceding example, 'kustomize config run-fns example/' would identify the function by
|
||||
In the preceding example, 'kustomize config run example/' would identify the function by
|
||||
the metadata.configFn field. It would then write all Resources in the directory to
|
||||
a container stdin (running the gcr.io/example/examplefunction:v1.0.1 image). It
|
||||
would then writer the container stdout back to example/, replacing the directory
|
||||
@@ -50,4 +50,4 @@ order they appear in the file).
|
||||
|
||||
### Examples
|
||||
|
||||
kustomize config run-fns example/
|
||||
kustomize config run example/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
### Synopsis
|
||||
|
||||
`kustomize config` enables encapsulating function for manipulating Resource
|
||||
configuration inside containers, which are run using `run-fns`.
|
||||
configuration inside containers, which are run using `run`.
|
||||
|
||||
First fetch the kustomize repository, which contains a collection of example
|
||||
functions
|
||||
@@ -20,7 +20,7 @@
|
||||
#### 1: Generate the Resources
|
||||
|
||||
`cd` into the `kustomize/functions/examples/template-heredoc-cockroachdb/`
|
||||
directory, and invoke `run-fns` on the `local-resource/` directory.
|
||||
directory, and invoke `run` on the `local-resource/` directory.
|
||||
|
||||
cd template-heredoc-cockroachdb/
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
kustomize config tree local-resource/ --name --image --replicas
|
||||
|
||||
# run the function
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
# view the generated Resources
|
||||
kustomize config tree local-resource/ --name --image --replicas
|
||||
|
||||
`run-fns` generated the directory ` local-resource/config` containing the generated
|
||||
`run` generated the directory ` local-resource/config` containing the generated
|
||||
Resources.
|
||||
|
||||
#### 2. Modify the Generated Resources
|
||||
@@ -41,14 +41,14 @@
|
||||
- modify the generated Resources by adding an annotation, sidecar container, etc.
|
||||
- modify the `local-resources/example-use.yaml` by changing the replicas
|
||||
|
||||
re-run `run-fns`. this will apply the updated replicas to the generated Resources,
|
||||
re-run `run`. this will apply the updated replicas to the generated Resources,
|
||||
but keep the fields that you manually added to the generated Resource configuration.
|
||||
|
||||
|
||||
# run the function
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
`run-fns` facilitates a non-destructive *smart templating* approach that allows templating
|
||||
`run` facilitates a non-destructive *smart templating* approach that allows templating
|
||||
to be composed with manual modifications directly to the template output, as well as
|
||||
composition with other functions which may appy validation or injection of values.
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#### 1: Generate the Resources
|
||||
|
||||
`cd` into the `kustomize/functions/examples/template-go-nginx/`
|
||||
directory, and invoke `run-fns` on the `local-resource/` directory.
|
||||
directory, and invoke `run` on the `local-resource/` directory.
|
||||
|
||||
cd template-go-nginx/
|
||||
|
||||
@@ -74,12 +74,12 @@
|
||||
kustomize config tree local-resource/ --name --image --replicas
|
||||
|
||||
# run the function
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
# view the generated Resources
|
||||
kustomize config tree local-resource/ --name --image --replicas
|
||||
|
||||
`run-fns` generated the directory ` local-resource/config` containing the generated
|
||||
`run` generated the directory ` local-resource/config` containing the generated
|
||||
Resources. this time it put the configuration in a single file rather than multiple
|
||||
files. The mapping of Resources to files is controlled by the function itself through
|
||||
annotations on the generated Resources.
|
||||
@@ -89,11 +89,11 @@
|
||||
- modify the generated Resources by adding an annotation, sidecar container, etc.
|
||||
- modify the `local-resources/example-use.yaml` by changing the replicas
|
||||
|
||||
re-run `run-fns`. this will apply the updated replicas to the generated Resources,
|
||||
re-run `run`. this will apply the updated replicas to the generated Resources,
|
||||
but keep the fields that you manually added to the generated Resource configuration.
|
||||
|
||||
# run the function
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
Just like in the preceding section, the function is implemented using a non-destructive
|
||||
approach which merges the generated Resources into previously generated instances.
|
||||
@@ -105,15 +105,15 @@
|
||||
|
||||
### Validation -- resource reservations
|
||||
|
||||
This section uses `run-fns` to perform validation rather than generate Resources.
|
||||
This section uses `run` to perform validation rather than generate Resources.
|
||||
|
||||
#### 1: Run the Validator
|
||||
|
||||
`cd` into the `kustomize/functions/examples/validator-resource-requests`
|
||||
directory, and invoke `run-fns` on the `local-resource/` directory.
|
||||
directory, and invoke `run` on the `local-resource/` directory.
|
||||
|
||||
# run the function
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
cpu-requests missing for a container in Deployment nginx (example-use.yaml [1])
|
||||
Error: exit status 1
|
||||
Usage:
|
||||
@@ -125,19 +125,19 @@
|
||||
and print the name of the file + Resource index. Edit the file and uncomment the resources,
|
||||
then re-run the functions.
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
The validation now passes.
|
||||
|
||||
### Injection -- resource reservations
|
||||
|
||||
This section uses `run-fns` to perform injection of field values based off annotations
|
||||
This section uses `run` to perform injection of field values based off annotations
|
||||
on the Resource.
|
||||
|
||||
#### 1: Run the Injector
|
||||
|
||||
`cd` into the `kustomize/functions/examples/inject-tshirt-sizes`
|
||||
directory, and invoke `run-fns` on the `local-resource/` directory.
|
||||
directory, and invoke `run` on the `local-resource/` directory.
|
||||
|
||||
# print the resources
|
||||
kustomize config tree local-resource --resources --name
|
||||
@@ -149,7 +149,7 @@
|
||||
└── name: nginx
|
||||
|
||||
# run the functions
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
# print the new resources
|
||||
kustomize config tree local-resource --resources --name
|
||||
@@ -164,7 +164,7 @@
|
||||
|
||||
Change the `tshirt-size` annotation from `medium` to `small` and re-run the functions.
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
kustomize config tree local-resource/
|
||||
local-resource
|
||||
├── [example-use.yaml] Validator
|
||||
@@ -180,5 +180,5 @@
|
||||
|
||||
Functions may be composed together. Try putting the Injection (tshirt-size) and
|
||||
Validation functions together in the same .yaml file (separated by `---`). Run
|
||||
`run-fns` and observe that the first function in the file is applied to the Resources,
|
||||
`run` and observe that the first function in the file is applied to the Resources,
|
||||
and then the second function in the file is applied.
|
||||
Reference in New Issue
Block a user