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