Fix Missing Role, RoleBinding, and ServiceAccount for Custom Cert Mode in Helm Chart

Signed-off-by: wei-chenglai <qazwsx0939059006@gmail.com>
This commit is contained in:
wei-chenglai 2025-03-06 23:07:05 -05:00
parent 824bd8d3e0
commit b9256e85f1
1 changed files with 52 additions and 51 deletions

View File

@ -182,6 +182,58 @@ data:
{{- $.Files.Get $path | nindent 8 }}
{{ end }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $name }}-hook-job
namespace: {{ $namespace }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $name }}-hook-job
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
rules:
- apiGroups: ['*']
resources: ['*']
verbs: ["get", "watch", "list", "create", "update", "patch", "delete"]
- nonResourceURLs: ['*']
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $name }}-hook-job
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $name }}-hook-job
subjects:
- kind: ServiceAccount
name: {{ $name }}-hook-job
namespace: {{ $namespace }}
{{- if eq .Values.certs.mode "custom" }}
---
apiVersion: v1
@ -446,56 +498,5 @@ spec:
- name: configs
emptyDir: {}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $name }}-hook-job
namespace: {{ $namespace }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $name }}-hook-job
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
rules:
- apiGroups: ['*']
resources: ['*']
verbs: ["get", "watch", "list", "create", "update", "patch", "delete"]
- nonResourceURLs: ['*']
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $name }}-hook-job
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $name }}-hook-job
subjects:
- kind: ServiceAccount
name: {{ $name }}-hook-job
namespace: {{ $namespace }}
---
{{- end }}
{{- end }}