Skip to content

Commit

Permalink
doc: add documentation on naming functions in a Kptfile
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelvl committed Jul 22, 2023
1 parent 6a7663f commit ef72932
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions site/book/04-using-functions/01-declarative-function-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,33 @@ pipeline:
tier: mysql
```

## Specifying function `name`

Functions can optionally be named to e.g. express the combined effect
of `function` and `functionConfig`.

For example:

```yaml
# wordpress/mysql/Kptfile
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: mysql
pipeline:
mutators:
- name: set tier label
image: set-labels:v0.1
configMap:
tier: mysql
```

Specifying unique function names for all functions in a `Kptfile` is
highly recommended, since package updates with `kpt pkg update` merges
the `mutator` and `validator` function lists as associative list using
the `name` field to identify functions. An unspecified `name` or
duplicated names may result in unexpected package updates.

## Specifying `selectors`

In some cases, you want to invoke the function only on a subset of resources based on a
Expand Down

0 comments on commit ef72932

Please sign in to comment.