multi-cluster-app-dispatcher
multi-cluster-app-dispatcher copied to clipboard
[tooling] Enable validation for appwrapper
We need to enable yaml validation submitted to MCAD. specifically to stanzas that represent resources ie custompodresources
CC @tardieu
@anishasthana @astefanutti Can you please help us to mandate custompodresources stanza that can help us further simplify resource discovery logic in MCAD
One trivial, yet limited, way would be to mandate the custompodresources array to have at least one item.
As the CRDs are generated from the APIs, this can be achieved with:
// +kubebuilder:validation:MinItems:=1
CustomPodResources []CustomPodResourceTemplate
A more elaborated logic could be specified using validation rules, which leverages the CEL expression language. Note that fields from the generic items, other than the runtime object ones, are not accessible to at CEL, so the logic would be limited to the later. Note also these validation rules are available since Kubernetes 1.25.
For completeness, a validation webhook would provide the maximum expressiveness, that would come at the expense of an operational cost that would be difficult to justify here.
So we need to review first what functional logic is to be applied, and then decide on the implementation.