summaryrefslogtreecommitdiff
path: root/contrib/k8s-lwl/mysql-statefulset.yml
blob: 92d603caf7ba56013da9043ba2908f00d665f479 (plain) (blame)
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
apiVersion: apps/v1
kind: StatefulSet
metadata:
  namespace: lwl
  name: stats-mysql
  labels:
    app: mysql
    tier: stats
spec:
  serviceName: stats-mysql
  replicas: 1
  selector:
    matchLabels:
      app: mysql
      tier: stats
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: mysql
        tier: stats
    spec:
      nodeName: lw-master
      securityContext:
        runAsUser: 27
        fsGroup: 27
      initContainers:
      - name: prepare-mysql-volumes
        image: busybox
        command: ['sh', '-c', 'chown 27:27 /srv/lib && chmod 700 /srv/lib && mkdir -p /srv/tmp/log /srv/tmp/run /srv/tmp/files && ln -sf /dev/stderr /srv/tmp/log/mysqld.log && chown 27:27 /srv/tmp/log/mysqld.log /srv/tmp/run /srv/tmp/files']
        securityContext:
          runAsUser: 0
        volumeMounts:
        - name: mysql-lib
          mountPath: /srv/lib
        - name: mysql-tmp
          mountPath: /srv/tmp
      containers:
      - name: mysql
        image: quay.io/neith00/mysql-docker:s2streamstats
        imagePullPolicy: IfNotPresent
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: /var/run/mysql-secret/password
        volumeMounts:
        - name: mysql-lib
          mountPath: /var/lib/mysql
        - name: mysql-tmp
          subPath: log
          mountPath: /var/log
        - name: mysql-tmp
          subPath: run
          mountPath: /var/run/mysqld
        - name: mysql-tmp
          subPath: files
          mountPath: /var/lib/mysql-files/
        - name: mysql-secret
          mountPath: /var/run/mysql-secret/
      volumes:
      - name: mysql-lib
        hostPath:
          type: DirectoryOrCreate
          path: /srv/stats/mysql
      - name: mysql-tmp
        emptyDir:
          medium: Memory
      - name: mysql-secret
        secret:
          secretName: stats-mysql-root
          defaultMode: 0400