Skip to content

Commit a7cba45

Browse files
Add the possibility to set static ports for the hazelcast cluster
1 parent b8d373c commit a7cba45

File tree

3 files changed

+54
-12
lines changed

3 files changed

+54
-12
lines changed

charts/sonarqube-dce/README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Prior to SonarQube Server Datacenter 10.8, we used a different naming convention
152152

153153
Starting from 10.8, we advise users to rename your `ApplicationNodes` to `applicationNodes`. While this is a straightforward change for users, ensuring cross-compability between both usage is challenging (if you are interested in the technical implementation, please take a look at this [PR](https://github.com/SonarSource/helm-chart-sonarqube/pull/586)).
154154

155-
Please report any encountered bugs to https://community.sonarsource.com/.
155+
Please report any encountered bugs to <https://community.sonarsource.com/>.
156156

157157
#### Cpu and memory settings
158158

@@ -251,6 +251,25 @@ kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/late
251251
252252
```
253253

254+
## Working with Istio
255+
256+
When deploying SonarQube in an Istio service mesh environment, you need to configure fixed ports for Hazelcast communication between application nodes. This is required because Istio's sidecar proxy needs to know all ports in advance for traffic management, security policies, and observability.
257+
258+
By default, SonarQube's Hazelcast cluster uses dynamic port allocation, which conflicts with Istio's requirement for explicit port declarations in service definitions and network policies. To resolve this, you must set fixed ports for the following Hazelcast communication channels:
259+
260+
* `applicationNodes.webPort` - Used by the Web process for cluster communication
261+
* `applicationNodes.cePort` - Used by the Compute Engine process for cluster communication
262+
263+
**Example configuration:**
264+
265+
```yaml
266+
applicationNodes:
267+
webPort: 9001 # Web process communication
268+
cePort: 9002 # Compute Engine process communication
269+
```
270+
271+
This ensures that Istio can properly route traffic, apply security policies, and provide telemetry for all inter-node communication within the SonarQube cluster.
272+
254273
### Upgrading the Helm chart
255274

256275
When upgrading your SonarQube instance, due to high CPU usage, it is recommended to disable the autoscaling before the upgrade process, re-enabling it afterwards.
@@ -344,7 +363,6 @@ The following table lists the configurable parameters of the SonarQube chart and
344363
| `searchNodes.affinity` | Node / Pod affinities for searchNodes, global affinity takes precedence | `{}` |
345364
| `searchNodes.tolerations` | List of node taints to tolerate for searchNodes, global tolerations take precedence | `[]` |
346365
347-
348366
### App Nodes Configuration
349367
350368
| Parameter | Description | Default |
@@ -432,7 +450,9 @@ The following table lists the configurable parameters of the SonarQube chart and
432450
| `applicationNodes.nodeSelector` | Node labels for application nodes' pods assignment, global nodeSelector takes precedence | `{}` |
433451
| `applicationNodes.affinity` | Node / Pod affinities for applicationNodes, global affinity takes precedence | `{}` |
434452
| `applicationNodes.tolerations` | List of node taints to tolerate for applicationNodes, global tolerations take precedence | `[]` |
435-
453+
| `applicationNodes.port` | The Hazelcast port for communication with each application member of the cluster. | `9003` |
454+
| `applicationNodes.webPort` | The Hazelcast port for communication with the WebServer process. If not specified, a dynamic port will be chosen. | `` |
455+
| `applicationNodes.cePort` | The Hazelcast port for communication with the ComputeEngine process. If not specified, a dynamic port will be chosen | `` |
436456
437457
### Generic Configuration
438458
@@ -619,7 +639,6 @@ The bundled PostgreSQL Chart is deprecated. Please see <https://artifacthub.io/p
619639
| `extraConfig.secrets` | A list of `Secret`s (which must contain key/value pairs) | `[]` |
620640
| `extraConfig.configmaps` | A list of `ConfigMap`s (which must contain key/value pairs) | `[]` |
621641
622-
623642
### SetAdminPassword
624643
625644
| Parameter | Description | Default |
@@ -635,7 +654,6 @@ The bundled PostgreSQL Chart is deprecated. Please see <https://artifacthub.io/p
635654
| `setAdminPassword.image` | Curl container image | `"image.repository":"image.tag"` |
636655
| `setAdminPassword.annotations` | Custom annotations for admin hook Job | `{}` |
637656
638-
639657
### Advanced Options
640658
641659
| Parameter | Description | Default |

charts/sonarqube-dce/templates/service.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,25 @@ spec:
6868
clusterIP: None
6969
publishNotReadyAddresses: true
7070
ports:
71-
- port: 9003
71+
- port: {{ .Values.ApplicationNodes.port }}
7272
targetPort: hazelcast
7373
protocol: TCP
74+
appProtocol: tcp
7475
name: hazelcast
76+
{{- if and .Values.ApplicationNodes.webPort (ne .Values.ApplicationNodes.webPort "") }}
77+
- port: {{ .Values.ApplicationNodes.webPort }}
78+
targetPort: hazelcast-web
79+
protocol: TCP
80+
appProtocol: tcp
81+
name: hazelcast-web
82+
{{- end }}
83+
{{- if and .Values.ApplicationNodes.cePort (ne .Values.ApplicationNodes.cePort "") }}
84+
- port: {{ .Values.ApplicationNodes.cePort }}
85+
targetPort: hazelcast-ce
86+
protocol: TCP
87+
appProtocol: tcp
88+
name: hazelcast-ce
89+
{{- end }}
7590
selector:
7691
app: {{ template "sonarqube.name" . }}
7792
release: {{ .Release.Name }}

charts/sonarqube-dce/values.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ searchNodes:
1818

1919
## Environment variables to attach to the search pods
2020
##
21-
# env:
22-
# # If you use a different ingress path from /, you have to add it here as the value of SONAR_WEB_CONTEXT
23-
# - name: SONAR_WEB_CONTEXT
24-
# value: /sonarqube
25-
# - name: VARIABLE
26-
# value: my-value
21+
env:
22+
# If you use a different ingress path from /, you have to add it here as the value of SONAR_WEB_CONTEXT
23+
- name: SONAR_WEB_CONTEXT
24+
value: /sonarqube
25+
- name: VARIABLE
26+
value: my-value
2727

2828
## Labels to add to the search pods
2929
##
@@ -412,6 +412,15 @@ applicationNodes:
412412
# if the global .Values.tolerations is set, the following one will be ignored
413413
tolerations: []
414414

415+
## The following values are used to set the ports for the Hazelcast cluster communication
416+
# The port used by the application nodes to communicate with each other
417+
port: 9003
418+
# The port used by the web process to communicate with other application nodes (If unset, it will be dynamically allocated)
419+
# webPort: 4023
420+
# The port used by the compute engine process to communicate with other application nodes (If unset, it will be dynamically allocated)
421+
# cePort: 4024
422+
423+
415424
## This sets the TLS encryption between application and search nodes
416425
nodeEncryption:
417426
enabled: false

0 commit comments

Comments
 (0)