blob: 779db9d0fd1cdb36a0362864ad0bb949da76dc9f [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
##
## ZooKeeper deployment
##
## Define a StatefulSet for ZK servers
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zk
labels:
app: heron
component: zookeeper
spec:
serviceName: zookeeper
replicas: 1
selector:
matchLabels:
app: heron
component: zookeeper
template:
metadata:
labels:
app: heron
component: zookeeper
spec:
# Make sure multiple pods of ZK don't get scheduled on the
# same node, unless there are no other available nodes
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- zookeeper
topologyKey: "kubernetes.io/hostname"
containers:
- name: zookeeper
image: heron/heron:latest
command: ["sh", "-c"]
args:
- >
/opt/zookeeper/scripts/start-zookeeper.sh
ports:
- containerPort: 2181
name: client
- containerPort: 2888
name: server
- containerPort: 3888
name: leader-election
env:
- name: ZOOKEEPER_SERVERS
value: zk-0
readinessProbe:
exec:
command:
- "/opt/zookeeper/scripts/zookeeper-ruok.sh"
initialDelaySeconds: 5
timeoutSeconds: 5
livenessProbe:
exec:
command:
- "/opt/zookeeper/scripts/zookeeper-ruok.sh"
initialDelaySeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: datadir
mountPath: /heron/data
volumes:
- name: datadir
emptyDir: {}
---
##
## Define the ZooKeeper headless service
##
apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
name: zookeeper
labels:
app: heron
component: zookeeper
spec:
ports:
- port: 2888
name: server
- port: 3888
name: leader-election
- port: 2181
name: client
clusterIP: None
selector:
app: heron
component: zookeeper