---
apiVersion: v1
kind: Namespace
metadata:
  name: nats-io
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: nats-operator
  namespace: nats-io
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: nats-operator
  namespace: nats-io
spec:
  replicas: 1
  selector:
    matchLabels:
      name: nats-operator
  template:
    metadata:
      labels:
        name: nats-operator
    spec:
      serviceAccountName: nats-operator
      containers:
      - name: nats-operator
        image: connecteverything/nats-operator:0.2.0-v1alpha2
        imagePullPolicy: Always
        env:
        - name: MY_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: nats-io:nats-operator-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: nats-io:nats-operator
subjects:
- kind: ServiceAccount
  name: nats-operator
  namespace: nats-io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: nats-io:nats-operator
rules:
# Allow creating CRDs
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs: ["*"]
# Allow all actions on NatsClusters
- apiGroups:
  - nats.io
  resources:
  - natsclusters
  verbs: ["*"]
# Allow actions on basic Kubernetes objects
- apiGroups: [""]
  resources:
  - configmaps
  - secrets
  - pods
  - services
  - endpoints
  - events
  verbs: ["*"]

Add example RBAC policy to the repo
Add example RBAC policy to the repo
