Prevent installing if previous CRDs are pending to be removed #553
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR checks there are no previous CRDs having a deletion time stamp set. If so it assumes these are leftovers of previous installations and refuses to install the crds chart.
For the time being it only checks on machineinventories, however it could be expanded if we consider that necessary. For now I'd keep the check to the minimum.
When trying to install crds chart if the machine inventory is already there with a deletionTimestamp set produces an error like the following:
$ helm upgrade --install -n cattle-elemental-system --create-namespace \ elemental-operator-crds \ oci://registry.opensuse.org/isv/rancher/elemental/pr/rancher/elemental-operator/pr-553/charts/rancher/elemental-operator-crds-chart Release "elemental-operator-crds" does not exist. Installing it now. Pulled: registry.opensuse.org/isv/rancher/elemental/pr/rancher/elemental-operator/pr-553/charts/rancher/elemental-operator-crds-chart:1.4.0 Digest: sha256:263aa9a6d54990923ea92aa3c6f8eb1bad4550545d45981cd043087a964d9c52 Error: execution error at (elemental-operator-crds/templates/validate-no-pending-deletions.yaml:4:9): CRDs from previous installations are pending to be removed (deletionTimestamp is set). Fully deleting them before (re-)installing is required
In the particular case of #515 to fully clear the offending resource it can be done by removing the finalizers of any MachineInventory resource:
Fixes #515