# Define the RBAC rules ( ClusterRoles / 
# Define the Service Account
# Launch the maya-apiserver ( deployment )
# Launch the maya-storagemanager ( deameon set)

# Define the Service Account
# Define the RBAC rules for the Service Account
# Launch the maya-apiserver ( deployment )
# Launch the maya-storagemanager ( deameon set )

# Create Maya Service Account 
apiVersion: v1
kind: ServiceAccount
metadata:
  name: openebs-maya-operator
  namespace: default
---
# Define Role that allows operations on K8s pods/deployments
#  in "default" namespace
# TODO : change to new namespace, for isolated data network
# TODO : the rules should be updated with required group/resources/verb
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  namespace: default
  name: openebs-maya-operator
rules:
- apiGroups: ["*"]
  resources: ["services","pods","deployments"]
  verbs: ["*"]
---
# Bind the Service Account with the Role Privileges.
# TODO: Check if default account also needs to be there
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: openebs-maya-operator
  namespace: default
subjects:
- kind: ServiceAccount
  name: openebs-maya-operator
  namespace: default
- kind: User
  name: system:serviceaccount:default:default
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: ClusterRole
  name: openebs-maya-operator
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: maya-apiserver
  namespace: default
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: maya-apiserver
    spec:
      serviceAccountName: openebs-maya-operator
      containers:
      - name: maya-apiserver
        image: openebs/m-apiserver:ci
        ports:
        - containerPort: 5656


Update with RBAC rules for maya-apiserver
Update with RBAC rules for maya-apiserver
