mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
rename run-fns to run
This commit is contained in:
@@ -17,7 +17,7 @@ Resource configuration, and looks for invalid configuration.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.configFn` and running:
|
||||
|
||||
kustomize config run-fns local-resources/
|
||||
kustomize config run local-resources/
|
||||
|
||||
This exists non-zero if there is an error.
|
||||
|
||||
@@ -25,11 +25,11 @@ This exists non-zero if there is an error.
|
||||
|
||||
Run the validator with:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
This will add resource reservations to the Deployment. Change the `tshirt-size`
|
||||
annotation from `medium` to `small` and rerun:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
Observe that the reservations have changed.
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main implements an injection function for resource reservations and
|
||||
// is run with `kustomize config run-fns -- DIR/`.
|
||||
// is run with `kustomize config run -- DIR/`.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -27,21 +27,21 @@ function input, and writing the function output.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.configFn` and running:
|
||||
|
||||
kustomize config run-fns local-resources/
|
||||
kustomize config run local-resources/
|
||||
|
||||
This generates the `local-resources/config` directory containing the template output.
|
||||
|
||||
- the template output may be modified by adding fields -- such as initContainers,
|
||||
sidecarConatiners, cpu resource limits, etc -- and these fields will be retained
|
||||
when re-running `run-fns`
|
||||
- the function input `example-use.yaml` may be changed and rerunning `run-fns` will update
|
||||
when re-running `run`
|
||||
- the function input `example-use.yaml` may be changed and rerunning `run` will update
|
||||
only the parts changed in the template output.
|
||||
|
||||
## Running the Example
|
||||
|
||||
Run the config with:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
This will create the directory
|
||||
|
||||
@@ -50,6 +50,6 @@ This will create the directory
|
||||
Add an annotation to the StatefulSet Resource and change the replica count of the
|
||||
`kind: Nginx` Resource in `example-use.yaml`. Rerun the template:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
The replica count should be updated, but your annotation should remain.
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1 # call `kustomize config run-fns` on a directory containing this file
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1 # call `kustomize config run` on a directory containing this file
|
||||
kind: Nginx
|
||||
metadata:
|
||||
name: demo
|
||||
|
||||
@@ -11,7 +11,7 @@ The function is implemented as an [image](image), and built using `make image`.
|
||||
The template is implemented as a heredoc, which substitutes environment variables
|
||||
into a static string.
|
||||
|
||||
This simple implementation uses `kustomize config run-fns wrap --` to perform the
|
||||
This simple implementation uses `kustomize config run wrap --` to perform the
|
||||
heavy lifting of implementing the function interface.
|
||||
|
||||
- parse functionConfig from stdin into environment variables
|
||||
@@ -22,21 +22,21 @@ heavy lifting of implementing the function interface.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.configFn` and running:
|
||||
|
||||
kustomize config run-fns local-resources/
|
||||
kustomize config run local-resources/
|
||||
|
||||
This generates the `local-resources/config` directory containing the template output.
|
||||
|
||||
- the template output may be modified by adding fields -- such as initContainers,
|
||||
sidecarConatiners, cpu resource limits, etc -- and these fields will be retained
|
||||
when re-running `run-fns`
|
||||
- the function input `example-use.yaml` may be changed and rerunning `run-fns` will update
|
||||
when re-running `run`
|
||||
- the function input `example-use.yaml` may be changed and rerunning `run` will update
|
||||
only the parts changed in the template output.
|
||||
|
||||
## Running the Example
|
||||
|
||||
Run the config with:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
This will create the directory
|
||||
|
||||
@@ -45,6 +45,6 @@ This will create the directory
|
||||
Add an annotation to the StatefulSet Resource and change the replica count of the
|
||||
`kind: CockroachDB` Resource in `example-use.yaml`. Rerun the template:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
The replica count should be updated, but your annotation should remain.
|
||||
@@ -3,18 +3,18 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
# use `kustomize config run-fns wrap` to parse the container stdin into
|
||||
# use `kustomize config run wrap` to parse the container stdin into
|
||||
# environment variables, and to merge the template output into the
|
||||
# input Resources.
|
||||
if [ -z ${WRAPPED} ]; then
|
||||
export WRAPPED=true
|
||||
kustomize config run-fns wrap -- $0
|
||||
kustomize config run wrap -- $0
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# this is the template for a cockroachdb instance
|
||||
# environment variables are parsed from the input functionConfig by
|
||||
# `kustomize config run-fns wrap`
|
||||
# `kustomize config run wrap`
|
||||
cat <<End-of-message
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# call `kustomize config run-fns` on a directory containing this file
|
||||
# call `kustomize config run` on a directory containing this file
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1
|
||||
kind: CockroachDB
|
||||
metadata:
|
||||
|
||||
@@ -17,7 +17,7 @@ Resource configuration, and looks for invalid configuration.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.configFn` and running:
|
||||
|
||||
kustomize config run-fns local-resources/
|
||||
kustomize config run local-resources/
|
||||
|
||||
This exists non-zero if there is an error.
|
||||
|
||||
@@ -25,7 +25,7 @@ This exists non-zero if there is an error.
|
||||
|
||||
Run the validator with:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
This will return an error:
|
||||
|
||||
@@ -33,6 +33,6 @@ This will return an error:
|
||||
|
||||
Now uncomment the resource reservations and run again:
|
||||
|
||||
kustomize config run-fns local-resource/
|
||||
kustomize config run local-resource/
|
||||
|
||||
This will return success
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main implements a validator function run by `kustomize config run-fns`
|
||||
// Package main implements a validator function run by `kustomize config run`
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user