Skip to content

Commit

Permalink
fix: chart changes for upgrade and uninstall
Browse files Browse the repository at this point in the history
This makes changes to the resource created by the hooks to fix issues
with upgrading and to make uninstall cleaner. Specifcally:

- Check if the namespace already exists
- Use the pre-delete hook to help uninstall the resources

Signed-off-by: Richard Case <[email protected]>
  • Loading branch information
richardcase committed Apr 2, 2024
1 parent 57c8ba6 commit 4dc2c0b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions charts/rancher-turtles/templates/core-provider.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{{- if index .Values "cluster-api-operator" "cluster-api" "enabled" }}
{{- $namespace := index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
{{- if not (lookup "v1" "Namespace" "" $namespace) }}
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook": "post-install, post-upgrade, pre-delete"
"helm.sh/hook-weight": "1"
name: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
{{- end }}
---
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
name: cluster-api
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook": "post-install, post-upgrade, pre-delete"
"helm.sh/hook-weight": "2"
spec:
name: cluster-api
Expand Down Expand Up @@ -45,7 +48,7 @@ metadata:
name: capi-additional-rbac-roles
namespace: {{ index .Values "cluster-api-operator" "cluster-api" "core" "namespace" }}
annotations:
"helm.sh/hook": "post-install, post-upgrade"
"helm.sh/hook": "post-install, post-upgrade, pre-delete"
"helm.sh/hook-weight": "2"
data:
manifests: |-
Expand Down

0 comments on commit 4dc2c0b

Please sign in to comment.