Prevent race condition when an object on which the SWC depends on changes
What it does
- Add hash to object copied in the SUR namespace and update the SUR each time object change
- Old object are cleaned
- Add an efficient
pruneManagedResourcesfunction to remove deprecated resources. It replaces theDeleteManagedResourcefunction - Adapt tests
Tests
- Adapted tests (which look for object copied in the SUR namespace) take into account the hash
✅ - A new test ensure that when a ConfigMap which is a SWC valuesFrom item changes, the old copied object is pruned
✅ - Test on a local Openstack platform with Sylva 1.4.9
✅
Regarding the tests, each time the copied object data is computed with copiedData, _ = sylvav1alpha1c.InsertYamlAtPath(path, srcData) even if the valuedFrom targetPath is null. The reason is that the function output YAML encoded string even if a JSON encoded string is given as input: "{a: {b: c}}" is transformed to "a:\n b:c\n". It modified the hash.
This behavior has been introduced by the MR !315 (merged). There is no impact on the final HelmRelease behavior (JSON is a subset of YAML) but it has enabled us to close the #32 (closed)
Reference
Closes #31 (closed)
Edited by vladimir braquet