Skip to content

Fix replication factor for scale-1 variant, and add an -ephemeral variant #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ and though they still seem to work you can get around that with a v1.14+ kubectl

### Maintaining your own kustomization

`kubectl apply -k` takes a siungle overlay, meaning that you can't compose different overlays from this repo.
`kubectl apply -k` takes a single overlay, meaning that you can't compose different overlays from this repo.
You'll probably want to maintain your own variant.
One option is to keep kubernets-kafka as a git submodule and edit the relative path from an example variant.

Expand Down
6 changes: 6 additions & 0 deletions variants/scale-1-ephemeral/kafka-scale1-overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--override"},
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "default.replication.factor=1"},
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--override"},
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "min.insync.replicas=1"}
]
13 changes: 13 additions & 0 deletions variants/scale-1-ephemeral/kafka.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kafka
namespace: kafka
spec:
replicas: 1
template:
spec:
volumes:
- name: data
emptyDir: {}
volumeClaimTemplates: []
13 changes: 13 additions & 0 deletions variants/scale-1-ephemeral/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bases:
- ../../kafka
- ../../zookeeper
patchesStrategicMerge:
- kafka.yaml
- zookeeper.yaml
patchesJson6902:
- target:
group: apps
version: v1
kind: StatefulSet
name: kafka
path: kafka-scale1-overrides.json
47 changes: 47 additions & 0 deletions variants/scale-1-ephemeral/zookeeper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
apiVersion: v1
kind: Service
metadata:
name: pzoo
namespace: kafka
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: pzoo
namespace: kafka
spec:
replicas: 1
template:
spec:
initContainers:
- name: init-config
env:
- name: PZOO_REPLICAS
value: '1'
- name: ZOO_REPLICAS
value: '0'
volumes:
- name: data
emptyDir: {}
volumeClaimTemplates: []
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zoo
namespace: kafka
spec:
replicas: 0
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: '1'
- name: ZOO_REPLICAS
value: '0'
- name: ID_OFFSET
value: '2'
6 changes: 6 additions & 0 deletions variants/scale-1/kafka-scale1-overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--override"},
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "default.replication.factor=1"},
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--override"},
{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "min.insync.replicas=1"}
]
7 changes: 7 additions & 0 deletions variants/scale-1/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ bases:
patchesStrategicMerge:
- kafka.yaml
- zookeeper.yaml
patchesJson6902:
- target:
group: apps
version: v1
kind: StatefulSet
name: kafka
path: kafka-scale1-overrides.json