Skip to content

Commit 7a89a83

Browse files
authored
doc: Add docs for --type flag (#2977)
1 parent b5403ad commit 7a89a83

File tree

2 files changed

+60
-24
lines changed

2 files changed

+60
-24
lines changed

internal/docs/generated/fndocs/docs.go

Lines changed: 28 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/reference/cli/fn/eval/README.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,6 @@ fn-args:
5858
By default, container function is executed as `nobody` user. You may want to use
5959
this flag to run higher privilege operations such as mounting the local filesystem.
6060
61-
--match-api-version:
62-
Select resources matching the given apiVersion.
63-
64-
--match-kind
65-
Select resources matching the given kind.
66-
67-
--match-name:
68-
Select resources matching the given name.
69-
70-
--match-namespace:
71-
Select resources matching the given namespace.
72-
7361
--env, e:
7462
List of local environment variables to be exported to the container function.
7563
By default, none of local environment variables are made available to the
@@ -106,6 +94,18 @@ fn-args:
10694
(DEPRECATED) include-meta-resources is no longer necessary because meta
10795
resources are included by default with kpt version v1.0.0-beta.15+.
10896
97+
--match-api-version:
98+
Select resources matching the given apiVersion.
99+
100+
--match-kind
101+
Select resources matching the given kind.
102+
103+
--match-name:
104+
Select resources matching the given name.
105+
106+
--match-namespace:
107+
Select resources matching the given namespace.
108+
109109
--mount:
110110
List of storage options to enable reading from the local filesytem. By default,
111111
container functions can not access the local filesystem. It accepts the same options
@@ -125,11 +125,21 @@ fn-args:
125125
3. OUT_DIR_PATH: output resources are written to provided directory.
126126
The provided directory must not already exist.
127127
128+
--type, t;
129+
Specify the function type. Accept value `mutator` (default), `validator`.
130+
If used with `--save`, this flag will save the evaluated function to the corresponding
131+
Kptfile section: `.pipeline.mutators` if type is `mutator`; `.pipeline.validators` if type
132+
is `validator`.
133+
128134
--results-dir:
129135
Path to a directory to write structured results. Directory will be created if
130136
it doesn't exist. Structured results emitted by the functions are aggregated and saved
131137
to `results.yaml` file in the specified directory.
132138
If not specified, no result files are written to the local filesystem.
139+
140+
--save, s:
141+
Save the function image and fn-config to Kptfile. Require ` + "`" + `--image` + "`" + `.
142+
133143
```
134144

135145
#### Environment Variables
@@ -162,6 +172,16 @@ $ kpt fn eval DIR -i gcr.io/example.com/my-fn --fn-config my-fn-config
162172
$ kpt fn eval DIR -i gcr.io/example.com/my-fn:v1.0.0 -- foo=bar
163173
```
164174

175+
```shell
176+
# execute container my-fn and save it to Kptfile `pipeline.mutators` (Default) list.
177+
$ kpt fn eval DIR -s -i gcr.io/example.com/my-fn:v1.0.0 -- foo=bar
178+
```
179+
180+
```shell
181+
# execute container my-fn and save it to Kptfile `pipeline.validators` list.
182+
$ kpt fn eval DIR -s -t validator -i gcr.io/example.com/my-fn:v1.0.0 -- foo=bar
183+
```
184+
165185
```shell
166186
# execute executable my-fn on the resources in DIR directory and
167187
# write output back to DIR

0 commit comments

Comments
 (0)