|
| 1 | +# yaml-language-server: $schema=../schemas/mongodb-kubernetes-operator/master/mongodbcommunity.mongodbcommunity.mongodb.com-v1.json |
| 2 | +apiVersion: mongodbcommunity.mongodb.com/v1 |
| 3 | +kind: MongoDBCommunity |
| 4 | +metadata: |
| 5 | + name: mongodb |
| 6 | +spec: |
| 7 | + members: 2 |
| 8 | + arbiters: 1 |
| 9 | + type: ReplicaSet |
| 10 | + version: "5.0.3" |
| 11 | + security: |
| 12 | + authentication: |
| 13 | + modes: |
| 14 | + - SCRAM |
| 15 | + users: |
| 16 | + - name: koa |
| 17 | + db: admin |
| 18 | + passwordSecretRef: |
| 19 | + name: env |
| 20 | + key: MONGO_PW |
| 21 | + roles: |
| 22 | + - name: clusterAdmin |
| 23 | + db: admin |
| 24 | + - name: dbAdminAnyDatabase |
| 25 | + db: admin |
| 26 | + - name: dbOwner |
| 27 | + db: admin |
| 28 | + - name: readWriteAnyDatabase |
| 29 | + db: admin |
| 30 | + scramCredentialsSecretName: mongodb-scram |
| 31 | + statefulSet: |
| 32 | + spec: |
| 33 | + template: |
| 34 | + metadata: |
| 35 | + labels: |
| 36 | + environment: production |
| 37 | + spec: |
| 38 | + affinity: |
| 39 | + podAntiAffinity: |
| 40 | + # read: A pod should not be scheduled on the node if a pod with |
| 41 | + # the label environment=production is already running on it. |
| 42 | + preferredDuringSchedulingIgnoredDuringExecution: |
| 43 | + - weight: 100 |
| 44 | + podAffinityTerm: |
| 45 | + labelSelector: |
| 46 | + matchExpressions: |
| 47 | + - key: environment |
| 48 | + operator: In |
| 49 | + values: |
| 50 | + - production |
| 51 | + topologyKey: kubernetes.io/hostname |
| 52 | + containers: |
| 53 | + - name: mongod |
| 54 | + resources: |
| 55 | + limits: |
| 56 | + cpu: 600m |
| 57 | + memory: 500M |
| 58 | + requests: |
| 59 | + cpu: 200m |
| 60 | + memory: 200M |
| 61 | + - name: mongodb-agent |
| 62 | + resources: |
| 63 | + limits: |
| 64 | + cpu: 500m |
| 65 | + memory: 250M |
| 66 | + requests: |
| 67 | + cpu: 100m |
| 68 | + memory: 100M |
| 69 | +--- |
| 70 | + |
| 71 | +# These resources are from the mongodb-kubernetes-operator repository |
| 72 | +apiVersion: v1 |
| 73 | +kind: ServiceAccount |
| 74 | +metadata: |
| 75 | + name: mongodb-kubernetes-operator |
| 76 | +--- |
| 77 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 78 | +kind: Role |
| 79 | +metadata: |
| 80 | + name: mongodb-kubernetes-operator |
| 81 | +rules: |
| 82 | +- apiGroups: [""] |
| 83 | + verbs: ["create", "delete", "get", "list", "patch", "update", "watch"] |
| 84 | + resources: ["pods", "services", "configmaps", "secrets"] |
| 85 | + |
| 86 | +- apiGroups: ["apps"] |
| 87 | + verbs: ["create", "delete", "get", "list", "patch", "update", "watch"] |
| 88 | + resources: ["statefulsets"] |
| 89 | + |
| 90 | +- apiGroups: ["mongodbcommunity.mongodb.com"] |
| 91 | + verbs: ["get", "patch", "list", "update", "watch"] |
| 92 | + resources: |
| 93 | + - mongodbcommunity |
| 94 | + - mongodbcommunity/status |
| 95 | + - mongodbcommunity/spec |
| 96 | + - mongodbcommunity/finalizers |
| 97 | +--- |
| 98 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 99 | +kind: RoleBinding |
| 100 | +metadata: |
| 101 | + name: mongodb-kubernetes-operator |
| 102 | +roleRef: |
| 103 | + apiGroup: rbac.authorization.k8s.io |
| 104 | + kind: Role |
| 105 | + name: mongodb-kubernetes-operator |
| 106 | +subjects: |
| 107 | +- kind: ServiceAccount |
| 108 | + name: mongodb-kubernetes-operator |
0 commit comments