Skip to content

Commit 3846f98

Browse files
authored
Merge pull request #163 from Banno/copy-configs
cp configmap elements over to config volume as configmap vol is RO
2 parents 71d636b + 6c15dab commit 3846f98

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To quote [@arthurk](https://github.com/Yolean/kubernetes-kafka/issues/82#issueco
99

1010
> thanks for creating and maintaining this Kubernetes files, they're up-to-date (unlike the kubernetes contrib files, don't require helm and work great!
1111
12-
## Gettings started
12+
## Getting started
1313

1414
We suggest you `apply -f` manifests in the following order:
1515
* You choice of storage classes from [./configure](./configure/)
@@ -28,6 +28,7 @@ If you begin to rely on this kafka setup we recommend you fork, for example to e
2828

2929
| tag | k8s ≥ | highlights |
3030
| ----- | ------ | ---------- |
31+
| master | 1.9.4, 1.8.9, 1.7.14 | Required for read-only ConfigMaps [#162](https://github.com/Yolean/kubernetes-kafka/issues/162) [#163](https://github.com/Yolean/kubernetes-kafka/pull/163) [k8s #58720](https://github.com/kubernetes/kubernetes/pull/58720) |
3132
| v3.1 | 1.8 | The painstaking path to `min.insync.replicas`=2 |
3233
| v3.0 | 1.8 | [Outside access](#78), [modern manifests](#84), [bootstrap.kafka](#52) |
3334
| v2.1 | 1.5 | Kafka 1.0, the init script concept |

kafka/10broker-config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ data:
99
set -x
1010
1111
KAFKA_BROKER_ID=${HOSTNAME##*-}
12+
cp -Lur /etc/kafka-configmap/* /etc/kafka/
1213
sed -i "s/#init#broker.id=#init#/broker.id=$KAFKA_BROKER_ID/" /etc/kafka/server.properties
1314
1415
LABELS="kafka-broker-id=$KAFKA_BROKER_ID"

kafka/50kafka.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
terminationGracePeriodSeconds: 30
2121
initContainers:
2222
- name: init-config
23-
image: solsson/kafka-initutils@sha256:c98d7fb5e9365eab391a5dcd4230fc6e72caf929c60f29ff091e3b0215124713
23+
image: solsson/kafka-initutils@sha256:18bf01c2c756b550103a99b3c14f741acccea106072cd37155c6d24be4edd6e2
2424
env:
2525
- name: NODE_NAME
2626
valueFrom:
@@ -34,8 +34,10 @@ spec:
3434
valueFrom:
3535
fieldRef:
3636
fieldPath: metadata.namespace
37-
command: ['/bin/bash', '/etc/kafka/init.sh']
37+
command: ['/bin/bash', '/etc/kafka-configmap/init.sh']
3838
volumeMounts:
39+
- name: configmap
40+
mountPath: /etc/kafka-configmap
3941
- name: config
4042
mountPath: /etc/kafka
4143
containers:
@@ -70,9 +72,11 @@ spec:
7072
- name: data
7173
mountPath: /var/lib/kafka/data
7274
volumes:
73-
- name: config
75+
- name: configmap
7476
configMap:
7577
name: broker-config
78+
- name: config
79+
emptyDir: {}
7680
volumeClaimTemplates:
7781
- metadata:
7882
name: data

zookeeper/10zookeeper-config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ data:
1111
[ -z "$ID_OFFSET" ] && ID_OFFSET=1
1212
export ZOOKEEPER_SERVER_ID=$((${HOSTNAME##*-} + $ID_OFFSET))
1313
echo "${ZOOKEEPER_SERVER_ID:-1}" | tee /var/lib/zookeeper/data/myid
14+
cp -Lur /etc/kafka-configmap/* /etc/kafka/
1415
sed -i "s/server\.$ZOOKEEPER_SERVER_ID\=[a-z0-9.-]*/server.$ZOOKEEPER_SERVER_ID=0.0.0.0/" /etc/kafka/zookeeper.properties
1516
1617
zookeeper.properties: |-

zookeeper/50pzoo.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ spec:
2222
terminationGracePeriodSeconds: 10
2323
initContainers:
2424
- name: init-config
25-
image: solsson/kafka:1.0.1@sha256:1a4689d49d6274ac59b9b740f51b0408e1c90a9b66d16ad114ee9f7193bab111
26-
command: ['/bin/bash', '/etc/kafka/init.sh']
25+
image: solsson/kafka-initutils@sha256:18bf01c2c756b550103a99b3c14f741acccea106072cd37155c6d24be4edd6e2
26+
command: ['/bin/bash', '/etc/kafka-configmap/init.sh']
2727
volumeMounts:
28+
- name: configmap
29+
mountPath: /etc/kafka-configmap
2830
- name: config
2931
mountPath: /etc/kafka
3032
- name: data
@@ -61,9 +63,11 @@ spec:
6163
- name: data
6264
mountPath: /var/lib/zookeeper/data
6365
volumes:
64-
- name: config
66+
- name: configmap
6567
configMap:
6668
name: zookeeper-config
69+
- name: config
70+
emptyDir: {}
6771
volumeClaimTemplates:
6872
- metadata:
6973
name: data

zookeeper/51zoo.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ spec:
2222
terminationGracePeriodSeconds: 10
2323
initContainers:
2424
- name: init-config
25-
image: solsson/kafka:1.0.1@sha256:1a4689d49d6274ac59b9b740f51b0408e1c90a9b66d16ad114ee9f7193bab111
26-
command: ['/bin/bash', '/etc/kafka/init.sh']
25+
image: solsson/kafka-initutils@sha256:18bf01c2c756b550103a99b3c14f741acccea106072cd37155c6d24be4edd6e2
26+
command: ['/bin/bash', '/etc/kafka-configmap/init.sh']
2727
env:
2828
- name: ID_OFFSET
2929
value: "4"
3030
volumeMounts:
31+
- name: configmap
32+
mountPath: /etc/kafka-configmap
3133
- name: config
3234
mountPath: /etc/kafka
3335
- name: data
@@ -64,8 +66,10 @@ spec:
6466
- name: data
6567
mountPath: /var/lib/zookeeper/data
6668
volumes:
67-
- name: config
69+
- name: configmap
6870
configMap:
6971
name: zookeeper-config
72+
- name: config
73+
emptyDir: {}
7074
- name: data
7175
emptyDir: {}

0 commit comments

Comments
 (0)