Skip to content

Commit

Permalink
Crazy fast zookeeper start, crazy cheap so we can scale up
Browse files Browse the repository at this point in the history
  • Loading branch information
solsson committed Apr 22, 2020
1 parent 50e28a6 commit 6d86264
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 0 deletions.
4 changes: 4 additions & 0 deletions native/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bases:
- ../nonroot
patchesStrategicMerge:
- native-image-zookeeper.yaml
21 changes: 21 additions & 0 deletions native/native-image-zookeeper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: pzoo
spec:
template:
spec:
containers:
- name: zookeeper
image: solsson/kafka:native-zookeeper-server-start@sha256:fb7b0ea81e3490f088de1491afcdde8f7531477f125781c726dfbbffb2695a01
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zoo
spec:
template:
spec:
containers:
- name: zookeeper
image: solsson/kafka:native-zookeeper-server-start@sha256:fb7b0ea81e3490f088de1491afcdde8f7531477f125781c726dfbbffb2695a01
6 changes: 6 additions & 0 deletions variants/scale-6-9/kafka-6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kafka
spec:
replicas: 3
20 changes: 20 additions & 0 deletions variants/scale-6-9/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bases:
- ../../native
patchesStrategicMerge:
- zoo-9.yaml
- kafka-6.yaml
patchesJson6902:
# The nonroot image is distroless and doesn't support a shell that the prestop hook needs
- target:
group: apps
version: v1
kind: StatefulSet
name: zoo
path: lifecycle-remove.json
# The nonroot image is distroless and has neither shell nor the nc command
- target:
group: apps
version: v1
kind: StatefulSet
name: zoo
path: zoo-readiness-without-shell.yaml
4 changes: 4 additions & 0 deletions variants/scale-6-9/lifecycle-remove.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
{"op": "remove", "path": "/spec/template/spec/containers/0/lifecycle"}
]

33 changes: 33 additions & 0 deletions variants/scale-6-9/zoo-9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: pzoo
namespace: kafka
spec:
replicas: 0
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zoo
namespace: kafka
spec:
replicas: 9
template:
spec:
initContainers:
- name: init-config
env:
# There's no validation on these numbers adding up to a coherent zk config, so watch out
- name: PZOO_REPLICAS
value: '0'
- name: REPLICAS
value: '9'
- name: ID_OFFSET
value: '1'
containers:
- name: zookeeper
env:
- name: REPLICAS
value: '9'
5 changes: 5 additions & 0 deletions variants/scale-6-9/zoo-readiness-without-shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- op: replace
path: /spec/template/spec/containers/0/readinessProbe
value:
tcpSocket:
port: 2181

0 comments on commit 6d86264

Please sign in to comment.