Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow broker's service clusterIP customisation #498

Merged
merged 4 commits into from
Jun 4, 2024

Conversation

MMirelli
Copy link
Contributor

@MMirelli MMirelli commented May 9, 2024

Fixes #497

Motivation

This customisation is useful to configure headless vs non-headless broker's service. The default is headless broker service, i.e. a service for which kubernetes does not allocate an IP address (https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip). A headless service is a very simple type of service that doesn't seem to work well when pulsar service is exposed by pulsar-proxy via a nodeport.

Modifications

Adding 3 modes to deploy the pulsar broker service:

  1. a valid IPv4 address
  2. auto mode, i.e. clusterIP: ''
  3. headless, i.e. clusterIP: 'None'

Verifying this change

  • Run custom verification
  • Make sure that the change passes the CI checks.

Custom verification

Mode 1. -- valid IPv4 address

Valid

values.yaml

broker:
  service:
    clusterIP: 255.255.255.255

Running helm diff upgrade pulsar-test ./apache/pulsar-helm-chart/charts/pulsar/ -n pulsar -f ./values.yaml, returns

+   type: ClusterIP
    ports:
    # prometheus needs to access /metrics endpoint
    - name: http
      port: 8080
    - name: "pulsar"
      port: 6650
+   clusterIP: "255.255.255.255"
    selector:
      app: pulsar
      release: pulsar-test
      component: broker
Invalid

values.yaml

broker:
  service:
    clusterIP: 255.255.255.256

Running helm diff upgrade pulsar-test ./apache/pulsar-helm-chart/charts/pulsar/ -n pulsar -f ./values.yaml, returns

+   type: ClusterIP
    ports:
    # prometheus needs to access /metrics endpoint
    - name: http
      port: 8080
    - name: "pulsar"
      port: 6650
+   clusterIP: "None"
    selector:
      app: pulsar
      release: pulsar-test
      component: broker

Mode 2. -- auto

values.yaml

broker:
  service:
    clusterIP: 'auto'

Running helm diff upgrade pulsar-test ./apache/pulsar-helm-chart/charts/pulsar/ -n pulsar -f ./values.yaml, returns

+   type: ClusterIP
    ports:
    # prometheus needs to access /metrics endpoint
    - name: http
      port: 8080
    - name: "pulsar"
      port: 6650
+   clusterIP: ""
    selector:
      app: pulsar
      release: pulsar-test
      component: broker

Mode 3. -- headless

values.yaml

broker:

Running helm diff upgrade pulsar-test ./apache/pulsar-helm-chart/charts/pulsar/ -n pulsar -f ./values.yaml, returns

+   type: ClusterIP
    ports:
    # prometheus needs to access /metrics endpoint
    - name: http
      port: 8080
    - name: "pulsar"
      port: 6650
+   clusterIP: "None"
    selector:
      app: pulsar
      release: pulsar-test
      component: broker

This customisation is useful to configure headless vs non-headless
broker's service. The default is headless broker service, i.e. a
service for which kubernetes  does not allocate an IP
address (https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip). A
headless service is a very simple type of service that doesn't seem to work well
when pulsar service is exposed by pulsar-proxy via a nodeport.

Addresses apache#497.
@MMirelli MMirelli marked this pull request as ready for review May 17, 2024 20:47
@MMirelli
Copy link
Contributor Author

MMirelli commented Jun 4, 2024

Just validated latest changes on my local k3d, we should be good!

@MMirelli MMirelli requested a review from lhotari June 4, 2024 15:01
@lhotari
Copy link
Member

lhotari commented Jun 4, 2024

A headless service is a very simple type of service that doesn't seem to work well when pulsar service is exposed by pulsar-proxy via a nodeport.

@MMirelli what problem is showing up in this case?

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lhotari lhotari merged commit cb5c44f into apache:master Jun 4, 2024
30 checks passed
@MMirelli
Copy link
Contributor Author

MMirelli commented Jun 4, 2024

A headless service is a very simple type of service that doesn't seem to work well when pulsar service is exposed by pulsar-proxy via a nodeport.

@MMirelli what problem is showing up in this case?

When the pulsar service is exposed by pulsar-proxy via a NodePort and the broker's service is headless, it seems that the proxy cannot find the broker as no IP address is directly assigned to the broker. A detail is that in my local cluster I am using the advertisedListeners broker config.

Anyway, I might remember the issue wrong. I'll reproduce (perhaps DEBUG logging will give us further insights) and confirm.

@MMirelli
Copy link
Contributor Author

MMirelli commented Jun 5, 2024

Actually there doesn't seem to be a problem with broker service being headless. It must have been some other configuration that broke it.

@MMirelli
Copy link
Contributor Author

MMirelli commented Jun 5, 2024

Anyway I did notice today, that using non-headless seems to have some advantages. With headless broker service, today I observed re-connections when using pulsar-client, that I didn't see in non-headless mode. It seems to be a configuration to play a bit with :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow broker's service clusterIP customisation: headless vs non-headless
2 participants