Skip to content

Commit

Permalink
fix: used dedicated clusterrole for kcore hooks (#1635)
Browse files Browse the repository at this point in the history
* fix: use dedicated clusterrole for kcore hooks

* chore: add missing kommandercores/status

* chore: add patch & update for post install job
  • Loading branch information
cwyl02 authored Oct 5, 2023
1 parent 3598079 commit 6d2c1f3
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ metadata:
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-installation
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
rules:
- apiGroups:
- dkp.d2iq.io
resources:
- kommandercores
verbs:
- get
- list
- watch
- create
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Chart.Name }}-installation
Expand All @@ -20,12 +41,11 @@ metadata:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
name: {{ .Chart.Name }}-installation
subjects:
- kind: ServiceAccount
name: {{ .Chart.Name }}-installation
namespace: {{ .Release.Namespace }}

---
apiVersion: v1
kind: ConfigMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,34 @@ metadata:
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-pre-upgrade
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
rules:
- apiGroups:
- dkp.d2iq.io
- helm.toolkit.fluxcd.io
resources:
- kommandercores
- helmreleases
verbs:
- get
- list
- watch
- apiGroups:
- dkp.d2iq.io
resources:
- kommandercores
- kommandercores/status
verbs:
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Chart.Name }}-pre-upgrade
Expand All @@ -21,7 +49,7 @@ metadata:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
name: {{ .Chart.Name }}-pre-upgrade
subjects:
- kind: ServiceAccount
name: {{ .Chart.Name }}-pre-upgrade
Expand Down

0 comments on commit 6d2c1f3

Please sign in to comment.