CUJ
kpt fn render and kpt fn eval supports mechanism to target resources to apply function on. For example:
# Apply set-labels on resources of kind Deployment and belonging to group apps
$ kpt fn eval [PKG_DIR] -i set-labals:v0.1.5 --match-group apps --match-kind Deployment
Declaratively, for example, apply set-labels on resources with group apps and kind Deployment.
# excerpts from Kptfile
...
pipeline:
mutators:
- image: set-labels:v0.1.5
selectors:
- group: apps
kind: Deployment
Sometimes users want to exclude set of resources from function's target. For ex. apply this function on all resources except the ones with kind Kptfile or apply this label on all the deployments except with a specific name.
This will become especially important as we allow functionConfigs and Kptfile to be included in function input by default in kpt fn commands.
Proposal
Imperative workflow:
# apply set-labels to all the deployments except a given name
$ kpt fn eval [PKG_DIR] -i set-labels:v0.1.5 --match-kind Deployment --exclude-name some-name
# apply set-labels on resources belonging to apps group except kind StatefulSet
$ kpt fn eval [PKG_DIR] -i set-labels:v0.1.5 --match-group apps --exclude-kind StatefulSet
Declarative workflow:
Introduce exclude selectors.
# apply set-labels on all resources except with kind `Kptfile` or group `apps`
...
pipeline:
mutators:
- image: set-labels:v0.1.5
exclude:
- kind: Kptfile
- group: apps
Alternatives names for exclude: except, reject
It will also be nice to have a way syntactic sugar for select or exclude all local-configs (resources with a config.kubernetes.io/local-config: "true" annotation).
CUJ
kpt fn renderandkpt fn evalsupports mechanism to target resources to apply function on. For example:Declaratively, for example, apply
set-labelson resources with groupappsand kindDeployment.Sometimes users want to exclude set of resources from function's target. For ex. apply this function on all resources except the ones with
kindKptfileor apply this label on all the deployments except with a specific name.This will become especially important as we allow
functionConfigsandKptfileto be included in function input by default inkpt fncommands.Proposal
Imperative workflow:
Declarative workflow:
Introduce
excludeselectors.Alternatives names for
exclude:except,rejectIt will also be nice to have a way syntactic sugar for select or exclude all
local-configs(resources with aconfig.kubernetes.io/local-config: "true"annotation).