Skip to content

Commit 2f12615

Browse files
authored
CLOUDP-176423 Added multi cluster kubectl example (#252)
1 parent 829ead6 commit 2f12615

File tree

1 file changed

+209
-0
lines changed

1 file changed

+209
-0
lines changed
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
---
2+
# Source: enterprise-operator/templates/database-roles.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: mongodb-enterprise-appdb
7+
namespace: mongodb
8+
---
9+
# Source: enterprise-operator/templates/database-roles.yaml
10+
apiVersion: v1
11+
kind: ServiceAccount
12+
metadata:
13+
name: mongodb-enterprise-database-pods
14+
namespace: mongodb
15+
---
16+
# Source: enterprise-operator/templates/database-roles.yaml
17+
apiVersion: v1
18+
kind: ServiceAccount
19+
metadata:
20+
name: mongodb-enterprise-ops-manager
21+
namespace: mongodb
22+
---
23+
# Source: enterprise-operator/templates/operator.yaml
24+
apiVersion: v1
25+
kind: ConfigMap
26+
data:
27+
MDB_CLUSTER_1_FULL_NAME: "${MDB_CLUSTER_1_FULL_NAME}"
28+
MDB_CLUSTER_2_FULL_NAME: "${MDB_CLUSTER_2_FULL_NAME}"
29+
MDB_CLUSTER_3_FULL_NAME: "${MDB_CLUSTER_3_FULL_NAME}"
30+
metadata:
31+
namespace: mongodb
32+
name: mongodb-enterprise-operator-member-list
33+
labels:
34+
multi-cluster: "true"
35+
---
36+
# Source: enterprise-operator/templates/operator-roles.yaml
37+
kind: ClusterRole
38+
apiVersion: rbac.authorization.k8s.io/v1
39+
metadata:
40+
name: mongodb-enterprise-operator-mongodb-webhook
41+
rules:
42+
- apiGroups:
43+
- "admissionregistration.k8s.io"
44+
resources:
45+
- validatingwebhookconfigurations
46+
verbs:
47+
- get
48+
- create
49+
- update
50+
- delete
51+
- apiGroups:
52+
- ""
53+
resources:
54+
- services
55+
verbs:
56+
- get
57+
- list
58+
- watch
59+
- create
60+
- update
61+
- delete
62+
---
63+
# Source: enterprise-operator/templates/operator-roles.yaml
64+
kind: ClusterRoleBinding
65+
apiVersion: rbac.authorization.k8s.io/v1
66+
metadata:
67+
name: mongodb-enterprise-operator-multi-cluster-mongodb-webhook-binding
68+
roleRef:
69+
apiGroup: rbac.authorization.k8s.io
70+
kind: ClusterRole
71+
name: mongodb-enterprise-operator-mongodb-webhook
72+
subjects:
73+
- kind: ServiceAccount
74+
name: mongodb-enterprise-operator-multi-cluster
75+
namespace: mongodb
76+
---
77+
# Source: enterprise-operator/templates/database-roles.yaml
78+
kind: Role
79+
apiVersion: rbac.authorization.k8s.io/v1
80+
metadata:
81+
name: mongodb-enterprise-appdb
82+
namespace: mongodb
83+
rules:
84+
- apiGroups:
85+
- ''
86+
resources:
87+
- secrets
88+
verbs:
89+
- get
90+
- apiGroups:
91+
- ''
92+
resources:
93+
- pods
94+
verbs:
95+
- patch
96+
- delete
97+
- get
98+
---
99+
# Source: enterprise-operator/templates/database-roles.yaml
100+
kind: RoleBinding
101+
apiVersion: rbac.authorization.k8s.io/v1
102+
metadata:
103+
name: mongodb-enterprise-appdb
104+
namespace: mongodb
105+
roleRef:
106+
apiGroup: rbac.authorization.k8s.io
107+
kind: Role
108+
name: mongodb-enterprise-appdb
109+
subjects:
110+
- kind: ServiceAccount
111+
name: mongodb-enterprise-appdb
112+
namespace: mongodb
113+
---
114+
# Source: enterprise-operator/templates/operator.yaml
115+
apiVersion: apps/v1
116+
kind: Deployment
117+
metadata:
118+
name: mongodb-enterprise-operator-multi-cluster
119+
namespace: mongodb
120+
spec:
121+
replicas: 1
122+
selector:
123+
matchLabels:
124+
app.kubernetes.io/component: controller
125+
app.kubernetes.io/name: mongodb-enterprise-operator-multi-cluster
126+
app.kubernetes.io/instance: mongodb-enterprise-operator-multi-cluster
127+
template:
128+
metadata:
129+
labels:
130+
app.kubernetes.io/component: controller
131+
app.kubernetes.io/name: mongodb-enterprise-operator-multi-cluster
132+
app.kubernetes.io/instance: mongodb-enterprise-operator-multi-cluster
133+
spec:
134+
serviceAccountName: mongodb-enterprise-operator-multi-cluster
135+
securityContext:
136+
runAsNonRoot: true
137+
runAsUser: 2000
138+
containers:
139+
- name: mongodb-enterprise-operator-multi-cluster
140+
image: "quay.io/mongodb/mongodb-enterprise-operator:1.19.1"
141+
imagePullPolicy: Always
142+
args:
143+
- -watch-resource=mongodb
144+
- -watch-resource=opsmanagers
145+
- -watch-resource=mongodbusers
146+
- -watch-resource=mongodbmulticluster
147+
command:
148+
- /usr/local/bin/mongodb-enterprise-operator
149+
volumeMounts:
150+
- mountPath: /etc/config/kubeconfig
151+
name: kube-config-volume
152+
resources:
153+
limits:
154+
cpu: 1100m
155+
memory: 1Gi
156+
requests:
157+
cpu: 500m
158+
memory: 200Mi
159+
env:
160+
- name: OPERATOR_ENV
161+
value: prod
162+
- name: WATCH_NAMESPACE
163+
valueFrom:
164+
fieldRef:
165+
fieldPath: metadata.namespace
166+
- name: CURRENT_NAMESPACE
167+
valueFrom:
168+
fieldRef:
169+
fieldPath: metadata.namespace
170+
- name: CLUSTER_CLIENT_TIMEOUT
171+
value: "10"
172+
- name: IMAGE_PULL_POLICY
173+
value: Always
174+
# Database
175+
- name: MONGODB_ENTERPRISE_DATABASE_IMAGE
176+
value: quay.io/mongodb/mongodb-enterprise-database-ubi
177+
- name: INIT_DATABASE_IMAGE_REPOSITORY
178+
value: quay.io/mongodb/mongodb-enterprise-init-database-ubi
179+
- name: INIT_DATABASE_VERSION
180+
value: 1.0.16
181+
- name: DATABASE_VERSION
182+
value: 2.0.2
183+
# Ops Manager
184+
- name: OPS_MANAGER_IMAGE_REPOSITORY
185+
value: quay.io/mongodb/mongodb-enterprise-ops-manager-ubi
186+
- name: INIT_OPS_MANAGER_IMAGE_REPOSITORY
187+
value: quay.io/mongodb/mongodb-enterprise-init-ops-manager-ubi
188+
- name: INIT_OPS_MANAGER_VERSION
189+
value: 1.0.10
190+
# AppDB
191+
- name: INIT_APPDB_IMAGE_REPOSITORY
192+
value: quay.io/mongodb/mongodb-enterprise-init-appdb-ubi
193+
- name: INIT_APPDB_VERSION
194+
value: 1.0.16
195+
- name: OPS_MANAGER_IMAGE_PULL_POLICY
196+
value: Always
197+
- name: AGENT_IMAGE
198+
value: "quay.io/mongodb/mongodb-agent-ubi:12.0.15.7646-1"
199+
- name: MONGODB_IMAGE
200+
value: mongodb-enterprise-appdb-database-ubi
201+
- name: MONGODB_REPO_URL
202+
value: quay.io/mongodb
203+
- name: PERFORM_FAILOVER
204+
value: 'true'
205+
volumes:
206+
- name: kube-config-volume
207+
secret:
208+
defaultMode: 420
209+
secretName: mongodb-enterprise-operator-multi-cluster-kubeconfig

0 commit comments

Comments
 (0)