-
Notifications
You must be signed in to change notification settings - Fork 270
/
mongos.yml
200 lines (189 loc) · 6.2 KB
/
mongos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: mongodb-mongos-on-openshift
annotations:
openshift.io/display-name: "MongoDB Shard Router"
description: "MongoDB Shard Router on OpenShift"
iconClass: "icon-mongodb"
tags: "database,mongodb,nosql,mongos"
parameters:
- name: APP_NAME
displayName: "Application name"
value: "mongodb"
required: true
- name: MONGODB_ADMIN_PASSWORD
displayName: "MongoDB Admin Password"
description: "Password for the admin user."
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- name: MONGODB_KEYFILE_VALUE
displayName: "Keyfile Content"
description: "The value of the MongoDB keyfile for inter-cluster communication. Must be the same throughout the cluster. See (https://docs.mongodb.com/manual/core/security-internal-authentication/#internal-auth-keyfile)."
required: true
- name: CONFIG_REPLSET_NAME
displayName: "Config Server RS Name"
description: "Replica Set name for the configuration server"
value: 'cs0'
required: true
- name: CONFIG_REPLSET_SERVER
displayName: "Config Server URI"
description: "A URI for the configuration server"
value: 'mongodbconfigsvr-0.mongodb-configsvr-internal.myproject.svc.cluster.local:27017'
required: true
- name: REPLSET_NAMES
displayName: "Replica Set Names"
description: "The names of all the Replica Sets of each shard to cluster (Corresponds with order of REPLSET_SERVERS). Comma or newline delimited."
value: 'rs0'
required: true
- name: REPLSET_SERVERS
displayName: "Replica Set URIs"
description: "URIs of a Replica Set member from each shard to add to cluster (Corresponds with order of REPLSET_NAMES). Comma or newline delimited."
value: 'mongodbreplsetabc-0.mongodb-repset-internal-abc.myproject.svc.cluster.local:27017'
required: true
- name: MONGODB_IMAGE
displayName: "MongoDB Docker Image"
description: "A reference to a supported MongoDB Docker image."
value: "bornemannjs/mongodb-34:0.71"
required: true
- name: MEMORY_LIMIT
displayName: "Memory Limit"
description: "Maximum amount of memory the container can use."
value: "512Mi"
- name: ADDITIONAL_STARTUP_OPTS
displayName: "Additional Startup Opts"
description: "Additional configuraiton options when starting the shard router"
required: false
value: ""
objects:
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
generation: 1
labels:
app: "${APP_NAME}"
name: "${APP_NAME}-mongos"
spec:
replicas: 1
selector:
app: "${APP_NAME}"
deploymentconfig: "${APP_NAME}-mongos"
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
app: "${APP_NAME}"
deploymentconfig: "${APP_NAME}-mongos"
component: "mongos"
spec:
containers:
- name: mongos
resources:
limits:
memory: "${MEMORY_LIMIT}"
env:
- name: MONGODB_ADMIN_PASSWORD
value: ${MONGODB_ADMIN_PASSWORD}
- name: MONGODB_KEYFILE_VALUE
value: ${MONGODB_KEYFILE_VALUE}
- name: ENABLE_TLS
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: ssl.enabled
- name: SSL_CA_PATH
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: ssl.ca.path
- name: ADDITIONAL_SSL_OPTS
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: additional.ssl.opts
- name: CONFIG_REPLSET_NAME
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: config.rep.name
- name: CONFIG_REPLSET_SERVER
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: config.server
- name: REPLSET_NAMES
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: rep.names
- name: REPLSET_SERVERS
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: rep.servers
- name: ADDITIONAL_STARTUP_OPTS
valueFrom:
configMapKeyRef:
name: ${APP_NAME}-mongos-config
key: additional.startup.opts
args:
- run-mongos
image: "${MONGODB_IMAGE}"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 27017
protocol: TCP
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
livenessProbe:
initialDelaySeconds: 60
tcpSocket:
port: 27017
readinessProbe:
initialDelaySeconds: 10
exec:
command:
- "mongo-is-ready"
resources: {}
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
- apiVersion: v1
kind: Service
metadata:
name: "${APP_NAME}-mongos-ext"
spec:
ports:
- name: 27017-tcp
port: 27017
type: LoadBalancer
selector:
component: mongos
- kind: ConfigMap
apiVersion: v1
metadata:
name: "${APP_NAME}-mongos-config"
app: "${APP_NAME}"
data:
config.rep.name: ${CONFIG_REPLSET_NAME}
config.server: ${CONFIG_REPLSET_SERVER}
rep.names: ${REPLSET_NAMES}
rep.servers: ${REPLSET_SERVERS}
ssl.enabled: "false"
ssl.ca.path: ""
additional.ssl.opts: "--sslAllowConnectionsWithoutCertificates --sslDisabledProtocols TLS1_0,TLS1_1"
additional.startup.opts: "${ADDITIONAL_STARTUP_OPTS}"