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/
|
||||
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