2017-05-18 21:09:54 +03:00
|
|
|
#
|
|
|
|
|
# Copyright © 2016-2017 The Thingsboard Authors
|
|
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
#
|
|
|
|
|
|
2017-05-07 19:54:50 +03:00
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Service
|
|
|
|
|
metadata:
|
|
|
|
|
name: zk-headless
|
|
|
|
|
labels:
|
|
|
|
|
app: zk-headless
|
|
|
|
|
spec:
|
|
|
|
|
ports:
|
|
|
|
|
- port: 2888
|
|
|
|
|
name: server
|
|
|
|
|
- port: 3888
|
|
|
|
|
name: leader-election
|
|
|
|
|
clusterIP: None
|
|
|
|
|
selector:
|
|
|
|
|
app: zk
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ConfigMap
|
|
|
|
|
metadata:
|
|
|
|
|
name: zk-config
|
|
|
|
|
data:
|
2017-05-19 11:46:15 +03:00
|
|
|
ensemble: "zk-0;zk-1"
|
2017-05-10 21:01:06 +03:00
|
|
|
replicas: "3"
|
2017-05-09 23:38:42 +03:00
|
|
|
jvm.heap: "500m"
|
2017-05-07 19:54:50 +03:00
|
|
|
tick: "2000"
|
|
|
|
|
init: "10"
|
|
|
|
|
sync: "5"
|
|
|
|
|
client.cnxns: "60"
|
|
|
|
|
snap.retain: "3"
|
|
|
|
|
purge.interval: "1"
|
2017-05-10 21:01:06 +03:00
|
|
|
client.port: "2181"
|
|
|
|
|
server.port: "2888"
|
|
|
|
|
election.port: "3888"
|
2017-05-07 19:54:50 +03:00
|
|
|
---
|
|
|
|
|
apiVersion: policy/v1beta1
|
|
|
|
|
kind: PodDisruptionBudget
|
|
|
|
|
metadata:
|
|
|
|
|
name: zk-budget
|
|
|
|
|
spec:
|
|
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app: zk
|
|
|
|
|
minAvailable: 2
|
|
|
|
|
---
|
|
|
|
|
apiVersion: apps/v1beta1
|
|
|
|
|
kind: StatefulSet
|
|
|
|
|
metadata:
|
|
|
|
|
name: zk
|
|
|
|
|
spec:
|
|
|
|
|
serviceName: zk-headless
|
2017-05-19 11:46:15 +03:00
|
|
|
replicas: 2
|
2017-05-07 19:54:50 +03:00
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app: zk
|
|
|
|
|
annotations:
|
|
|
|
|
pod.alpha.kubernetes.io/initialized: "true"
|
|
|
|
|
spec:
|
2017-05-19 11:46:15 +03:00
|
|
|
nodeSelector:
|
|
|
|
|
machinetype: other
|
2017-05-09 16:31:48 +03:00
|
|
|
affinity:
|
|
|
|
|
podAntiAffinity:
|
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
|
- labelSelector:
|
|
|
|
|
matchExpressions:
|
|
|
|
|
- key: "app"
|
|
|
|
|
operator: In
|
|
|
|
|
values:
|
|
|
|
|
- zk-headless
|
|
|
|
|
topologyKey: "kubernetes.io/hostname"
|
2017-05-07 19:54:50 +03:00
|
|
|
containers:
|
2017-05-10 21:01:06 +03:00
|
|
|
- name: zk
|
2017-05-07 19:54:50 +03:00
|
|
|
imagePullPolicy: Always
|
2017-05-24 16:40:19 +03:00
|
|
|
image: thingsboard/zk:1.2.4
|
2017-05-07 19:54:50 +03:00
|
|
|
ports:
|
|
|
|
|
- containerPort: 2181
|
|
|
|
|
name: client
|
|
|
|
|
- containerPort: 2888
|
|
|
|
|
name: server
|
|
|
|
|
- containerPort: 3888
|
|
|
|
|
name: leader-election
|
|
|
|
|
env:
|
|
|
|
|
- name : ZK_ENSEMBLE
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: zk-config
|
|
|
|
|
key: ensemble
|
2017-05-09 23:38:42 +03:00
|
|
|
- name : ZK_REPLICAS
|
2017-05-10 21:01:06 +03:00
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: zk-config
|
|
|
|
|
key: replicas
|
2017-05-07 19:54:50 +03:00
|
|
|
- name : ZK_HEAP_SIZE
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: jvm.heap
|
2017-05-07 19:54:50 +03:00
|
|
|
- name : ZK_TICK_TIME
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: tick
|
2017-05-07 19:54:50 +03:00
|
|
|
- name : ZK_INIT_LIMIT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: init
|
2017-05-07 19:54:50 +03:00
|
|
|
- name : ZK_SYNC_LIMIT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: tick
|
2017-05-07 19:54:50 +03:00
|
|
|
- name : ZK_MAX_CLIENT_CNXNS
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: client.cnxns
|
2017-05-07 19:54:50 +03:00
|
|
|
- name: ZK_SNAP_RETAIN_COUNT
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: snap.retain
|
2017-05-07 19:54:50 +03:00
|
|
|
- name: ZK_PURGE_INTERVAL
|
|
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zk-config
|
|
|
|
|
key: purge.interval
|
2017-05-07 19:54:50 +03:00
|
|
|
- name: ZK_CLIENT_PORT
|
2017-05-10 21:01:06 +03:00
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: zk-config
|
|
|
|
|
key: client.port
|
2017-05-07 19:54:50 +03:00
|
|
|
- name: ZK_SERVER_PORT
|
2017-05-10 21:01:06 +03:00
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: zk-config
|
|
|
|
|
key: server.port
|
2017-05-07 19:54:50 +03:00
|
|
|
- name: ZK_ELECTION_PORT
|
2017-05-10 21:01:06 +03:00
|
|
|
valueFrom:
|
|
|
|
|
configMapKeyRef:
|
|
|
|
|
name: zk-config
|
|
|
|
|
key: election.port
|
2017-05-07 19:54:50 +03:00
|
|
|
command:
|
|
|
|
|
- sh
|
|
|
|
|
- -c
|
2017-05-24 16:17:23 +03:00
|
|
|
- zk-gen-config.sh && zkServer.sh start-foreground
|
2017-05-07 19:54:50 +03:00
|
|
|
readinessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command:
|
2017-05-24 16:17:23 +03:00
|
|
|
- "zk-ok.sh"
|
2017-05-07 19:54:50 +03:00
|
|
|
initialDelaySeconds: 15
|
|
|
|
|
timeoutSeconds: 5
|
|
|
|
|
livenessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command:
|
2017-05-24 16:17:23 +03:00
|
|
|
- "zk-ok.sh"
|
2017-05-07 19:54:50 +03:00
|
|
|
initialDelaySeconds: 15
|
|
|
|
|
timeoutSeconds: 5
|
|
|
|
|
volumeMounts:
|
2017-05-10 21:01:06 +03:00
|
|
|
- name: zkdatadir
|
2017-05-07 19:54:50 +03:00
|
|
|
mountPath: /var/lib/zookeeper
|
|
|
|
|
securityContext:
|
|
|
|
|
runAsUser: 1000
|
|
|
|
|
fsGroup: 1000
|
|
|
|
|
volumeClaimTemplates:
|
|
|
|
|
- metadata:
|
2017-05-10 21:01:06 +03:00
|
|
|
name: zkdatadir
|
2017-05-07 19:54:50 +03:00
|
|
|
annotations:
|
2017-05-10 21:01:06 +03:00
|
|
|
volume.beta.kubernetes.io/storage-class: slow
|
2017-05-07 19:54:50 +03:00
|
|
|
spec:
|
|
|
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
2017-05-09 16:31:48 +03:00
|
|
|
storage: 1Gi
|