apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: lifecycle-operator-role
  namespace: {{ .Release.Namespace | quote }}
  {{- $annotations := include "common.annotations" (dict "context" .) }}
  {{- with $annotations }}
  annotations: {{- . -}}
  {{- end }}
  labels:
{{- include "common.labels.standard" ( dict "context" . ) | nindent 4 }}
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - create
  - get
  - list
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - deployments
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
  - patch
  - watch
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
  - list
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - get
- apiGroups:
  - apps
  resources:
  - daemonsets
  - deployments
  - replicasets
  - statefulsets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - argoproj.io
  resources:
  - rollouts
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - batch
  resources:
  - jobs
  verbs:
  - create
  - get
  - list
  - update
  - watch
- apiGroups:
  - batch
  resources:
  - jobs/status
  verbs:
  - get
  - list
- apiGroups:
  - lifecycle.keptn.sh
  resources:
  - keptnappcontexts
  - keptnevaluationdefinitions
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - lifecycle.keptn.sh
  resources:
  - keptnappcreationrequests
  - keptnapps
  - keptnappversion
  - keptnappversions
  - keptnevaluations
  - keptntaskdefinitions
  - keptntasks
  - keptnworkloads
  - keptnworkloadversions
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - lifecycle.keptn.sh
  resources:
  - keptnappcreationrequests/finalizers
  - keptnapps/finalizers
  - keptnappversion/finalizers
  - keptnappversions/finalizers
  - keptnevaluations/finalizers
  - keptntaskdefinitions/finalizers
  - keptntasks/finalizers
  - keptnworkloads/finalizers
  - keptnworkloadversions/finalizers
  verbs:
  - update
- apiGroups:
  - lifecycle.keptn.sh
  resources:
  - keptnappcreationrequests/status
  - keptnapps/status
  - keptnappversion/status
  - keptnappversions/status
  - keptnevaluations/status
  - keptntaskdefinitions/status
  - keptntasks/status
  - keptnworkloads/status
  - keptnworkloadversions/status
  verbs:
  - get
  - patch
  - update
- apiGroups:
  - metrics.keptn.sh
  resources:
  - keptnmetrics
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - options.keptn.sh
  resources:
  - keptnconfigs
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - options.keptn.sh
  resources:
  - keptnconfigs/status
  verbs:
  - get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: lifecycle-operator-rolebinding
  namespace: {{ .Release.Namespace | quote }}
  {{- with $annotations }}
  annotations: {{- . -}}
  {{- end }}
  labels:
{{- include "common.labels.standard" ( dict "context" . ) | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: 'lifecycle-operator-role'
subjects:
- kind: ServiceAccount
  name: 'lifecycle-operator'
  namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: lifecycle-operator-rolebinding
  namespace: {{ .Release.Namespace | quote }}
  {{- with $annotations }}
  annotations: {{- . -}}
  {{- end }}
  labels:
{{- include "common.labels.standard" ( dict "context" . ) | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: 'lifecycle-operator-role'
subjects:
- kind: ServiceAccount
  name: 'lifecycle-operator'
  namespace: '{{ .Release.Namespace }}'