-
Notifications
You must be signed in to change notification settings - Fork 239
Open
Labels
Description
Description
Related to #2971 (comment)
SDK should provide a general solution which can be easily used to all functions to filter resources by GVK. Currently, kpt provides the selector and exclude syntax in Kptfile and as flags to filter resources before passing into each function.
Proposal
- kpt shall annotate Kptfile and inline ConfigMap with an internal annotation, propose
internal.config.kubernetes.io/kpt-meta, the SDK should provide functions to filter resources by annotation (and this should be called inside a function) - FunctionConfig defines a general interface to filter resources by GVK. SDK provides the actual filtering logic (maybe a default behavior under the SDK resourceList
Processso it's applied to all functions automatically). It would be like
apiVersion: config.kubernetes.io/v1
kind: Resourcelist
items:
- apiVersion: v1
kind: ConfigMap
metadata:
name: current-function-config
annotations:
internal.config.kubernetes.io/kpt-meta: true # marked as meta resource, exclude by default
- apiVersion: v1
kind: ConfigMap
metadata:
name: other-function-config
annotations:
internal.config.kubernetes.io/kpt-meta: true # marked as meta resource, exclude by default
- apiVersion: kpt.dev/v1
kind: Kptfile # Kptfile, exclude by default
...
functionConfig:
apiVersion: v1
kind: ConfigMap
metadata:
name: current-function-config
annotations:
internal.config.kubernetes.io/exclude-meta: true
internal.config.kubernetes.io/exclude: | # function level exclude list.
- kind:
- kind: