Skip to content

Commit

Permalink
Use non-default namespace for KubeVirt chart hooks (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasdinov authored Dec 6, 2023
1 parent 0d71fa7 commit 9bc9f5b
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 34 deletions.
Binary file modified assets/kubevirt/kubevirt-0.2.0.tgz
Binary file not shown.
23 changes: 16 additions & 7 deletions charts/kubevirt/0.2.0/templates/kubevirt-crd-uninstall.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
apiVersion: v1
kind: Namespace
metadata:
name: kubevirt-crd-uninstall
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: default
namespace: kubevirt-crd-uninstall
name: kubevirt-crd-uninstaller
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
"helm.sh/hook-weight": "2"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -15,7 +24,7 @@ metadata:
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
"helm.sh/hook-weight": "2"
rules:
- apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
Expand All @@ -30,10 +39,10 @@ metadata:
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "2"
"helm.sh/hook-weight": "3"
subjects:
- kind: ServiceAccount
namespace: default
namespace: kubevirt-crd-uninstall
name: kubevirt-crd-uninstaller
roleRef:
kind: ClusterRole
Expand All @@ -43,12 +52,12 @@ roleRef:
apiVersion: batch/v1
kind: Job
metadata:
namespace: default
namespace: kubevirt-crd-uninstall
name: kubevirt-crd-uninstaller
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "3"
"helm.sh/hook-weight": "4"
spec:
template:
metadata:
Expand Down
27 changes: 18 additions & 9 deletions charts/kubevirt/0.2.0/templates/kubevirt-crd-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
apiVersion: v1
kind: Namespace
metadata:
name: kubevirt-crd-upgrade
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-manifest
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
"helm.sh/hook-weight": "2"
data:
crd: |-
{{ $.Files.Get "crds/kubevirt.yaml" | nindent 4 }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-upgrader
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "2"
"helm.sh/hook-weight": "3"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -28,7 +37,7 @@ metadata:
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "2"
"helm.sh/hook-weight": "3"
rules:
- apiGroups: [ "" ]
resources: [ "configmaps" ]
Expand All @@ -48,10 +57,10 @@ metadata:
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "3"
"helm.sh/hook-weight": "4"
subjects:
- kind: ServiceAccount
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-upgrader
roleRef:
kind: ClusterRole
Expand All @@ -61,12 +70,12 @@ roleRef:
apiVersion: batch/v1
kind: Job
metadata:
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-upgrader
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "4"
"helm.sh/hook-weight": "5"
spec:
template:
metadata:
Expand Down
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-05T15:31:08.609981+02:00"
created: "2023-12-06T13:39:17.572304+02:00"
description: A Helm chart for KubeVirt
digest: 2441f1d2f3f835a8483f682ab49ceaa5a8fa4e8ea8a801d840ffd6fdb541ffe7
digest: c62cb510a7302f5f392860c9591fb02256e161fcac65b87898ed711f03cd30bd
icon: https://raw.githubusercontent.com/cncf/artwork/main/projects/kubevirt/icon/color/kubevirt-icon-color.svg
name: kubevirt
type: application
Expand Down
23 changes: 16 additions & 7 deletions packages/kubevirt/charts/templates/kubevirt-crd-uninstall.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
apiVersion: v1
kind: Namespace
metadata:
name: kubevirt-crd-uninstall
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: default
namespace: kubevirt-crd-uninstall
name: kubevirt-crd-uninstaller
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
"helm.sh/hook-weight": "2"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -15,7 +24,7 @@ metadata:
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
"helm.sh/hook-weight": "2"
rules:
- apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
Expand All @@ -30,10 +39,10 @@ metadata:
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "2"
"helm.sh/hook-weight": "3"
subjects:
- kind: ServiceAccount
namespace: default
namespace: kubevirt-crd-uninstall
name: kubevirt-crd-uninstaller
roleRef:
kind: ClusterRole
Expand All @@ -43,12 +52,12 @@ roleRef:
apiVersion: batch/v1
kind: Job
metadata:
namespace: default
namespace: kubevirt-crd-uninstall
name: kubevirt-crd-uninstaller
annotations:
"helm.sh/hook": post-delete
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "3"
"helm.sh/hook-weight": "4"
spec:
template:
metadata:
Expand Down
27 changes: 18 additions & 9 deletions packages/kubevirt/charts/templates/kubevirt-crd-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
apiVersion: v1
kind: Namespace
metadata:
name: kubevirt-crd-upgrade
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-manifest
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "1"
"helm.sh/hook-weight": "2"
data:
crd: |-
{{ $.Files.Get "crds/kubevirt.yaml" | nindent 4 }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-upgrader
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "2"
"helm.sh/hook-weight": "3"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -28,7 +37,7 @@ metadata:
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "2"
"helm.sh/hook-weight": "3"
rules:
- apiGroups: [ "" ]
resources: [ "configmaps" ]
Expand All @@ -48,10 +57,10 @@ metadata:
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "3"
"helm.sh/hook-weight": "4"
subjects:
- kind: ServiceAccount
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-upgrader
roleRef:
kind: ClusterRole
Expand All @@ -61,12 +70,12 @@ roleRef:
apiVersion: batch/v1
kind: Job
metadata:
namespace: default
namespace: kubevirt-crd-upgrade
name: kubevirt-crd-upgrader
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
"helm.sh/hook-weight": "4"
"helm.sh/hook-weight": "5"
spec:
template:
metadata:
Expand Down

0 comments on commit 9bc9f5b

Please sign in to comment.