From 295986ddf563f528d89554712b10979f5674f06b Mon Sep 17 00:00:00 2001 From: Koen de Laat Date: Thu, 17 Oct 2024 18:05:26 +0200 Subject: [PATCH] Add ability to enable/disable hooks Signed-off-by: Koen de Laat --- packages/kubevirt/charts/Chart.yaml | 2 +- .../kubevirt/charts/templates/crd-uninstall-hooks.yaml | 2 ++ packages/kubevirt/charts/templates/crd-upgrade-hooks.yaml | 2 ++ .../charts/templates/kubevirt-uninstall-hooks.yaml | 2 ++ packages/kubevirt/charts/templates/namespace-hooks.yaml | 2 ++ packages/kubevirt/charts/values.yaml | 7 +++++++ packages/kubevirt/package.yaml | 2 +- 7 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/kubevirt/charts/Chart.yaml b/packages/kubevirt/charts/Chart.yaml index 7350cb0c..a507d719 100644 --- a/packages/kubevirt/charts/Chart.yaml +++ b/packages/kubevirt/charts/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for KubeVirt icon: https://raw.githubusercontent.com/cncf/artwork/main/projects/kubevirt/icon/color/kubevirt-icon-color.svg name: kubevirt type: application -version: 0.4.0 +version: 0.4.1 diff --git a/packages/kubevirt/charts/templates/crd-uninstall-hooks.yaml b/packages/kubevirt/charts/templates/crd-uninstall-hooks.yaml index 2480b377..fed020d3 100644 --- a/packages/kubevirt/charts/templates/crd-uninstall-hooks.yaml +++ b/packages/kubevirt/charts/templates/crd-uninstall-hooks.yaml @@ -1,3 +1,4 @@ +{{- if .Values.hooksEnabled.crd.uninstall }} apiVersion: v1 kind: ServiceAccount metadata: @@ -53,3 +54,4 @@ spec: - kubevirts.kubevirt.io securityContext: {{- toYaml .Values.hookSecurityContext | nindent 12 }} +{{- end }} \ No newline at end of file diff --git a/packages/kubevirt/charts/templates/crd-upgrade-hooks.yaml b/packages/kubevirt/charts/templates/crd-upgrade-hooks.yaml index dab97791..f911e064 100644 --- a/packages/kubevirt/charts/templates/crd-upgrade-hooks.yaml +++ b/packages/kubevirt/charts/templates/crd-upgrade-hooks.yaml @@ -1,3 +1,4 @@ +{{- if .Values.hooksEnabled.crd.upgrade }} apiVersion: v1 kind: ConfigMap metadata: @@ -78,3 +79,4 @@ spec: items: - key: crd path: crd.yaml +{{- end }} \ No newline at end of file diff --git a/packages/kubevirt/charts/templates/kubevirt-uninstall-hooks.yaml b/packages/kubevirt/charts/templates/kubevirt-uninstall-hooks.yaml index 1e2ea4ff..672699ac 100644 --- a/packages/kubevirt/charts/templates/kubevirt-uninstall-hooks.yaml +++ b/packages/kubevirt/charts/templates/kubevirt-uninstall-hooks.yaml @@ -1,3 +1,4 @@ +{{- if .Values.hooksEnabled.kubevirt.uninstall }} apiVersion: v1 kind: ServiceAccount metadata: @@ -69,3 +70,4 @@ spec: - deployments/virt-controller - daemonsets/virt-handler - --timeout=60s + {{- end }} \ No newline at end of file diff --git a/packages/kubevirt/charts/templates/namespace-hooks.yaml b/packages/kubevirt/charts/templates/namespace-hooks.yaml index 2fc43180..6f8eb4ec 100644 --- a/packages/kubevirt/charts/templates/namespace-hooks.yaml +++ b/packages/kubevirt/charts/templates/namespace-hooks.yaml @@ -1,3 +1,4 @@ +{{- if .Values.hooksEnabled.namespace }} apiVersion: v1 kind: ServiceAccount metadata: @@ -58,3 +59,4 @@ spec: - {{ .Release.Namespace }} - kubevirt.io= - pod-security.kubernetes.io/enforce=privileged + {{- end }} \ No newline at end of file diff --git a/packages/kubevirt/charts/values.yaml b/packages/kubevirt/charts/values.yaml index c0fb78c7..2bfcc405 100644 --- a/packages/kubevirt/charts/values.yaml +++ b/packages/kubevirt/charts/values.yaml @@ -21,6 +21,13 @@ kubevirt: monitorAccount: "" monitorNamespace: "" +hooksEnabled: + crd: + upgrade: true + uninstall: true + kubevirt: + uninstall: true + namespace: true hookImage: rancher/kubectl:v1.30.2 hookRestartPolicy: OnFailure hookSecurityContext: diff --git a/packages/kubevirt/package.yaml b/packages/kubevirt/package.yaml index 57030180..7d402674 100644 --- a/packages/kubevirt/package.yaml +++ b/packages/kubevirt/package.yaml @@ -1,2 +1,2 @@ url: local -version: 0.4.0 +version: 0.4.1