pravega / zookeeper-operator

Kubernetes Operator for Zookeeper
Apache License 2.0
364 stars 203 forks source link

Add the multiAddress.enabled cluster option present in zk >3.6.0 #595

Open cstaff14 opened 6 months ago

cstaff14 commented 6 months ago

Change log description

Purpose of the change

In zookeeper > 3.6.0 you can specify multiple addresses for a singular zookeeper server. here is the description of that cluster option. This update allows you to leverage that feature through the operator. This can also be useful if you want to expose individual zk servers through external addresses. (e.g., Fixes #666, Closes #1234)

What the code does

(Detailed description of the code changes)

How to verify it

  1. add the -Dzookeeper.multiAddress.enabled=true flag to the value of the SERVER_JVMFLAGS env variable in your pod definition.
    pod:
    ...
    env:
      - name: SERVER_JVMFLAGS
        value: "-Dzookeeper.multiAddress.enabled=true"
  2. Then add your additional addresses to the config definition of your ZookeeperCluster CRD in the format server.<id>: <address1>|<address2>|...

    config:
      ...
      additionalConfig {
        server.1: "zoo1-net1.net|zoo1-net2.net",
        server.2: "zoo2-net1.net",
        server.4: "zoo4-net1.net|zoo4-net2.net|zoo4-net3.net"
      }
    
  3. Validate correct address list is displayed through k8s portforwarding

     $ kubectl port-forward -n default zookeeper-0 2181:2181
     $ echo conf | nc localhost 2181
        ...
        membership: 
        server.1=app-zookeeper-0.app-zookeeper-headless.namespace.svc.cluster.local:2888:3888:participant|zoo1-net1.net:2888:3888|zoo1-net2.net:2888:3888:participant;0.0.0.0:2181
        server.2=app-zookeeper-0.app-zookeeper-headless.namespace.svc.cluster.local:2888:3888:participant|zoo2-net1.net:2888:3888:participant;0.0.0.0:2181
        server.3=app-zookeeper-0.app-zookeeper-headless.namespace.svc.cluster.local:2888:3888:participant;0.0.0.0:2181
        server.4=app-zookeeper-0.app-zookeeper-headless.namespace.svc.cluster.local:2888:3888:participant|zoo4-net1.net:2888:3888:participant|zoo4-net2.net:2888:3888:participant|zoo4-net3.net:2888:3888:participant;0.0.0.0:2181
        server.5=app-zookeeper-0.app-zookeeper-headless.namespace.svc.cluster.local:2888:3888:participant;0.0.0.0:2181