pravega / zookeeper-operator

Kubernetes Operator for Zookeeper
Apache License 2.0
368 stars 206 forks source link

Older Zookeeper versions #286

Open icyd opened 3 years ago

icyd commented 3 years ago

Description

Question: Is it possible to generate/deploy older versions of zookeeper with this operator (ie 3.4.x)? Or there are dependencies related with Zookeeper? Thanks!

copart-jafloyd commented 3 years ago

I need zoookeeper 3.4.11 to support solr cloud 7.5.0

Looks like there are two places that reference the zookeeper version: https://github.com/pravega/zookeeper-operator/blob/9bdc9a2a33a93d333979707ff5a5cc37b1c5c830/docker/Dockerfile#L18 https://github.com/pravega/zookeeper-operator/blob/c80add8305c25f2a85289db011a3c9494246ae99/docker/zu/build.gradle.kts#L15

upgrade to 3.6.1 was in c80add8305c25f2a85289db011a3c9494246ae99

So, I think this would require a docker build arg and a more complex docker image tag scheme.

copart-jafloyd commented 3 years ago

The tag format is defined in the Makefile: https://github.com/pravega/zookeeper-operator/blob/ce7b41d7c8597ad4931087618771c6dfca73c2a9/Makefile#L17-L21 https://github.com/pravega/zookeeper-operator/blob/ce7b41d7c8597ad4931087618771c6dfca73c2a9/Makefile#L51-L61 https://github.com/pravega/zookeeper-operator/blob/ce7b41d7c8597ad4931087618771c6dfca73c2a9/Makefile#L88-L101

copart-jafloyd commented 3 years ago

So something like this in the Makefile:

ZOOKEEPER_VERSION=3.6.1
ZK_APP_TAG=$(ZK_VERSION)-$(ZOOKEEPER_VERSION)

# ...

build-zk-image: 
    docker build --build-arg VERSION=$(VERSION)  --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) --build-arg ZOOKEEPER_VERSION=$(ZOOKEEPER_VERSION) -t $(APP_REPO):$(ZK_APP_TAG) ./docker 
    docker tag $(APP_REPO):$(ZK_APP_TAG) $(APP_REPO):latest 

# ...

push: build-image build-zk-image build-zk-image-swarm login 
    # ...
    docker push $(APP_REPO):$(ZK_APP_TAG) 
    docker push $(APP_REPO):latest 
    docker push $(APP_REPO):$(ZK_APP_TAG)-swarm 
    # ...
    docker tag $(APP_REPO):$(ZK_APP_TAG) $(APP_ALTREPO):$(ZK_APP_TAG) 
    docker tag $(APP_REPO):$(ZK_APP_TAG) $(APP_ALTREPO):latest 
    docker push $(ALTREPO):$(ZK_APP_TAG) 
    docker push $(ALTREPO):latest 
    # ...

then use the new var in the Dockerfile:

FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}zookeeper:${ZOOKEEPER_VERSION} 

I'm not sure how to parametrize the gradle bits however:

implementation("org.apache.zookeeper:zookeeper:3.6.1") 

Maybe we can pass in the zookeper version here? https://github.com/pravega/zookeeper-operator/blob/ce7b41d7c8597ad4931087618771c6dfca73c2a9/docker/Dockerfile#L16

cognifloyd commented 3 years ago

I just tested buidling the docker image with older versions of zookeeper. The code in docker/zu requires zookeeper ~3.6.0~ 3.5.5 or greater to build. It'll probably need some kind of conditional logic to support the older versions.

Also, it seems zu is an integral part of the operator logic, so we can't really swap out this zookeeper image for any random zookeeper image.

#13 75.34 e: /zu/src/main/java/io/pravega/zookeeper/Main.kt: (125, 56): Unresolved reference: it
#13 75.50 e: /zu/src/main/java/io/pravega/zookeeper/Zookeeper.kt: (16, 29): Unresolved reference: admin
#13 75.50 e: /zu/src/main/java/io/pravega/zookeeper/Zookeeper.kt: (25, 46): Unresolved reference: ZooKeeperAdmin
#13 75.50 e: /zu/src/main/java/io/pravega/zookeeper/Zookeeper.kt: (29, 14): Unresolved reference: ZooKeeperAdmin

PS: @copart-jafloyd is also my account. /shrug

cognifloyd commented 3 years ago

Hmm. I was wrong. Building with 3.5.5+ does work. Older than that does not.

cognifloyd commented 3 years ago

3.5.5 is the first stable release of zookeeper 3.5 series, so there are no earlier docker images. org.apache.zookeeper.admin.ZooKeeperAdmin was introduced in 3.5.3, which is why we can't compile with zookeeper 3.4.*.

cognifloyd commented 3 years ago

https://zookeeper.apache.org/doc/r3.5.3-beta/zookeeperReconfig.html Though we could create some backwards compat code to use the ZooKeeper client instead of ZooKeeperAdmin, the feature for reconfiguring the cluster on the fly was not added until 3.5.3. So, the best this Operator can do is support 3.5.5+. I guess for 3.4.11, I won't be able to use an Operator.

cognifloyd commented 3 years ago

@icyd I started building the ability to use alternate ZooKeeper versions in #306. I won't continue working on it, however, because I need ZK 3.4.11, so I will have to use something other than this operator. I'm happy to let someone take over the PR where I left off.

lunarfs commented 3 years ago

so curently testing my 3.5.8 image build using https://github.com/lunarfs/zookeeper-operator/tree/zookeeper_dynamic_version if it goeas as expected. I will try to either take over on https://github.com/pravega/zookeeper-operator/pull/306 or create a new PR from https://github.com/lunarfs/zookeeper-operator/tree/zookeeper_dynamic_version

lunarfs commented 3 years ago

@anishakj what is the requirement for tagging for this? one could argue that it was for the user to retag the images as it is not straight forward to come up with sensible tagging strategies for this i think. I beleive that official images with alternate zk versions is not on the roadmap for this project?

anishakj commented 3 years ago

@lunarfs we have tested extensively with 3.6.1 base image. Is there any specific reason you want to use 3.5.8. ? Also, regarding the tagging we are keeping zookeeper version in sync with up with Operator version.

Also if you want, can mention different repository and image here https://github.com/pravega/zookeeper-operator/blob/master/charts/zookeeper/templates/zookeeper.yaml#L12

lunarfs commented 3 years ago

@anishakj so the reason for 3.5.8 is that it is the officially supported version for kafka, kafka is compiled against this version. Until Kafka officially supports 3.6.1 I have a hard time seeing us running any other version. Also we are migrating from a kafka 2.7/zk 3.5.8 VM setup and would like to have as few unknowns as possible. So i know that the /metrics is not working on the 3.5.8 image, som my plan for that is to extend the image with support for that on top pof the pravega build.

lunarfs commented 3 years ago

@anishakj so the latest 2.8 release of kafka still recomends the latest 3.5.x (3.5.9) release of zookeeper so i guess this is stil relevant, any chance of getting this in the project?

anishakj commented 3 years ago

@lunarfs Did u give a try by changing the image in Dockerfile https://github.com/pravega/zookeeper-operator/blob/master/docker/Dockerfile#L18. Are you seeing any issues?

makzzz1986 commented 3 years ago

@anishakj I am trying to use Zookeeper 3.4.13, and I have tried to change the source of the image, adapted zookeeperStart.sh and the configuration, but Zookeeper fails silently. The last words of Zookeeper are "Starting Zookeeper... STARTED". Despite that fact, Zookeeper of the current version works fine for old SOLR, but it doesn't provide the status page in SOLR UI. 😕