kubernetes-sigs / kustomize

Customization of kubernetes YAML configurations
Apache License 2.0
11.01k stars 2.25k forks source link

Select/Exclude KRM resources passed to KRM functions #5787

Open jashandeep-sohi opened 2 weeks ago

jashandeep-sohi commented 2 weeks ago

Eschewed features

What would you like to have added?

Allow specifying a selector to include or exclude KRM resources passed to a KRM function in the config.kubernetes.io/function spec annotation. Something similar to how KPT lets you do that, https://kpt.dev/book/04-using-functions/01-declarative-function-execution?id=specifying-selectors

For example, to only pass KRMs of kind Deployment:

    config.kubernetes.io/function: |
      container:
        image: krm-fn-image
      select:
        kind: Deployment

Or, to pass everything but all Deployment:

    config.kubernetes.io/function: |
      container:
        image: krm-fn-image
      exclude:
        kind: Deployment

select & exclude would naturally be mutually exclusive.

Why is this needed?

Sometimes you only want KRM functions to run on a subset of resources.

Can you accomplish the motivating task without this feature, and if so, how?

Perhaps. Every KRM function would have to implement some kind of selector/exclude logic.

What other solutions have you considered?

A wrapper exec KRM function that does the filtering and then calls the original KRM function.

Anything else we should know?

No response

Feature ownership

k8s-ci-robot commented 2 weeks ago

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.