oam-kubernetes-runtime icon indicating copy to clipboard operation
oam-kubernetes-runtime copied to clipboard

Could we have a trait group or multiple definitionRef

Open henrywangx opened this issue 5 years ago • 1 comments

Since for some powerful trait like istio trait, it has the VirtualService, DefinitionRule, SideCar CR. For each CR, we may create a trait.

But they have relationship with each other, need to configure them all together make traffic works. In that case, we need to group them or allow multiple definitionRef of one trait.

henrywangx avatar May 23 '20 07:05 henrywangx

Yes!

The XXXDefinition currently is designed as a mapping project to track upper level object to lower level object. For example, ContainerizedWorkload -> Deployment, or RolloutTrait -> FlaggerRolloutTrait.

So in your case, you need to "compose" multiple Istio CRDs into a new CRD and then reference that CRD in TraitDefintion.

What's more fantastic is if you are using Crossplane, it provides you a mechanism named Composition to create composed CRD without writing any controller code. It's actually how we compose infrastructure pieces together into a reusable infrastructure OAM Component. Please check this example and /cc @negz the composition feature owner. btw, I think we may need to publish a composition tool/quickdoc for ppl to try.

resouer avatar May 23 '20 18:05 resouer