Skip to content

Instantly share code, notes, and snippets.

@mmontes11
Last active July 31, 2021 11:20
Show Gist options
  • Save mmontes11/6a22055148b0507cccf85b9a2f378604 to your computer and use it in GitHub Desktop.
Save mmontes11/6a22055148b0507cccf85b9a2f378604 to your computer and use it in GitHub Desktop.
Operator RBAC
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "echoperator.fullname" . }}
labels:
{{- include "echoperator.labels" . | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "echoperator.fullname" . }}
labels:
{{ include "echoperator.labels" . | nindent 4 }}
rules:
- apiGroups:
- mmontes.io
resources:
- echos
- scheduledechos
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- jobs
verbs:
- get
- list
- watch
- create
- apiGroups:
- batch
resources:
- cronjobs
verbs:
- get
- list
- watch
- create
- update
{{ if .Values.ha.enabled }}
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- watch
- create
- update
{{ end }}
---
{{ $fullName := include "echoperator.fullname" . }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $fullName }}
labels:
{{ include "echoperator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $fullName }}
subjects:
- kind: ServiceAccount
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment