KaotoIO / kaoto

Next version of the UI of the Kaoto project
Apache License 2.0
22 stars 21 forks source link

Consider using RouteTemplateDefinition for IKameletSpec.template #748

Open igarashitm opened 5 months ago

igarashitm commented 5 months ago

Please describe the task that needs to be done

Currently it's a custom object with having FromDefinition as a child https://github.com/KaotoIO/kaoto-next/blob/main/packages/ui/src/models/kamelets-catalog.ts#L36

Kamelet spec.template is actually a RouteTemplateDefinition, so we should be able to use RouteTemplateDefinition from camelYamlDsl.d.ts

We need to investigate if any other adjustment is needed, for example RouteTemplateDefinition accepts route as well, and from is optional. It means Kamelet spec.template also accepts route unless some special restriction is added in Camel K (I guess not).

igarashitm commented 5 months ago

At least it succeeds to kubectl apply -f kamelet-with-route.kamelet.yaml with having a route in spec.template.route instead of in from, and kamel describe kamelet successfully shows the contents

Update

Currently the both route and from are allowed under Kamelet spec.template. Syntactically everything RouteTemplateDefinition has are allowed. Upstream issue: https://github.com/apache/camel-k/issues/5118