Skip to content

Commit

Permalink
Templatize hook types and deletion policy
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasdinov committed Dec 13, 2023
1 parent 4d3c934 commit 392c7ef
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 72 deletions.
Binary file modified assets/kubevirt/kubevirt-0.2.0.tgz
Binary file not shown.
16 changes: 8 additions & 8 deletions charts/kubevirt/0.2.0/templates/crd-uninstall-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
rules:
- apiGroups: [ "apiextensions.k8s.io" ]
Expand All @@ -28,8 +28,8 @@ kind: ClusterRoleBinding
metadata:
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
Expand All @@ -46,8 +46,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
spec:
template:
Expand Down
20 changes: 10 additions & 10 deletions charts/kubevirt/0.2.0/templates/crd-upgrade-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: kubevirt-crd-manifest
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
data:
crd: |-
Expand All @@ -17,17 +17,17 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
rules:
- apiGroups: [ "" ]
Expand All @@ -46,8 +46,8 @@ kind: ClusterRoleBinding
metadata:
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
subjects:
- kind: ServiceAccount
Expand All @@ -64,8 +64,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "4"
spec:
template:
Expand Down
16 changes: 8 additions & 8 deletions charts/kubevirt/0.2.0/templates/kubevirt-uninstall-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -14,8 +14,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
rules:
- apiGroups: [ "kubevirt.io" ]
Expand All @@ -30,8 +30,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
Expand All @@ -48,8 +48,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
spec:
template:
Expand Down
16 changes: 8 additions & 8 deletions charts/kubevirt/0.2.0/templates/namespace-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.namespaceHook }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.namespaceHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.namespaceHook }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.namespaceHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
rules:
- apiGroups: [ "" ]
Expand All @@ -31,8 +31,8 @@ kind: ClusterRoleBinding
metadata:
name: {{ .Values.namespaceHook }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.namespaceHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
Expand All @@ -49,8 +49,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.namespaceHook }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.namespaceHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
spec:
template:
Expand Down
10 changes: 9 additions & 1 deletion charts/kubevirt/0.2.0/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ securityContext:
- ALL

namespaceHook: kubevirt-namespace-modify
namespaceHookType: pre-install

crdUpgradeHook: kubevirt-crd-upgrade
crdUninstallHook: kubevirt-crd-uninstall
crdUpgradeHookType: pre-upgrade

crUninstallHook: kubevirt-uninstall
crUninstallHookType: pre-delete

crdUninstallHook: kubevirt-crd-uninstall
crdUninstallHookType: post-delete

hookImage: bitnami/kubectl:1.27.3
hookRestartPolicy: OnFailure
hookDeletePolicy: before-hook-creation,hook-succeeded
4 changes: 2 additions & 2 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ entries:
kubevirt:
- apiVersion: v2
appVersion: 1.1.0
created: "2023-12-13T14:48:49.169906+02:00"
created: "2023-12-13T16:04:27.172174+02:00"
description: A Helm chart for KubeVirt
digest: e1ad5ef42c6b24a440e64b0f88477a9d3c134403e8ab12f1e89c2e2acda3c269
digest: 45ae9cd67bbe8b792b3754e3bdda591ac99ad37603308ce21cc1b23cce8b0a3f
icon: https://raw.githubusercontent.com/cncf/artwork/main/projects/kubevirt/icon/color/kubevirt-icon-color.svg
name: kubevirt
type: application
Expand Down
16 changes: 8 additions & 8 deletions packages/kubevirt/charts/templates/crd-uninstall-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
rules:
- apiGroups: [ "apiextensions.k8s.io" ]
Expand All @@ -28,8 +28,8 @@ kind: ClusterRoleBinding
metadata:
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
Expand All @@ -46,8 +46,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUninstallHook }}
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
spec:
template:
Expand Down
20 changes: 10 additions & 10 deletions packages/kubevirt/charts/templates/crd-upgrade-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: kubevirt-crd-manifest
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
data:
crd: |-
Expand All @@ -17,17 +17,17 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
rules:
- apiGroups: [ "" ]
Expand All @@ -46,8 +46,8 @@ kind: ClusterRoleBinding
metadata:
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
subjects:
- kind: ServiceAccount
Expand All @@ -64,8 +64,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crdUpgradeHook }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crdUpgradeHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "4"
spec:
template:
Expand Down
16 changes: 8 additions & 8 deletions packages/kubevirt/charts/templates/kubevirt-uninstall-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -14,8 +14,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "1"
rules:
- apiGroups: [ "kubevirt.io" ]
Expand All @@ -30,8 +30,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "2"
subjects:
- kind: ServiceAccount
Expand All @@ -48,8 +48,8 @@ metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.crUninstallHook }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook": {{ .Values.crUninstallHookType }}
"helm.sh/hook-delete-policy": {{ .Values.hookDeletePolicy }}
"helm.sh/hook-weight": "3"
spec:
template:
Expand Down
Loading

0 comments on commit 392c7ef

Please sign in to comment.