--- apiVersion: v1 kind: ServiceAccount metadata: name: {{ .Values.database.name }} namespace: {{ if .Values.database.namespace }} {{ .Values.database.namespace }} {{ else }} {{ .Release.Namespace }} {{ end }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ .Values.database.name }} namespace: {{ if .Values.database.namespace }} {{ .Values.database.namespace }} {{ else }} {{ .Release.Namespace }} {{ end }} rules: - apiGroups: - "" resources: - secrets verbs: - get - apiGroups: - "" resources: - pods verbs: - patch - delete - get --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ .Values.database.name }} namespace: {{ if .Values.database.namespace }} {{ .Values.database.namespace }} {{ else }} {{ .Release.Namespace }} {{ end }} subjects: - kind: ServiceAccount name: {{ .Values.database.name }} roleRef: kind: Role name: {{ .Values.database.name }} apiGroup: rbac.authorization.k8s.io