-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmongodb-nonha.yaml
211 lines (211 loc) · 6.58 KB
/
mongodb-nonha.yaml
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
201
202
203
204
205
206
207
208
209
210
211
---
apiVersion: v1
kind: Template
labels:
app: "${APP_NAME}-${INSTANCE}"
name: "${NAME}-${INSTANCE}"
template: "${NAME}-${INSTANCE}-template"
metadata:
annotations:
description: Deployment template for a mongodb server with persistent storage.
tags: "${NAME}-${INSTANCE}"
objects:
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: "${NAME}-${INSTANCE}"
generation: 1
spec:
strategy:
type: Recreate
recreateParams:
timeoutSeconds: 600
resources: {}
activeDeadlineSeconds: 21600
replicas: 1
test: false
selector:
name: "${NAME}-${INSTANCE}"
template:
metadata:
labels:
name: "${NAME}-${INSTANCE}"
app: "${APP_NAME}-${INSTANCE}"
role: "${ROLE}"
template: "${NAME}-${INSTANCE}"
spec:
volumes:
- name: "${NAME}-${INSTANCE}-data"
persistentVolumeClaim:
claimName: "${NAME}-${INSTANCE}"
containers:
- name: "${NAME}-${INSTANCE}"
image: "${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}"
ports:
- containerPort: 27017
protocol: TCP
env:
- name: MONGODB_USER
valueFrom:
secretKeyRef:
name: "${NAME}-${INSTANCE}-secret"
key: database-user
- name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: "${NAME}-${INSTANCE}-secret"
key: database-password
- name: MONGODB_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: "${NAME}-${INSTANCE}-secret"
key: admin-password
- name: MONGODB_DATABASE
value: "${MONGODB_DATABASE}"
resources:
requests:
cpu: "${CPU_REQUEST}"
memory: "${MEMORY_REQUEST}"
limits:
cpu: "${CPU_LIMIT}"
memory: "${MEMORY_LIMIT}"
volumeMounts:
- name: "${NAME}-${INSTANCE}-data"
mountPath: "${MOUNT_PATH}"
livenessProbe:
tcpSocket:
port: 27017
initialDelaySeconds: 30
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
exec:
command:
- "/bin/sh"
- "-i"
- "-c"
- timeout 1 mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval='quit();'
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
securityContext:
capabilities: {}
privileged: false
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
triggers:
- type: ConfigChange
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: "${NAME}-${INSTANCE}"
spec:
storageClassName: "${PERSISTENT_VOLUME_CLASS}"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${PERSISTENT_VOLUME_SIZE}"
- apiVersion: v1
kind: Service
metadata:
name: "${NAME}-${INSTANCE}"
spec:
ports:
- name: mongodb
protocol: TCP
port: 27017
targetPort: 27017
selector:
name: "${NAME}-${INSTANCE}"
type: ClusterIP
sessionAffinity: None
parameters:
- name: NAME
displayName: Name
description:
The name assigned to all of the OpenShift resources associated to the server instance.
required: true
value: mongodb-formio-core
- name: INSTANCE
description: The name of this instance of the application
displayName: Application Instance Name
required: true
value: dev
- name: APP_NAME
displayName: App Name
description: Used to group components together in the OpenShift console.
required: true
value: formio
- name: ROLE
displayName: Role
description:
The role of this service within the application - used for Network Policies
required: true
value: db
- name: IMAGE_REGISTRY
description: The target docker registry
displayName: Image Registry
required: true
value: registry.access.redhat.com
- name: IMAGE_NAMESPACE
description: The namespace where the mongodb image resides.
displayName: Image Namespace
required: true
value: rhscl
- name: IMAGE_NAME
description: The target mongodb image
displayName: Image Name
required: true
value: mongodb-36-rhel7
- name: MONGODB_DATABASE
displayName: MongoDB Database Name
description: The name of the MongoDB database.
required: true
value: app
- name: MOUNT_PATH
displayName: Mount Path
description: The path to mount the persistent volume.
required: true
value: "/var/lib/mongodb/data"
- name: PERSISTENT_VOLUME_SIZE
displayName: Persistent Volume Size
description: The size of the persistent volume , e.g. 512Mi, 1Gi, 2Gi.
required: true
value: 1Gi
- name: PERSISTENT_VOLUME_CLASS
displayName: Persistent Volume Class name
description:
The class of the volume; gluster-file, gluster-block, gluster-file-db,netapp-file-standard
required: false
value: netapp-file-standard
- name: CPU_REQUEST
displayName: Resources CPU Request
description: The resources CPU request (in cores) for this build.
required: true
value: 100m
- name: CPU_LIMIT
displayName: Resources CPU Limit
description: The resources CPU limit (in cores) for this build.
required: true
value: 750m
- name: MEMORY_REQUEST
displayName: Resources Memory Request
description: The resources Memory request (in Mi, Gi, etc) for this build.
required: true
value: 100Mi
- name: MEMORY_LIMIT
displayName: Resources Memory Limit
description: The resources Memory limit (in Mi, Gi, etc) for this build.
required: true
value: 256Mi