Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Implicitly map kinds<=>plurals<=>singulars #57

Open
nolar opened this issue May 10, 2019 · 0 comments
Open

Implicitly map kinds<=>plurals<=>singulars #57

nolar opened this issue May 10, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@nolar
Copy link
Contributor

nolar commented May 10, 2019

Currently, the resources' plural names must be used as the only acceptable reference to the resources in the handlers:

@kopf.on.create('zalando.org', 'v1', 'kopfexamples')
def create_fn(**_):
    pass

It would be more convenient to refer to the resource the same way as the YAML files do: by their "kind":

@kopf.on.create('zalando.org', 'v1', 'KopfExample')
def create_fn(**_):
    pass

Or, as even more convenient way, as in kubectl — by any of their names without group/version references:

@kopf.on.create('KopfExample')  # kind
def create_fn(**_):
    pass

@kopf.on.create('kopfexample')  # singular
def create_fn(**_):
    pass

@kopf.on.create('kopfexamples')  # plural
def create_fn(**_):
    pass

Short-names can also be supported. Though it is questionable if they should be on the CRD reference in the operator.

@nolar nolar added the enhancement New feature or request label May 10, 2019
@nolar nolar changed the title Implicitly maps kinds<=>plurals Implicitly map kinds<=>plurals<=>singulars May 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant