multi-cluster-app-dispatcher icon indicating copy to clipboard operation
multi-cluster-app-dispatcher copied to clipboard

[tooling] Enable validation for appwrapper

Open asm582 opened this issue 2 years ago • 2 comments

We need to enable yaml validation submitted to MCAD. specifically to stanzas that represent resources ie custompodresources

CC @tardieu

asm582 avatar Jul 27 '23 19:07 asm582

@anishasthana @astefanutti Can you please help us to mandate custompodresources stanza that can help us further simplify resource discovery logic in MCAD

asm582 avatar Aug 24 '23 18:08 asm582

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.

astefanutti avatar Aug 25 '23 11:08 astefanutti