astefanutti opened a new pull request #2831:
URL: https://github.com/apache/camel-k/pull/2831
That PR aims at integrating the Camel YAML DSL JSON schema into the
Integration and Kamelet CRDs (and transitively to the KameletBinding CRD).
Each Camel K CRD specifies a structural schema, which is an OpenAPI v3.0
validation schema, with few, but important limitations, that directly impact
the processing of the Camel YAML DSL JSON schema:
* The `$ref` element cannot be used, which in practice leads to expanding
the tree and duplicating the referenced definitions
* Polymorphism is only supported for the "hard-coded" `IntOrString` type,
for which the special `x-kubernetes-int-or-string: true` field can be added to
nodes.
For the first point, the tree expansion of the Camel DSL schema causes a
significant increase of the CRD sizes, from 350KB to 4.1MB for the Integration
and the KameletBinding CRDs, and from 23KB to 7.2MB for the Kamelet CRD (that
expands the Camel YAML DSL schema twice because of a deprecated field)
The second point seems more problematic, as the YAML DSL specifies more than
50 polymorphic types via the `anyOf` element. For example, the `from` element
is defined as:
```json
"org.apache.camel.model.FromDefinition" : {
"oneOf" : [ {
"type" : "string"
}, {
"type" : "object",
"properties" : {
"parameters" : {
"type" : "object"
},
"uri" : {
"type" : "string"
}
}
} ],
"required" : [ "uri" ]
}
```
This cannot be turned as is as into a CRD structural schema. An option could
be to translate all the polymorphic definitions into raw encoded JSON value
(using the `RawMessage` struct and the special
`x-kubernetes-preserve-unknown-fields: true`), but that would complexity a lot
the processing and likely void the whole point, given major elements of the
YAML DSL are polymorphic, like `from`, `to`, `toD`, `log`, `constant`,
`simple`, `bean`, ...
For reference:
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema.
Fixes #2229.
**Release Note**
```release-note
feat(api): Add YAML DSL structural schema to CRDs
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]