Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

RBAC template updates #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions mysql-operator/templates/02-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: mysql-operator
namespace: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}mysql-operator{{ else }}{{ .Values.operator.namespace}}{{ end }}
namespace: {{ .Values.operator.namespace }}

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: mysql-agent
namespace: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}default{{ else }}{{ .Values.operator.namespace}}{{ end }}
namespace: {{ .Values.operator.namespace }}

---
{{- if .Values.rbac.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}Role
metadata:
name: mysql-operator{{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}{{ else}}
namespace: {{ .Values.operator.namespace}}{{ end }}
name: mysql-operator{{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}{{ else }}
namespace: {{ .Values.operator.namespace }}{{ end }}
rules:
- apiGroups: [""]
resources: ["pods"]
Expand All @@ -34,7 +34,7 @@ rules:
verbs:
{{- if hasPrefix "0.1" .Values.image.tag }}
- get
{{- end}}
{{- end }}
- create

- apiGroups: [""]
Expand Down Expand Up @@ -88,7 +88,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}Role
metadata:
name: mysql-agent{{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}{{ else}}
name: mysql-agent{{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}{{ else }}
namespace: {{ .Values.operator.namespace}}{{ end }}
rules:
- apiGroups: [""]
Expand Down Expand Up @@ -127,13 +127,13 @@ rules:

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}RoleBinding
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}RoleBinding
metadata:
name: mysql-operator
namespace: {{ .Values.operator.namespace}}
name: mysql-operator{{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}{{ else }}
namespace: {{ .Values.operator.namespace }}{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}Role
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}Role
name: mysql-operator
subjects:
- kind: ServiceAccount
Expand All @@ -142,13 +142,13 @@ subjects:

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}RoleBinding
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}RoleBinding
metadata:
name: mysql-agent
namespace: {{ .Values.operator.namespace}}
name: mysql-agent{{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}{{ else }}
namespace: {{ .Values.operator.namespace }}{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}Role
kind: {{ if and (.Values.operator.global) (eq .Values.operator.namespace "mysql-operator") }}Cluster{{ end }}Role
name: mysql-agent
subjects:
- kind: ServiceAccount
Expand Down