kopf
kopf copied to clipboard
Implicitly map kinds<=>plurals<=>singulars
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.