-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path3-statefulset.yaml
136 lines (136 loc) · 4.25 KB
/
3-statefulset.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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: coolbeans
namespace: coolbeans
labels:
app: coolbeans
spec:
serviceName: coolbeans
podManagementPolicy: "Parallel"
replicas: 3
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 3
selector:
matchLabels:
app: coolbeans
template:
metadata:
labels:
app: coolbeans
spec:
terminationGracePeriodSeconds: 30
containers:
- name: cluster-node
image: 1xyz/coolbeans:v0.1.10
imagePullPolicy: Always
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: COOLBEANS_RAFT_PORT
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: COOLBEANS_RAFT_PORT
- name: COOLBEANS_RPC_PORT
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: COOLBEANS_RPC_PORT
- name: PEERS_ADDRS
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: PEERS_ADDRS
- name: BOOTSTRAP_NODE_ID
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: BOOTSTRAP_NODE_ID
- name: DATA_DIR
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: DATA_DIR
- name: ADDR_SUFFIX
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: ADDR_SUFFIX
- name: PROMETHEUS_PORT
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: PROMETHEUS_PORT
- name: SNAPSHOT_THRESHOLD
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: SNAPSHOT_THRESHOLD
- name: TRAILING_LOG_COUNT
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: TRAILING_LOG_COUNT
- name: SNAPSHOT_INTERVAL_SECS
valueFrom:
configMapKeyRef:
name: coolbeans-config
key: SNAPSHOT_INTERVAL_SECS
command: ["/root/coolbeans", "cluster-node",
"--node-id", "$(NODE_ID)",
"--root-dir", "$(DATA_DIR)",
"--bootstrap-node-id", "$(BOOTSTRAP_NODE_ID)",
"--raft-listen-addr", "$(POD_IP):$(COOLBEANS_RAFT_PORT)",
"--raft-advertized-addr", "$(NODE_ID).$(ADDR_SUFFIX):$(COOLBEANS_RAFT_PORT)",
"--node-listen-addr", ":$(COOLBEANS_RPC_PORT)",
"--node-peer-addrs", "$(PEERS_ADDRS)",
## By default all logs are fsynced to disk (bolt-db)
## By default fsync is called for every commit to the disk log
# "--no-fsync",
##
## Here, all the logs are in memory & not in bolt-db, but snapshots as usual are on
## disk. You can tune the snapshot threshold, trailing-log-count etc..
# "--no-disk-log"
# "--snapshot-threshold", "$(SNAPSHOT_THRESHOLD)",
# "--trailing-log-count", "$(TRAILING_LOG_COUNT)",
# "--snapshot-interval-secs", "$(SNAPSHOT_INTERVAL_SECS)",
"--prometheus-addr", ":$(PROMETHEUS_PORT)" ]
ports:
- containerPort: 11000
name: grpc-server
- containerPort: 21000
name: raft-tcp
resources:
limits:
cpu: "2000m"
memory: 2Gi
requests:
cpu: "500m"
memory: 1Gi
volumeMounts:
- name: data
mountPath: /root/data
##
# Uncomment to use the readiness probe
# readinessProbe:
# exec:
# command: ["/root/coolbeans", "--verbose", "cluster-client", "is_leader", "--node-addr", "localhost:11000"]
# initialDelaySeconds: 30
# periodSeconds: 15
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Gi