Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

[Feature] Add validation for Definition Object #247

Open
wonderflow opened this issue Oct 12, 2020 · 4 comments
Open

[Feature] Add validation for Definition Object #247

wonderflow opened this issue Oct 12, 2020 · 4 comments
Assignees

Comments

@wonderflow
Copy link
Member

For traitDefinition, the value of applyTo could have many formats:

  • format by group/version.Kind => core.oam.dev/v1alpha2.PodspecWorkload
  • directly use workloadDefinition Name => webservice
  • directly use CRD name => deployments.apps
  • use group name to represent apply to the whole group => core.oam.dev

We need to add validation for it and future needs.

@LeoLiuYan
Copy link
Contributor

Now, when apply traits, the workloads does not add to traitDefinition's AppliesToWorkloads field like the scopes apply do. So, the applyTo field maybe not use in this moment.

The associated code maybe here:
https://github.com/crossplane/oam-kubernetes-runtime/blob/master/pkg/controller/v1alpha2/applicationconfiguration/apply.go#L104
https://github.com/crossplane/oam-kubernetes-runtime/blob/master/pkg/controller/v1alpha2/applicationconfiguration/apply.go#L121

@wonderflow
Copy link
Member Author

Yes, checking applyTo fields should also add to this validation. @LeoLiuYan

@LeoLiuYan
Copy link
Contributor

Could this feature assign to me? @wonderflow

@wonderflow
Copy link
Member Author

Sure, we have already setup validation webhook framework https://github.com/crossplane/oam-kubernetes-runtime/tree/master/pkg/webhook/v1alpha2

You could add it there. @LeoLiuYan

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants