helm: recreate sc with helm upgrades

during upgrade there can be change in sc paramaters,
as storageclass are immutable, we need to recreate them

closes: https://github.com/rook/rook/issues/16362
Signed-off-by: parth-gr <partharora1010@gmail.com>
This commit is contained in:
parth-gr
2025-08-29 14:30:46 +05:30
parent 650a1f0127
commit c8003bfef7
5 changed files with 19 additions and 1 deletions
@@ -19,6 +19,9 @@ metadata:
{{ toYaml $blockpool.storageClass.labels | indent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
storageclass.kubernetes.io/is-default-class: "{{ if default false $blockpool.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $blockpool.storageClass.annotations }}
{{ toYaml $blockpool.storageClass.annotations | indent 4 }}
@@ -27,6 +27,9 @@ metadata:
{{ toYaml $ecblockpool.storageClass.labels | indent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
storageclass.kubernetes.io/is-default-class: "{{ if default false $ecblockpool.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $ecblockpool.storageClass.annotations }}
{{ toYaml $ecblockpool.storageClass.annotations | indent 4 }}
@@ -38,6 +38,9 @@ metadata:
{{ toYaml $filesystem.storageClass.labels | indent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
storageclass.kubernetes.io/is-default-class: "{{ if default false $filesystem.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $filesystem.storageClass.annotations }}
{{ toYaml $filesystem.storageClass.annotations | indent 4 }}
@@ -18,8 +18,11 @@ metadata:
labels:
{{ toYaml $objectstore.storageClass.labels | indent 4 }}
{{- end }}
{{- if $objectstore.storageClass.annotations }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
{{- if $objectstore.storageClass.annotations }}
{{ toYaml $objectstore.storageClass.annotations | indent 4 }}
{{- end }}
provisioner: {{ $root.Release.Namespace }}.ceph.rook.io/bucket
@@ -13,6 +13,9 @@ metadata:
{{ toYaml $filesystemvsc.labels | indent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
snapshot.storage.kubernetes.io/is-default-class: "{{ if default false $filesystemvsc.isDefault }}true{{ else }}false{{ end }}"
{{- if $filesystemvsc.annotations }}
{{ toYaml $filesystemvsc.annotations | indent 4 }}
@@ -43,6 +46,9 @@ metadata:
{{ toYaml $blockpoolvsc.labels | indent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/resource-policy": keep
snapshot.storage.kubernetes.io/is-default-class: "{{ if default false $blockpoolvsc.isDefault }}true{{ else }}false{{ end }}"
{{- if $blockpoolvsc.annotations }}
{{ toYaml $blockpoolvsc.annotations | indent 4 }}