31z4 / zookeeper-docker

Docker image packaging for Apache Zookeeper
MIT License
285 stars 245 forks source link

Update docker-entrypoint.sh #145

Closed bo8888 closed 1 year ago

bo8888 commented 1 year ago

auto create myid used in kubernetes StatefulSet when replicas<9

31z4 commented 1 year ago

I don't think ZOO_MY_ID should be calculated based on hostname within the entrypoint. Maybe check some ideas on setting myid here.

bianjp commented 3 months ago

I don't think ZOO_MY_ID should be calculated based on hostname within the entrypoint. Maybe check some ideas on setting myid here.

zkEnv.sh will automatically execute ${ZOOCFGDIR}/zookeeper-env.sh if it exists, so users could mount a myid caculation script to /conf/zookeeper-env.sh by using ConfigMap. This should be better than using initContainers. Unfortunatelly /conf/zookeeper-env.sh is executed after docker-entrypoint.sh created $ZOO_DATA_DIR/myid file, so the script must update $ZOO_DATA_DIR/myid instead of exporting ZOO_MY_ID environment variable.

It would be more elegant if docker-entrypoint.sh supports custom init scripts like Nginx image.