apiVersion: apps/v1
kind: Deployment
metadata:
  name: percona-server-mongodb-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: percona-server-mongodb-operator
  template:
    metadata:
      labels:
        name: percona-server-mongodb-operator
    spec:
      serviceAccountName: percona-server-mongodb-operator
      containers:
        - name: percona-server-mongodb-operator
          image: percona/percona-server-mongodb-operator:1.6.0
          ports:
          - containerPort: 60000
            name: metrics
          command:
          - percona-server-mongodb-operator
          imagePullPolicy: Always
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: OPERATOR_NAME
              value: percona-server-mongodb-operator
            - name: RESYNC_PERIOD
              value: 5s
            - name: LOG_VERBOSE
              value: "false"
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: percona-server-mongodb-operator
rules:
- apiGroups:
  - psmdb.percona.com
  resources:
  - perconaservermongodbs
  - perconaservermongodbs/status
  - perconaservermongodbbackups
  - perconaservermongodbbackups/status
  - perconaservermongodbrestores
  - perconaservermongodbrestores/status
  verbs:
  - get
  - list
  - update
  - watch
  - create
- apiGroups:
  - ""
  resources:
  - pods
  - pods/exec
  - services
  - persistentvolumeclaims
  - secrets
  - configmaps
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - apps
  resources:
  - deployments
  - replicasets
  - statefulsets
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - batch
  resources:
  - cronjobs
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - policy
  resources:
  - poddisruptionbudgets
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - certmanager.k8s.io
  - cert-manager.io
  resources:
  - issuers
  - certificates
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
  - deletecollection
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: percona-server-mongodb-operator
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: service-account-percona-server-mongodb-operator
subjects:
- kind: ServiceAccount
  name: percona-server-mongodb-operator
roleRef:
  kind: Role
  name: percona-server-mongodb-operator
  apiGroup: rbac.authorization.k8s.io

