You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/content/en/book/04-using-functions/_index.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -305,10 +305,16 @@ apiVersion: v1
305
305
kind: ConfigMap
306
306
metadata:
307
307
name: labels
308
+
annotations:
309
+
config.kubernetes.io/local-config: "true"
308
310
data:
309
311
tier: mysql
310
312
```
311
313
314
+
Note the `local-config` annotation: it ensures this resource is not applied to
315
+
the cluster when you run `kpt live apply`. See
316
+
[Marking function configs as local](#marking-function-configs-as-local) below.
317
+
312
318
#### `configMap`
313
319
314
320
Many functions take a `functionConfig` of kind `ConfigMap`, since they only need simple key/value pairs as an argument. For convenience, there is a way to inline the key/value pairs in the `Kptfile`.
@@ -368,6 +374,42 @@ The `configRef` fields are as follows:
368
374
369
375
The reference must match exactly one resource in the package. An error is raised if zero or multiple resources match.
370
376
377
+
### Marking function configs as local
378
+
379
+
When you use `configPath` to reference a function config file, that resource is
380
+
automatically excluded from the pipeline input (it is not passed to functions as
381
+
a regular resource). However, the resource still exists in the package and will
382
+
be sent to the cluster when you run `kpt live apply`, unless you mark it as
383
+
local configuration.
384
+
385
+
To prevent a function config from being applied to the cluster, add the
386
+
`config.kubernetes.io/local-config` annotation:
387
+
388
+
```yaml
389
+
# wordpress/mysql/labels.yaml
390
+
apiVersion: v1
391
+
kind: ConfigMap
392
+
metadata:
393
+
name: labels
394
+
annotations:
395
+
config.kubernetes.io/local-config: "true"
396
+
data:
397
+
tier: mysql
398
+
```
399
+
400
+
Resources with this annotation set to any value other than `"false"` are filtered
401
+
out during `kpt live apply`. They remain in the package for use by the pipeline
402
+
but are never sent to the cluster.
403
+
404
+
This annotation is useful for:
405
+
406
+
- Function configs referenced by `configPath`
407
+
- Template or helper resources used only during rendering
408
+
- Any resource that should exist in the package but not on the cluster
409
+
410
+
For full details on the annotation schema and behavior, see the
0 commit comments