---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: api-emmental
  namespace: emmental-platform
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: challenge-instance-controller
rules:
  - apiGroups: ["", "apps", "networking.k8s.io", "extensions"] # "" indicates the core API group
    resources: ["services", "deployments", "configmaps", "pods", "networkpolicies"]
    verbs: ["create", "patch", "read", "get", "list", "delete", "deletecollection"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: emmental-api-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: challenge-instance-controller
subjects:
  - kind: ServiceAccount
    name: api-emmental
    namespace: emmental-platform
