spec icon indicating copy to clipboard operation
spec copied to clipboard

Definition objects should be more informative and extensible

Open resouer opened this issue 4 years ago • 3 comments

XXXDefinition will become a "register object" for given trait/workload, it worth a better design.

Part 1: Informative fields. As an end user I may expect I can get rich information by kubectl describe trait cronhpa.

For example, I will expect a description which is equivalent to --help for a given capability:

$ kubectl get trait cronhpa -o yaml
...
spec:
  definitionRef:
    name: cronhpa.alibaba-inc.com
  description: |
    CronHPA is a kubernetes cron horizontal pod autoscaler controller using `crontab` like scheme

    The cron expression format is as described below: 

    Field name   | Mandatory? | Allowed values  | Allowed special characters
    ----------   | ---------- | --------------  | --------------------------
    Seconds      | Yes        | 0-59            | * / , -
    Minutes      | Yes        | 0-59            | * / , -
    Hours        | Yes        | 0-23            | * / , -
    Day of month | Yes        | 1-31            | * / , - ?
    Month        | Yes        | 1-12 or JAN-DEC | * / , -
    Day of week  | Yes        | 0-6 or SUN-SAT  | * / , - ?   

Some other generated content from CRD/go types for description, for example:

https://doc.crds.dev/github.com/crossplane/provider-alibaba/config/crd/database.alibaba.crossplane.io_rdsinstances.yaml

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#networkpolicy-v1-networking-k8s-io

Part 2: manageability fields, for example: workloadAware, revisionAware etc.

resouer avatar Jun 09 '20 22:06 resouer

/cc @wonderflow

resouer avatar Jun 12 '20 23:06 resouer

Also, definition objects should be extensible, i.e. there could be a section of extended parameters for platform builders to extend the functionality of TraitDefinition etc.

resouer avatar Jun 25 '20 19:06 resouer

Totally agree, we can add a proposal for it in oam-k8s-runtime

wonderflow avatar Jun 27 '20 12:06 wonderflow