7eb1dc8c7ee7713888ef615937b14fbe35e7d018
[osm/devops.git] / installers / docker / osm_pods / mongo.yaml
1 # Copyright 2019 TATA ELXSI
2 # Copyright 2021 Whitestack
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #    http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License
16 # Author: Vijay Nag B S (vijaynag.bs@tataelxsi.co.in), Fabián Bravo(fbravo@whitestack.com)
17
18 apiVersion: v1
19 kind: Service
20 metadata:
21   name: mongo
22 spec:
23   clusterIP: None
24   ports:
25   - port: 27017
26     protocol: TCP
27     targetPort: 27017
28   selector:
29     app: mongo
30   type: ClusterIP
31 ---
32 apiVersion: apps/v1
33 kind: StatefulSet
34 metadata:
35   name: mongo
36   labels:
37     app: mongo
38 spec:
39   replicas: 1
40   serviceName: mongo
41   selector:
42     matchLabels:
43       app: mongo
44   template:
45     metadata:
46       labels:
47         app: mongo
48     spec:
49       containers:
50       - name: mongo
51         image: mongo:latest
52         command:
53           - mongod
54           - "--replSet"
55           - rs0
56         ports:
57         - containerPort: 27017
58           protocol: TCP
59         volumeMounts:
60         - name: mongo-db
61           mountPath: /data/db
62       - name: mongo-sidecar
63         image: cvallance/mongo-k8s-sidecar
64         env:
65           - name: MONGO_SIDECAR_POD_LABELS
66             value: "app=mongo"
67       volumes:
68       - name: mongo-db
69         hostPath:
70          path: /var/lib/osm/osm_mongo_db/_data