mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Update documents from 'configuration' to 'fn'
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.annotations.[config.kubernetes.io/function]` and running:
|
||||
|
||||
kustomize config run local-resource/ --fn-path config/
|
||||
kustomize fn run local-resource/ --fn-path config/
|
||||
|
||||
This exits non-zero if there is an error.
|
||||
|
||||
@@ -25,6 +25,6 @@ This exits non-zero if there is an error.
|
||||
|
||||
Run the validator with:
|
||||
|
||||
kustomize config run local-resource/ --fn-path config/
|
||||
kustomize fn run local-resource/ --fn-path config/
|
||||
|
||||
This will append an Application CR.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main implements adding an Application CR to a group of resources and
|
||||
// is run with `kustomize config run -- DIR/`.
|
||||
// is run with `kustomize fn run -- DIR/`.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -82,7 +82,6 @@ func (f appCRFilter) Filter(in []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
return append(in, app), nil
|
||||
}
|
||||
return in, nil
|
||||
|
||||
}
|
||||
|
||||
// parseAPI parses the functionConfig into an API struct.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main implements adding an Application CR to a group of resources and
|
||||
// is run with `kustomize config run -- DIR/`.
|
||||
// is run with `kustomize fn run -- DIR/`.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -17,7 +17,7 @@ Resource configuration, and looks for invalid configuration.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.annotations.[config.kubernetes.io/function]` and running:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This exits non-zero if there is an error.
|
||||
|
||||
@@ -25,11 +25,11 @@ This exits non-zero if there is an error.
|
||||
|
||||
Run the validator with:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn 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 local-resource/
|
||||
kustomize fn 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 -- DIR/`.
|
||||
// is run with `kustomize fn run -- DIR/`.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -27,7 +27,7 @@ function input, and writing the function output.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.annotations.[config.kubernetes.io/function]` and running:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This generates the `local-resource/config` directory containing the template output.
|
||||
|
||||
@@ -41,7 +41,7 @@ This generates the `local-resource/config` directory containing the template out
|
||||
|
||||
Run the config with:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This will create the directory
|
||||
|
||||
@@ -50,6 +50,6 @@ This will create the directory
|
||||
Add an annotation to the Deployment Resource and change the replica count of the
|
||||
`kind: Nginx` Resource in `example-use.yaml`. Rerun the template:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn 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` on a directory containing this file
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1 # call `kustomize fn 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 wrap --` to perform the
|
||||
This simple implementation uses `kustomize fn run wrap --` to perform the
|
||||
heavy lifting of implementing the function interface.
|
||||
|
||||
- parse functionConfig from stdin into environment variables
|
||||
@@ -22,7 +22,7 @@ heavy lifting of implementing the function interface.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.annotations.[config.kubernetes.io/function]` and running:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This generates the `local-resource/config` directory containing the template output.
|
||||
|
||||
@@ -36,7 +36,7 @@ This generates the `local-resource/config` directory containing the template out
|
||||
|
||||
Run the config with:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn 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 local-resource/
|
||||
kustomize fn 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 wrap` to parse the container stdin into
|
||||
# use `kustomize fn 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 wrap -- $0
|
||||
kustomize fn 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 wrap`
|
||||
# `kustomize fn 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` on a directory containing this file
|
||||
# call `kustomize fn run` on a directory containing this file
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1
|
||||
kind: CockroachDB
|
||||
metadata:
|
||||
|
||||
@@ -20,7 +20,7 @@ the `API` struct definition in [main.go](image/main.go) for documentation.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.annotations.[config.kubernetes.io/function]` and running:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This exists non-zero if kubeval detects an invalid Resource.
|
||||
|
||||
@@ -28,7 +28,7 @@ This exists non-zero if kubeval detects an invalid Resource.
|
||||
|
||||
Run the validator with:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This will return an error:
|
||||
|
||||
@@ -39,6 +39,6 @@ This will return an error:
|
||||
Now fix the typo in [example-use.yaml](local-resource/example-use.yaml) and
|
||||
run:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
This will return success (no output).
|
||||
|
||||
@@ -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`
|
||||
// Package main implements a validator function run by `kustomize fn run`
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -17,7 +17,7 @@ Resource configuration, and looks for invalid configuration.
|
||||
The function is invoked by authoring a [local Resource](local-resource)
|
||||
with `metadata.annotations.[config.kubernetes.io/function]` and running:
|
||||
|
||||
kustomize config run local-resource/
|
||||
kustomize fn run local-resource/
|
||||
|
||||
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 local-resource/
|
||||
kustomize fn 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 local-resource/
|
||||
kustomize fn 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`
|
||||
// Package main implements a validator function run by `kustomize fn run`
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -18,7 +18,8 @@ func main() {
|
||||
p := kio.Pipeline{
|
||||
Inputs: []kio.Reader{rw}, // read the inputs into a slice
|
||||
Filters: []kio.Filter{filter{}}, // run the filter against the inputs
|
||||
Outputs: []kio.Writer{rw}} // copy the inputs to the output
|
||||
Outputs: []kio.Writer{rw}, // copy the inputs to the output
|
||||
}
|
||||
if err := p.Execute(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
@@ -59,7 +60,6 @@ func validate(r *yaml.RNode) error {
|
||||
|
||||
// visit each container in the list and validate
|
||||
return containers.VisitElements(func(node *yaml.RNode) error {
|
||||
|
||||
// check cpu is non-nil
|
||||
f, err := node.Pipe(yaml.Lookup("resources", "requests", "cpu"))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user