-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block reinstall if crds are still pending to be deleted
Signed-off-by: David Cassany <dcassany@suse.com>
- Loading branch information
1 parent
6ee9211
commit 85949e0
Showing
2 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
19 changes: 15 additions & 4 deletions
19
.obs/chartfile/crds/templates/validate-no-pending-deletions.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
{{- $inventoryCRD := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" .Release.Namespace "machineinventories.elemental.cattle.io" -}} | ||
{{- if $inventoryCRD -}} | ||
{{- if $inventoryCRD.metadata.deletionTimestamp -}} | ||
{{- required "CRDs from previous installations are pending to be removed (deletionTimestamp is set). Fully deleting them before (re-)installing is required" "" -}} | ||
{{- $crds := list | ||
"machineinventories" | ||
"machineinventoryselectors" | ||
"machineinventoryselectortemplates" | ||
"machineregistrations" | ||
"managedosimages" | ||
"managedosversionchannels" | ||
"managedosversions" | ||
"seedimages" | ||
"metadatas" | ||
-}} | ||
{{- range $index, $crd := $crds -}} | ||
{{- $obj := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" .Release.Namespace (print $crd ".elemental.cattle.io") -}} | ||
{{- if and $obj $obj.metadata.deletionTimestamp -}} | ||
{{- required "CRDs from previous installations are pending to be removed (deletionTimestamp is set). Fully deleting them before (re-)installing is required" "" -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters