-
Notifications
You must be signed in to change notification settings - Fork 96
/
cluster-dev.yml
201 lines (190 loc) · 3.96 KB
/
cluster-dev.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
201
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
apiVersion: v1
kind: Namespace
metadata:
name: jifa
labels:
name: jifa
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: jifa
name: jifa-service-account
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: jifa
name: jifa-role
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec"]
verbs: ["get", "list", "delete", "patch", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
namespace: jifa
name: role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: jifa-role
subjects:
- kind: ServiceAccount
namespace: jifa
name: jifa-service-account
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: jifa
name: mysql-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: jifa
name: mysql-initdb-config
data:
initdb.sql: |
CREATE DATABASE IF NOT EXISTS jifa;
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: jifa
name: mysql
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-pv
mountPath: /var/lib/mysql
- name: mysql-initdb
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mysql-pv
persistentVolumeClaim:
claimName: mysql-pvc
- name: mysql-initdb
configMap:
name: mysql-initdb-config
---
apiVersion: v1
kind: Service
metadata:
namespace: jifa
name: mysql-service
spec:
ports:
- port: 3306
selector:
app: mysql
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: jifa
name: jifa-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: jifa
name: jifa-master
labels:
app: jifa-master
spec:
replicas: 3
selector:
matchLabels:
app: jifa-master
template:
metadata:
labels:
app: jifa-master
spec:
serviceAccountName: jifa-service-account
containers:
- name: main-container
image: eclipsejifa/jifa:0.3.0-SNAPSHOT
imagePullPolicy: Always
volumeMounts:
- name: jifa-pv
mountPath: "/jifa-storage"
env:
- name: MYSQL_HOST
value: mysql-service:3306
- name: MYSQL_DATABASE
value: jifa
- name: MYSQL_USER
value: root
- name: MYSQL_PASSWORD
value: password
args:
- --jifa.role=master
- --jifa.storage-pvc-name=jifa-pvc
- --jifa.storage-path=/jifa-storage
- --jifa.service-account-name=jifa-service-account
- --jifa.elastic-worker-image=eclipsejifa/jifa:0.3.0-SNAPSHOT
ports:
- name: jifa-port
containerPort: 8102
volumes:
- name: jifa-pv
persistentVolumeClaim:
claimName: jifa-pvc
---
apiVersion: v1
kind: Service
metadata:
namespace: jifa
name: jifa-service
spec:
selector:
app: jifa-master
ports:
- protocol: TCP
port: 80
targetPort: jifa-port
type: LoadBalancer