Skip to content

Commit b9ea0bc

Browse files
authored
docs: updated meta resources related behavior in kpt fn docs (#3187)
1 parent 044f223 commit b9ea0bc

File tree

11 files changed

+37
-45
lines changed

11 files changed

+37
-45
lines changed

internal/docs/generated/fndocs/docs.go

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

internal/docs/generated/pkgdocs/docs.go

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

site/book/02-concepts/01-packages.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ This _package hierarchy_ contains two packages:
4343
`Kptfile`. This package contains 3 resources in
4444
`wordpress/mysql/deployment.yaml` file.
4545

46-
The `Kptfile` is an example of a _meta resource_ in kpt. Meta resources are
47-
resources that are only consumed by the kpt tool. They do not have extrinsic
48-
meaning and are not applied to a cluster. We will see other types of a meta
49-
resources in the next section.
50-
5146
kpt uses Git as the underlying version control system. A typical workflow starts
5247
by fetching an _upstream_ package from a Git repository to the local filesystem
5348
using `kpt pkg` commands. All other functionality (i.e. `kpt fn` and `kpt live`)

site/book/02-concepts/02-workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For example, when consuming an upstream package, the initial workflow can look l
1111
- **Get**: Using `kpt pkg get`
1212
- **Explore**: Using an editor or running commands such as `kpt pkg tree`
1313
- **Edit**: Customize the package either manually or automatically using `kpt fn eval`. This may
14-
involve editing meta resources such as the functions pipeline in the `Kptfile` which is executed
14+
involve editing the functions pipeline in the `Kptfile` which is executed
1515
in the next stage.
1616
- **Render**: Using `kpt fn render`
1717

site/book/02-concepts/03-functions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ fundamentally different approaches:
7070
the `functionConfig` is specified as CLI argument. This is an imperative way
7171
to run functions. Since the function is provided explicitly by the user, an
7272
imperative invocation can be more privileged and low-level than an declarative
73-
invocation. For example, it can optionally operate on meta resources or have
74-
access to the host system.
73+
invocation. For example, it can have access to the host system.
7574

7675
We will discuss how to run functions in Chapter 4 and how to develop functions
7776
in Chapter 5.

site/book/03-packages/03-editing-a-package.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ lowest-level, _editing_ a package is simply a process that either:
55
- Changes the resources within that package. Examples:
66
- Authoring new a Deployment resource
77
- Customizing an existing Deployment resource
8-
- Modifying the Kptfile or other meta resources
8+
- Modifying the Kptfile
99
- Changes the package hierarchy, also called _package composition_. Examples:
1010
- Adding a subpackage.
1111
- Create a new dependent subpackage.
@@ -40,8 +40,8 @@ $ code wordpress
4040
## Automation
4141

4242
Oftentimes, you want to automate repetitive or complex operations. Having standardized on KRM for
43-
all resources in a package (including meta resources) allows us to easily develop automation in
44-
different toolchains and languages, as well as at levels of abstraction.
43+
all resources in a package allows us to easily develop automation in different
44+
toolchains and languages, as well as at levels of abstraction.
4545

4646
For example, setting a label on all the resources in the `wordpress` package can be done
4747
using the following function:

site/book/04-using-functions/02-imperative-function-execution.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ When you have one of these use cases:
4141
- Perform a one-time operation
4242
- Execute a function from a CI/CD system on packages authored by other teams
4343
- Develop shell scripts and chain functions with the Unix pipe (`|`)
44-
- Mutate meta resources such as the `Kptfile` (Not allowed by `render`)
4544
- Execute the function with privilege (Not allowed by `render`)
4645

4746
We will cover these topics in detail.
@@ -134,8 +133,7 @@ Here is the list of available exclusion flags:
134133

135134
Since the function is provided explicitly by the user, `eval` can be more
136135
privileged and low-level than a declarative invocation using `render`. For
137-
example, it can optionally operate on meta resources or have access to the host
138-
system.
136+
example, it can have access to the host system.
139137

140138
In general, we recommend against having functions that require privileged access
141139
to the host since they can only be executed imperatively and pose a challenge in
@@ -179,26 +177,6 @@ in read-write mode.
179177
--mount type=bind,src="/path/to/schema-dir",dst=/schema-dir,rw=true
180178
```
181179
182-
### Mutate Meta Resources
183-
184-
By default, functions cannot mutate meta resources i.e. `Kptfile` and
185-
functionConfig(s). There are use cases for having _meta functions_ that can
186-
operate on meta resources. For example, they can perform the following:
187-
188-
- Enforce a policy on functions declared in all `Kptfile`(s) in the package
189-
hierarchy
190-
- Add a function to the `validators` list in the `Kptfile`
191-
- Set the `info.license` field in the `Kptfile` to `Apache-2.0`
192-
193-
This is enabled using the `--include-meta-resources` flag.
194-
195-
For instance, the following will set the labels on all resources in the
196-
`wordpress` package, including the `Kptfile`:
197-
198-
```shell
199-
$ kpt fn eval wordpress -i set-labels:v0.1 --include-meta-resources -- app=wordpress env=prod
200-
```
201-
202180
## Chaining functions using the Unix pipe
203181
204182
As an alternative to declaring a pipeline in the `Kptfile`, you can chain

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ fn-args:
103103
If using never, kpt will only use images from the local cache.
104104
105105
--include-meta-resources, m:
106-
If enabled, meta resources (i.e. `Kptfile` and `functionConfig`) are included
107-
in the input to the function. By default it is disabled.
106+
(DEPRECATED) include-meta-resources is no longer necessary because meta
107+
resources are included by default with kpt version v1.0.0-beta.15+.
108108
109109
--mount:
110110
List of storage options to enable reading from the local filesytem. By default,

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ from A is then written to the local filesystem in-place.
2121

2222
`render` formats the resources before writing them to the local filesystem.
2323

24-
Meta resources (i.e. `Kptfile` and `functionConfig`) are excluded from the
25-
inputs to the functions.
26-
2724
If any of the functions in the pipeline fails, then the entire pipeline is
2825
aborted and the local filesystem is left intact.
2926

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ DIR:
3939
Path to the file containing `functionConfig`.
4040
4141
--include-meta-resources:
42-
If enabled, meta resources (i.e. `Kptfile` and `functionConfig`) are included
43-
in the output of the command. By default it is disabled.
42+
(DEPRECATED) include-meta-resources is no longer necessary because meta
43+
resources are included by default with kpt version v1.0.0-beta.15+.
4444
4545
--output, o:
4646
If specified, the output resources are written to stdout in provided format.

0 commit comments

Comments
 (0)