feat: add role and role binding

This commit is contained in:
Mohamad Khani 2024-12-09 01:26:00 +03:30
parent 204f25a6af
commit 96880f1886
2 changed files with 40 additions and 0 deletions

View File

@ -18,6 +18,8 @@ spec:
app.kubernetes.io/name: {{ .Release.Name }}-flink # Adding the flink prefix to the template labels app.kubernetes.io/name: {{ .Release.Name }}-flink # Adding the flink prefix to the template labels
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
serviceAccountName: {{ include "flink-kube-operator.serviceAccountName" . }}
containers: containers:
- name: flink - name: flink
image: {{ .Values.flink.image.repository }}:{{ .Values.flink.image.tag }} image: {{ .Values.flink.image.repository }}:{{ .Values.flink.image.tag }}

View File

@ -0,0 +1,38 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "flink-kube-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }} # Namespace where the role is created
labels:
{{- include "flink-kube-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
- flink.logicamp.tech # API group of the FlinkJob CRD
resources:
- flink-jobs # The plural name of your custom resource
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "flink-kube-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }} # Namespace where the RoleBinding is created
labels:
{{- include "flink-kube-operator.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "flink-kube-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }} # Ensure that the service account is in the same namespace
roleRef:
kind: Role
name: {{ include "flink-kube-operator.serviceAccountName" . }}
apiGroup: rbac.authorization.k8s.io