You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/09 01:37:29 UTC

[GitHub] [pulsar] kwenZh opened a new issue #14611: when i use pulsar in k8s, how to set advertisedListeners in broker.conf for different broker pods ,

kwenZh opened a new issue #14611:
URL: https://github.com/apache/pulsar/issues/14611


   
   how to set advertisedListeners in broker.conf for different broker pods  , when i use pulsar in k8s,such as:
   ```
   pulsar-cluster-broker-0
   pulsar-cluster-broker-1
   pulsar-cluster-broker-2
   ```
   
   and broker.conf  for pod:  pulsar-cluster-broker-0
   ```
   advertisedListeners=internal:pulsar://pulsar-cluster-broker-0.pulsar-cluster-broker.pulsar.svc.cluster.local:6650,external:pulsar://x.x.x.x34000
   ```
   
   for pulsar-cluster-broker-1
   ```
   advertisedListeners=internal:pulsar://pulsar-cluster-broker-1.pulsar-cluster-broker.pulsar.svc.cluster.local:6650,external:pulsar://x.x.x.x34000
   ```
   
   
   in pulsar-broker ConfigMap value:
   ```
   advertisedListeners: ""
   ```
   
   and i can get POD_NAME in env.
   ```
    env:
             - name: POD_NAME
               valueFrom:
                 fieldRef:
                   apiVersion: v1
                   fieldPath: metadata.name 
   ```
   how to use  bin/apply-config-from-env.py conf/bookkeeper.conf to set advertisedListeners in broker.conf,  Assign different values with env:  POD_NAME
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kwenZh closed issue #14611: when i use pulsar in k8s, how to set advertisedListeners in broker.conf for different broker pods ,

Posted by GitBox <gi...@apache.org>.
kwenZh closed issue #14611:
URL: https://github.com/apache/pulsar/issues/14611


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] wangjialing218 commented on issue #14611: when i use pulsar in k8s, how to set advertisedListeners in broker.conf for different broker pods ,

Posted by GitBox <gi...@apache.org>.
wangjialing218 commented on issue #14611:
URL: https://github.com/apache/pulsar/issues/14611#issuecomment-1062515909


   you can customize your apply-config-from-env.py script, in `# Update values from Env` block, add some code like:
   ```
   if k.startswith('advertisedListeners'):
         v = advertisedListenersValue(os.environ['POD_NAME'])
         lines[idx] = '%s=%s\n' % (k, v)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kwenZh commented on issue #14611: when i use pulsar in k8s, how to set advertisedListeners in broker.conf for different broker pods ,

Posted by GitBox <gi...@apache.org>.
kwenZh commented on issue #14611:
URL: https://github.com/apache/pulsar/issues/14611#issuecomment-1062525524


   
   ```
   # add value for advertisedListeners
   # in broker configmap: advertisedListeners: "internal:pulsar://%s.pulsar-cluster-broker.pulsar.svc.cluster.local:6650,external:pulsar://x.x.x.x:30012"
   if k.startswith("advertisedListeners"):
       new_value = v % os.environ['POD_NAME']
       idx = keys[k]
       lines[idx] = '%s=%s\n' % (k, new_value)
       print ("advertisedListeners value apply [%s]=[%s]", k, new_value)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kwenZh commented on issue #14611: when i use pulsar in k8s, how to set advertisedListeners in broker.conf for different broker pods ,

Posted by GitBox <gi...@apache.org>.
kwenZh commented on issue #14611:
URL: https://github.com/apache/pulsar/issues/14611#issuecomment-1062518570


   > you can customize your apply-config-from-env.py script, in `# Update values from Env` block, add some code like:
   > 
   > ```
   > if k.startswith('advertisedListeners'):
   >       v = advertisedListenersValue(os.environ['POD_NAME'])
   >       lines[idx] = '%s=%s\n' % (k, v)
   > ```
   
   fine,   The problem of using your own scripts to render broker.conf is simple,  I struggled with the default script and didn't see the logic to handle the `advertisedListeners`, thank you ,  I understand !
   
   
   
   > you can customize your apply-config-from-env.py script, in `# Update values from Env` block, add some code like:
   > 
   > ```
   > if k.startswith('advertisedListeners'):
   >       v = advertisedListenersValue(os.environ['POD_NAME'])
   >       lines[idx] = '%s=%s\n' % (k, v)
   > ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kwenZh edited a comment on issue #14611: when i use pulsar in k8s, how to set advertisedListeners in broker.conf for different broker pods ,

Posted by GitBox <gi...@apache.org>.
kwenZh edited a comment on issue #14611:
URL: https://github.com/apache/pulsar/issues/14611#issuecomment-1062518570


   > you can customize your apply-config-from-env.py script, in `# Update values from Env` block, add some code like:
   > 
   > ```
   > if k.startswith('advertisedListeners'):
   >       v = advertisedListenersValue(os.environ['POD_NAME'])
   >       lines[idx] = '%s=%s\n' % (k, v)
   > ```
   
   fine,   The problem of using your own scripts to render broker.conf is simple,  I struggled with the default script and didn't see the logic to handle the `advertisedListeners`, thank you ,  I understand !
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org