Ensure overriding values do not override the one defined by the CR
What it does
1/ Specific keys were forbidden in the clusterSettings field (ex: cluster, k8s_version, etc.) because they are already defined by the CR fields. However, it was possible to do it in the valuesFrom items (like ConfigMaps)
The present MR removes this un-consistency while ensuring that the CR fields have the top priority
- The admission policies are removed
- The generated SylvaUnitsRelease (SUR) spec values are built by the following merging algorithm. It ensures the CRD field priority (CRD fileds > ClusterSetting > OverridingValues)
- First, the Overriding values are copied in the final SUR values
- Then, the ClusterSetting values are merged
- Then, the other CRD fields (ex: k8s_version) are merged
The README is improved to explain this order
2/ The SylvaUnitsRelease generation code is slighlty improved
- Remove some comments without added values. Ex:
// Switch case to determine bootstrap_provider based on workloadCluster.Spec.controlPlane.providerjust beforeswitch workloadCluster.Spec.ControlPlane.Provider - Several variables were defined far from where they were used. It has been changed. Ex:
infraProviderwas defined 25 lines before being used
Tests
A new test is added to ensure that CRD fields are not overridden. See the tests named Creates capd SylvaWorkloadCluster resources and ensures that the merging priorities are correct: key defined in CRD > clusterSettings > overridingValues
- CI Tests
✅ - CI E2E Tests
✅ - Local tests on Openstack
✅
Go vulncheck related to https://pkg.go.dev/vuln/GO-2026-5377, no known fix yet (2026-06-26-16-05)
References
Close #47 (closed)