Refine valuesFrom API to make it more generic and flexible.
Current API used to define the layer of values files included in bootstrap or preview is not very flexible since these files are hardcoded here.
It is hard to define new scenarios, and/or to extend existing ones. For example, some users may need to add specific values in the context of bootstrap, this is currently not possible.
Additionally, in order to implement #45 (closed), we'll have to define these files as valuesFrom instead of valuesFiles.
The proposed solution would consist in adding a new SylvaUnitsFile type to valuesFrom to allow user to refer to files located in sylvaUnits repository, and add an optional context field to these valuesFrom to only include these files in a specific context (bootstrap, preview...)
spec:
contexts: # Determine which context are included
bootstrap: true # Would be removed after pivot
preview: true
sylvaUnitsSource:
type: git
url: SYLVA_CORE_REPO
commit: CURRENT_COMMIT
valuesFrom:
- type: SylvaUnitsFile
valuesPath: values.yaml
- type: SylvaUnitsFile
valuesPath: management.values.yaml
- type: SylvaUnitsFile
valuesPath: bootstrap.values.yaml
contexts: bootstrap # Indicate that this value should only be included in bootstrap context
- type: OCIRepository
name: third-party-bootstrap
valuesPath: bootstrap.yaml
context: bootstrap # Additional files could be injected from external repos or configmaps in bootstrap context
- type: SylvaUnitsFile
valuesPath: preview.values.yaml
context: preview # Same for preview
- type: ConfigMap
name: sylva-units-values
valuesKey: values
- type: Secret
name: sylva-units-secrets
valuesKey: secrets
This would be much more flexible, and would ease the definition of additional behaviors (to preview workload cluster helmrelease for example)