From 8d9898d1665045bb2e15bbf6cf2767446aa45f6d Mon Sep 17 00:00:00 2001 From: Yevhen Ivantsov Date: Mon, 16 Dec 2024 18:09:12 +1100 Subject: [PATCH 1/5] Make it possible to set nodePort in services --- src/main/charts/bamboo/README.md | 1 + src/main/charts/bamboo/templates/service.yaml | 3 +++ src/main/charts/bamboo/values.yaml | 4 ++++ src/main/charts/bitbucket/README.md | 5 ++++- src/main/charts/bitbucket/templates/service.yaml | 6 ++++++ src/main/charts/bitbucket/values.yaml | 12 ++++++++++++ src/main/charts/confluence/README.md | 1 + src/main/charts/confluence/templates/service.yaml | 3 +++ src/main/charts/confluence/values.yaml | 4 ++++ src/main/charts/crowd/README.md | 1 + src/main/charts/crowd/templates/service.yaml | 3 +++ src/main/charts/crowd/values.yaml | 4 ++++ src/main/charts/jira/README.md | 1 + src/main/charts/jira/templates/service.yaml | 3 +++ src/main/charts/jira/values.yaml | 4 ++++ src/test/java/test/ServiceTest.java | 11 ++++++++++- 16 files changed, 64 insertions(+), 2 deletions(-) diff --git a/src/main/charts/bamboo/README.md b/src/main/charts/bamboo/README.md index a466d1941..a96eedbba 100644 --- a/src/main/charts/bamboo/README.md +++ b/src/main/charts/bamboo/README.md @@ -87,6 +87,7 @@ Kubernetes: `>=1.21.x-0` | bamboo.service.annotations | object | `{}` | Additional annotations to apply to the Service | | bamboo.service.contextPath | string | `nil` | The Tomcat context path that Bamboo will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | bamboo.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| bamboo.service.nodePort | string | `nil` | NodePort for Bitbucket service | | bamboo.service.port | int | `80` | The port on which the Bamboo K8s Service will listen for http traffic | | bamboo.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | bamboo.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/bamboo/templates/service.yaml b/src/main/charts/bamboo/templates/service.yaml index ae28a2467..14ea45dfa 100644 --- a/src/main/charts/bamboo/templates/service.yaml +++ b/src/main/charts/bamboo/templates/service.yaml @@ -24,5 +24,8 @@ spec: targetPort: http protocol: TCP name: http + {{- if and (eq .Values.bamboo.service.type "NodePort") .Values.bamboo.service.nodePort}} + nodePort: {{ .Values.bamboo.service.nodePort }} + {{- end }} selector: {{- include "common.labels.selectorLabels" . | nindent 4 }} diff --git a/src/main/charts/bamboo/values.yaml b/src/main/charts/bamboo/values.yaml index 561373f51..c0a17aa57 100644 --- a/src/main/charts/bamboo/values.yaml +++ b/src/main/charts/bamboo/values.yaml @@ -568,6 +568,10 @@ bamboo: # type: ClusterIP + # -- NodePort for Bitbucket service + # + nodePort: + # -- Session affinity type. If you want to make sure that connections from a particular client # are passed to the same pod each time, set sessionAffinity to ClientIP. # See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity diff --git a/src/main/charts/bitbucket/README.md b/src/main/charts/bitbucket/README.md index 507a31a4e..faeb43018 100644 --- a/src/main/charts/bitbucket/README.md +++ b/src/main/charts/bitbucket/README.md @@ -122,20 +122,23 @@ Kubernetes: `>=1.21.x-0` | bitbucket.service.annotations | object | `{}` | Additional annotations to apply to the Service | | bitbucket.service.contextPath | string | `nil` | The context path that Bitbucket will use. | | bitbucket.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| bitbucket.service.nodePort | string | `nil` | NodePort for Bitbucket service | | bitbucket.service.port | int | `80` | The port on which the Bitbucket K8s HTTP Service will listen | | bitbucket.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | bitbucket.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | | bitbucket.service.sessionAffinityConfig.clientIP.timeoutSeconds | string | `nil` | Specifies the seconds of ClientIP type session sticky time. The value must be > 0 && <= 86400 (for 1 day) if ServiceAffinity == "ClientIP". Default value is 10800 (for 3 hours). | +| bitbucket.service.sshNodePort | string | `nil` | SSH NodePort for Bitbucket service | | bitbucket.service.sshPort | int | `7999` | The port on which the Bitbucket K8s SSH Service will listen | | bitbucket.service.type | string | `"ClusterIP"` | The type of K8s service to use for Bitbucket | | bitbucket.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Bitbucket container. Set to 'false' to disable this behaviour. | | bitbucket.shutdown.command | string | `"/shutdown-wait.sh"` | By default pods will be stopped via a [preStop hook](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/), using a script supplied by the Docker image. If any other shutdown behaviour is needed it can be achieved by overriding this value. Note that the shutdown command needs to wait for the application shutdown completely before exiting; see [the default command](https://bitbucket.org/atlassian-docker/docker-atlassian-bitbucket-server/src/master/shutdown-wait.sh) for details. | | bitbucket.shutdown.terminationGracePeriodSeconds | int | `35` | The termination grace period for pods during shutdown. This should be set to the Bitbucket internal grace period (default 30 seconds), plus a small buffer to allow the JVM to fully terminate. | -| bitbucket.sshService | object | `{"annotations":{},"enabled":false,"host":null,"loadBalancerIP":null,"port":22,"type":"LoadBalancer"}` | Enable or disable an additional service for exposing SSH for external access. Disable when the SSH service is exposed through the ingress controller, or enable if the ingress controller does not support TCP. | +| bitbucket.sshService | object | `{"annotations":{},"enabled":false,"host":null,"loadBalancerIP":null,"nodePort":null,"port":22,"type":"LoadBalancer"}` | Enable or disable an additional service for exposing SSH for external access. Disable when the SSH service is exposed through the ingress controller, or enable if the ingress controller does not support TCP. | | bitbucket.sshService.annotations | object | `{}` | Annotations for the SSH service. Useful if a load balancer controller needs extra annotations. | | bitbucket.sshService.enabled | bool | `false` | Set to 'true' if an additional SSH Service should be created | | bitbucket.sshService.host | string | `nil` | The hostname of the SSH service. If set, it'll be used to configure the SSH base URL for the application. | | bitbucket.sshService.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| bitbucket.sshService.nodePort | string | `nil` | NodePort for Bitbucket ssh service | | bitbucket.sshService.port | int | `22` | Port to expose the SSH service on. | | bitbucket.sshService.type | string | `"LoadBalancer"` | SSH Service type | | bitbucket.startupProbe.enabled | bool | `false` | Whether to apply the startupProbe check to pod. | diff --git a/src/main/charts/bitbucket/templates/service.yaml b/src/main/charts/bitbucket/templates/service.yaml index c238970d9..94de91984 100644 --- a/src/main/charts/bitbucket/templates/service.yaml +++ b/src/main/charts/bitbucket/templates/service.yaml @@ -25,10 +25,16 @@ spec: targetPort: http protocol: TCP name: http + {{- if and (eq .Values.bitbucket.service.type "NodePort") .Values.bitbucket.service.nodePort}} + nodePort: {{ .Values.bitbucket.service.nodePort }} + {{- end }} - port: {{ .Values.bitbucket.service.sshPort }} targetPort: ssh protocol: TCP name: ssh + {{- if and (eq .Values.bitbucket.service.type "NodePort") .Values.bitbucket.service.sshNodePort}} + nodePort: {{ .Values.bitbucket.service.sshNodePort }} + {{- end }} {{- if not .Values.bitbucket.hazelcastService.enabled }} - port: {{ .Values.bitbucket.ports.hazelcast }} targetPort: hazelcast diff --git a/src/main/charts/bitbucket/values.yaml b/src/main/charts/bitbucket/values.yaml index 40619f817..6e75faf17 100644 --- a/src/main/charts/bitbucket/values.yaml +++ b/src/main/charts/bitbucket/values.yaml @@ -542,6 +542,14 @@ bitbucket: # type: ClusterIP + # -- NodePort for Bitbucket service + # + nodePort: + + # -- SSH NodePort for Bitbucket service + # + sshNodePort: + # -- Session affinity type. If you want to make sure that connections from a particular client # are passed to the same pod each time, set sessionAffinity to ClientIP. # See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity @@ -593,6 +601,10 @@ bitbucket: # type: LoadBalancer + # -- NodePort for Bitbucket ssh service + # + nodePort: + # -- Use specific loadBalancerIP. Only applies to service type LoadBalancer. # loadBalancerIP: diff --git a/src/main/charts/confluence/README.md b/src/main/charts/confluence/README.md index e2b21565b..ff13ed8d7 100644 --- a/src/main/charts/confluence/README.md +++ b/src/main/charts/confluence/README.md @@ -88,6 +88,7 @@ Kubernetes: `>=1.21.x-0` | confluence.service.annotations | object | `{}` | Additional annotations to apply to the Service | | confluence.service.contextPath | string | `nil` | The Tomcat context path that Confluence will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | confluence.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| confluence.service.nodePort | string | `nil` | NodePort for Confluence service | | confluence.service.port | int | `80` | The port on which the Confluence K8s Service will listen | | confluence.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | confluence.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/confluence/templates/service.yaml b/src/main/charts/confluence/templates/service.yaml index eb7bee378..975f15ecf 100644 --- a/src/main/charts/confluence/templates/service.yaml +++ b/src/main/charts/confluence/templates/service.yaml @@ -24,6 +24,9 @@ spec: targetPort: http protocol: TCP name: http + {{- if and (eq .Values.confluence.service.type "NodePort") .Values.confluence.service.nodePort}} + nodePort: {{ .Values.confluence.service.nodePort }} + {{- end }} {{- if not .Values.confluence.hazelcastService.enabled }} - port: {{ .Values.confluence.ports.hazelcast }} targetPort: hazelcast diff --git a/src/main/charts/confluence/values.yaml b/src/main/charts/confluence/values.yaml index 8b4b6a52a..df216d0d1 100644 --- a/src/main/charts/confluence/values.yaml +++ b/src/main/charts/confluence/values.yaml @@ -583,6 +583,10 @@ confluence: # type: ClusterIP + # -- NodePort for Confluence service + # + nodePort: + # -- Session affinity type. If you want to make sure that connections from a particular client # are passed to the same pod each time, set sessionAffinity to ClientIP. # See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity diff --git a/src/main/charts/crowd/README.md b/src/main/charts/crowd/README.md index 103049212..ae9ae765b 100644 --- a/src/main/charts/crowd/README.md +++ b/src/main/charts/crowd/README.md @@ -70,6 +70,7 @@ Kubernetes: `>=1.21.x-0` | crowd.service.annotations | object | `{}` | Additional annotations to apply to the Service | | crowd.service.contextPath | string | `"/crowd"` | The Tomcat context path that Crowd will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | crowd.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| crowd.service.nodePort | string | `nil` | NodePort for Crowd service | | crowd.service.port | int | `80` | The port on which the Crowd K8s Service will listen | | crowd.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | crowd.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/crowd/templates/service.yaml b/src/main/charts/crowd/templates/service.yaml index 10853c0e2..2bae44d88 100644 --- a/src/main/charts/crowd/templates/service.yaml +++ b/src/main/charts/crowd/templates/service.yaml @@ -24,5 +24,8 @@ spec: targetPort: http protocol: TCP name: http + {{- if and (eq .Values.crowd.service.type "NodePort") .Values.crowd.service.nodePort}} + nodePort: {{ .Values.crowd.service.nodePort }} + {{- end }} selector: {{- include "common.labels.selectorLabels" . | nindent 4 }} diff --git a/src/main/charts/crowd/values.yaml b/src/main/charts/crowd/values.yaml index 155099fec..b128c32aa 100644 --- a/src/main/charts/crowd/values.yaml +++ b/src/main/charts/crowd/values.yaml @@ -116,6 +116,10 @@ crowd: # type: ClusterIP + # -- NodePort for Crowd service + # + nodePort: + # -- Session affinity type. If you want to make sure that connections from a particular client # are passed to the same pod each time, set sessionAffinity to ClientIP. # See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity diff --git a/src/main/charts/jira/README.md b/src/main/charts/jira/README.md index 827d478d5..9109aa514 100644 --- a/src/main/charts/jira/README.md +++ b/src/main/charts/jira/README.md @@ -121,6 +121,7 @@ Kubernetes: `>=1.21.x-0` | jira.service.annotations | object | `{}` | Additional annotations to apply to the Service | | jira.service.contextPath | string | `nil` | The Tomcat context path that Jira will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | jira.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| jira.service.nodePort | string | `nil` | NodePort for Jira service | | jira.service.port | int | `80` | The port on which the Jira K8s Service will listen | | jira.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | jira.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/jira/templates/service.yaml b/src/main/charts/jira/templates/service.yaml index 19d58a319..bf6da34d7 100644 --- a/src/main/charts/jira/templates/service.yaml +++ b/src/main/charts/jira/templates/service.yaml @@ -24,5 +24,8 @@ spec: targetPort: http protocol: TCP name: http + {{- if and (eq .Values.jira.service.type "NodePort") .Values.jira.service.nodePort}} + nodePort: {{ .Values.jira.service.nodePort }} + {{- end }} selector: {{- include "common.labels.selectorLabels" . | nindent 4 }} diff --git a/src/main/charts/jira/values.yaml b/src/main/charts/jira/values.yaml index c5ac207d1..0afb9f05f 100644 --- a/src/main/charts/jira/values.yaml +++ b/src/main/charts/jira/values.yaml @@ -473,6 +473,10 @@ jira: # type: ClusterIP + # -- NodePort for Jira service + # + nodePort: + # -- Session affinity type. If you want to make sure that connections from a particular client # are passed to the same pod each time, set sessionAffinity to ClientIP. # See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity diff --git a/src/test/java/test/ServiceTest.java b/src/test/java/test/ServiceTest.java index 8a5098922..8cacf98ff 100644 --- a/src/test/java/test/ServiceTest.java +++ b/src/test/java/test/ServiceTest.java @@ -30,7 +30,10 @@ void initHelm(TestInfo testInfo) { void service_port_type(Product product) throws Exception { final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of( product + ".service.port", "1234", - product + ".service.type", "NodePort" + product + ".service.type", "NodePort", + product + ".service.nodePort", "30001", + product + ".service.sshNodePort", "30002" + )); final var service = resources.get(Kind.Service, Service.class, product.getHelmReleaseName()); @@ -39,6 +42,12 @@ void service_port_type(Product product) throws Exception { .hasTextEqualTo("NodePort"); assertThat(service.getPort("http")) .hasValueSatisfying(node -> assertThat(node.path("port")).hasValueEqualTo(1234)); + assertThat(service.getPort("http")) + .hasValueSatisfying(node -> assertThat(node.path("nodePort")).hasValueEqualTo(30001)); + if (product.name().equals("bitbucket")) { + assertThat(service.getPort("ssh")) + .hasValueSatisfying(node -> assertThat(node.path("nodePort")).hasValueEqualTo(30002)); + } } @ParameterizedTest From a820bd746c7a988b504c96012289d05107b65378 Mon Sep 17 00:00:00 2001 From: Yevhen Ivantsov Date: Mon, 16 Dec 2024 18:11:39 +1100 Subject: [PATCH 2/5] Fix copy-pasted comment --- src/main/charts/bamboo/README.md | 2 +- src/main/charts/bamboo/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/charts/bamboo/README.md b/src/main/charts/bamboo/README.md index a96eedbba..b254bd6c0 100644 --- a/src/main/charts/bamboo/README.md +++ b/src/main/charts/bamboo/README.md @@ -87,7 +87,7 @@ Kubernetes: `>=1.21.x-0` | bamboo.service.annotations | object | `{}` | Additional annotations to apply to the Service | | bamboo.service.contextPath | string | `nil` | The Tomcat context path that Bamboo will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | bamboo.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| bamboo.service.nodePort | string | `nil` | NodePort for Bitbucket service | +| bamboo.service.nodePort | string | `nil` | NodePort for Bamboo service | | bamboo.service.port | int | `80` | The port on which the Bamboo K8s Service will listen for http traffic | | bamboo.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | bamboo.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/bamboo/values.yaml b/src/main/charts/bamboo/values.yaml index c0a17aa57..6e893bc2a 100644 --- a/src/main/charts/bamboo/values.yaml +++ b/src/main/charts/bamboo/values.yaml @@ -568,7 +568,7 @@ bamboo: # type: ClusterIP - # -- NodePort for Bitbucket service + # -- NodePort for Bamboo service # nodePort: From dc97ee9cee7dac88ee30e413c6f2d33a6fce7f80 Mon Sep 17 00:00:00 2001 From: Yevhen Ivantsov Date: Mon, 16 Dec 2024 18:17:13 +1100 Subject: [PATCH 3/5] Define nodeport for synchrony svc --- src/main/charts/confluence/README.md | 1 + src/main/charts/confluence/values.yaml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/main/charts/confluence/README.md b/src/main/charts/confluence/README.md index ff13ed8d7..7855c2f7c 100644 --- a/src/main/charts/confluence/README.md +++ b/src/main/charts/confluence/README.md @@ -224,6 +224,7 @@ Kubernetes: `>=1.21.x-0` | synchrony.securityContextEnabled | bool | `true` | | | synchrony.service.annotations | object | `{}` | Annotations to apply to Synchrony Service | | synchrony.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | +| synchrony.service.nodePort | string | `nil` | NodePort for Synchrony service | | synchrony.service.port | int | `80` | The port on which the Synchrony K8s Service will listen | | synchrony.service.type | string | `"ClusterIP"` | The type of K8s service to use for Synchrony | | synchrony.setPermissions | bool | `true` | Boolean to define whether to set synchrony home directory permissions on startup of Synchrony container. Set to 'false' to disable this behaviour. | diff --git a/src/main/charts/confluence/values.yaml b/src/main/charts/confluence/values.yaml index df216d0d1..b633f646d 100644 --- a/src/main/charts/confluence/values.yaml +++ b/src/main/charts/confluence/values.yaml @@ -1213,6 +1213,10 @@ synchrony: # type: ClusterIP + # -- NodePort for Synchrony service + # + nodePort: + # -- Use specific loadBalancerIP. Only applies to service type LoadBalancer. # loadBalancerIP: From 59405ce98b89a7f888ffc3b832f65837770cc57e Mon Sep 17 00:00:00 2001 From: Yevhen Ivantsov Date: Mon, 16 Dec 2024 18:18:25 +1100 Subject: [PATCH 4/5] Fix unit tests --- .../charts/confluence/templates/service-synchrony.yaml | 3 +++ src/test/java/test/ServiceTest.java | 8 +++++++- .../expected_helm_output/bamboo-agent/output.yaml | 2 +- .../resources/expected_helm_output/bamboo/output.yaml | 3 ++- .../resources/expected_helm_output/bitbucket/output.yaml | 7 +++++-- .../resources/expected_helm_output/confluence/output.yaml | 4 +++- src/test/resources/expected_helm_output/crowd/output.yaml | 3 ++- src/test/resources/expected_helm_output/jira/output.yaml | 3 ++- 8 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/main/charts/confluence/templates/service-synchrony.yaml b/src/main/charts/confluence/templates/service-synchrony.yaml index 4051d66e1..f14d6546a 100644 --- a/src/main/charts/confluence/templates/service-synchrony.yaml +++ b/src/main/charts/confluence/templates/service-synchrony.yaml @@ -26,6 +26,9 @@ spec: targetPort: http protocol: TCP name: http + {{- if and (eq .Values.synchrony.service.type "NodePort") .Values.synchrony.service.nodePort}} + nodePort: {{ .Values.synchrony.service.nodePort }} + {{- end }} - port: {{ .Values.synchrony.ports.hazelcast }} targetPort: hazelcast protocol: TCP diff --git a/src/test/java/test/ServiceTest.java b/src/test/java/test/ServiceTest.java index 8cacf98ff..b31186293 100644 --- a/src/test/java/test/ServiceTest.java +++ b/src/test/java/test/ServiceTest.java @@ -32,7 +32,8 @@ void service_port_type(Product product) throws Exception { product + ".service.port", "1234", product + ".service.type", "NodePort", product + ".service.nodePort", "30001", - product + ".service.sshNodePort", "30002" + product + ".service.sshNodePort", "30002", + "synchrony.enabled", "true" )); @@ -48,6 +49,11 @@ void service_port_type(Product product) throws Exception { assertThat(service.getPort("ssh")) .hasValueSatisfying(node -> assertThat(node.path("nodePort")).hasValueEqualTo(30002)); } + if (product.name().equals("confluence")) { + final var synchronyService = resources.get(Kind.Service, Service.class, product.getHelmReleaseName()); + assertThat(synchronyService.getPort("http")) + .hasValueSatisfying(node -> assertThat(node.path("nodePort")).hasValueEqualTo(30001)); + } } @ParameterizedTest diff --git a/src/test/resources/expected_helm_output/bamboo-agent/output.yaml b/src/test/resources/expected_helm_output/bamboo-agent/output.yaml index 3911c7223..2198c780a 100644 --- a/src/test/resources/expected_helm_output/bamboo-agent/output.yaml +++ b/src/test/resources/expected_helm_output/bamboo-agent/output.yaml @@ -46,7 +46,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 7840cc3e79fba7837aee076a182650b787c8f53f1919ec199b7adc3e7b1abccb + checksum/config-jvm: 8587a9721b627f0dfd7a359dbee53d0a010f75d293f03f5a160104dc9d15101a labels: app.kubernetes.io/name: bamboo-agent app.kubernetes.io/instance: unittest-bamboo-agent diff --git a/src/test/resources/expected_helm_output/bamboo/output.yaml b/src/test/resources/expected_helm_output/bamboo/output.yaml index f445c83ef..8dfcc0345 100644 --- a/src/test/resources/expected_helm_output/bamboo/output.yaml +++ b/src/test/resources/expected_helm_output/bamboo/output.yaml @@ -161,6 +161,7 @@ data: annotations: {} contextPath: null loadBalancerIP: null + nodePort: null port: 80 sessionAffinity: None sessionAffinityConfig: @@ -450,7 +451,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 3adff5bd3002b33d2f9ede62864902898e58a0ede65de2c485424c36e855f629 + checksum/config-jvm: c41bc799b8b23af6a3170c4635ef9fa71edb855f1d47e25eaa8e8acfa9ca43e1 labels: helm.sh/chart: bamboo-1.22.1 app.kubernetes.io/name: bamboo diff --git a/src/test/resources/expected_helm_output/bitbucket/output.yaml b/src/test/resources/expected_helm_output/bitbucket/output.yaml index 3caf5ca3e..463a31dca 100644 --- a/src/test/resources/expected_helm_output/bitbucket/output.yaml +++ b/src/test/resources/expected_helm_output/bitbucket/output.yaml @@ -233,11 +233,13 @@ data: annotations: {} contextPath: null loadBalancerIP: null + nodePort: null port: 80 sessionAffinity: None sessionAffinityConfig: clientIP: timeoutSeconds: null + sshNodePort: null sshPort: 7999 type: ClusterIP setPermissions: true @@ -249,6 +251,7 @@ data: enabled: false host: null loadBalancerIP: null + nodePort: null port: 22 type: LoadBalancer startupProbe: @@ -593,7 +596,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 325d0f8b0fb850d725ad0e9b17f9ffb5afe1e87176215d4c59afaa987034fbc4 + checksum/config-jvm: 2749f9462255f51e691b5c20440ba6926c4e36eede24448f852a4c9b9f3293fc labels: app.kubernetes.io/name: bitbucket-mesh app.kubernetes.io/instance: unittest-bitbucket @@ -714,7 +717,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 904ee5cdf24aa3f20010c1bd0a75de5c1755f2b4a68fb2361e1e36e8b8464eec + checksum/config-jvm: 769b21f2174a73dca3bd26f10a6ebcf67d6c70b9481a618d4d0808d6e40799d2 labels: helm.sh/chart: bitbucket-1.22.1 app.kubernetes.io/name: bitbucket diff --git a/src/test/resources/expected_helm_output/confluence/output.yaml b/src/test/resources/expected_helm_output/confluence/output.yaml index 0ee5aa712..e341c0c21 100644 --- a/src/test/resources/expected_helm_output/confluence/output.yaml +++ b/src/test/resources/expected_helm_output/confluence/output.yaml @@ -163,6 +163,7 @@ data: annotations: {} contextPath: null loadBalancerIP: null + nodePort: null port: 80 sessionAffinity: None sessionAffinityConfig: @@ -362,6 +363,7 @@ data: service: annotations: {} loadBalancerIP: null + nodePort: null port: 80 type: ClusterIP setPermissions: true @@ -637,7 +639,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 0be7e4380d8a71217f79c8ea3e714e9bbc003d9eb19cfe363980fe2f04087fbf + checksum/config-jvm: 12b2bf4a8a471b4be5acc06995810c8331609e8aa3f237e44dd62e27888f85df labels: helm.sh/chart: confluence-1.22.1 app.kubernetes.io/name: confluence diff --git a/src/test/resources/expected_helm_output/crowd/output.yaml b/src/test/resources/expected_helm_output/crowd/output.yaml index e71e5364c..db1203251 100644 --- a/src/test/resources/expected_helm_output/crowd/output.yaml +++ b/src/test/resources/expected_helm_output/crowd/output.yaml @@ -143,6 +143,7 @@ data: annotations: {} contextPath: /crowd loadBalancerIP: null + nodePort: null port: 80 sessionAffinity: None sessionAffinityConfig: @@ -374,7 +375,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 87bf8a70efc8e508ac8cef16c7ec7ed9a4383fbd561d0775996a538f82bda1ef + checksum/config-jvm: 959bd1ffef2f05dc8025f24a6c7e5af1d8c91b90d88d64f7b9e22b80d3553ec3 labels: helm.sh/chart: crowd-1.22.1 app.kubernetes.io/name: crowd diff --git a/src/test/resources/expected_helm_output/jira/output.yaml b/src/test/resources/expected_helm_output/jira/output.yaml index 1f8834877..cd011d8ad 100644 --- a/src/test/resources/expected_helm_output/jira/output.yaml +++ b/src/test/resources/expected_helm_output/jira/output.yaml @@ -203,6 +203,7 @@ data: annotations: {} contextPath: null loadBalancerIP: null + nodePort: null port: 80 sessionAffinity: None sessionAffinityConfig: @@ -401,7 +402,7 @@ spec: template: metadata: annotations: - checksum/config-jvm: 9874e836468ba673419d9305856e7570c1c7e752338d664e62b9d32180107b9a + checksum/config-jvm: 3294c8cdaf5ff4579163b6eaad63d6ce37838bc0101e7b903b1d2913c5a882a9 labels: helm.sh/chart: jira-1.22.1 app.kubernetes.io/name: jira From 4cb7f3343c05ef204780f4d9ea07881541730fb1 Mon Sep 17 00:00:00 2001 From: Yevhen Ivantsov Date: Tue, 17 Dec 2024 10:01:38 +1100 Subject: [PATCH 5/5] Add docs --- docs/docs/userguide/CONFIGURATION.md | 2 +- src/main/charts/bamboo/README.md | 2 +- src/main/charts/bamboo/values.yaml | 2 +- src/main/charts/bitbucket/README.md | 6 +++--- src/main/charts/bitbucket/values.yaml | 6 +++--- src/main/charts/confluence/README.md | 4 ++-- src/main/charts/confluence/values.yaml | 4 ++-- src/main/charts/crowd/README.md | 2 +- src/main/charts/crowd/values.yaml | 2 +- src/main/charts/jira/README.md | 2 +- src/main/charts/jira/values.yaml | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/docs/userguide/CONFIGURATION.md b/docs/docs/userguide/CONFIGURATION.md index a274c325d..9a1ae818a 100644 --- a/docs/docs/userguide/CONFIGURATION.md +++ b/docs/docs/userguide/CONFIGURATION.md @@ -56,7 +56,7 @@ jira: timeoutSeconds: 10800 ``` -The service port will be exposed on a random port from the ephemeral port range (`30000`-`32767`) on all worker nodes. You can provision a LoadBalancer with `443` or `80` (or both) listeners that will forward traffic to the node port (you can get service node port by running `kubectl describe $service -n $namespace`). Both LoadBalancer and Kubernetes service should be configured to maintain session affinity. LoadBalancer session affinity should be configured as per instructions for your Kubernetes/cloud provider. Service session affinity is configured by overriding the default Helm chart values (see the above example). Make sure you configure networking rules to allow the LoadBalancer to communicate with the Kubernetes cluster worker node on the node port. +The service port will be exposed on a random port from the ephemeral port range (`30000`-`32767`) on all worker nodes. It is possible to explicitly set NodePort in `service.nodePort` (make sure it's not reserved for any existing service in the cluster). You can provision a LoadBalancer with `443` or `80` (or both) listeners that will forward traffic to the node port (you can get service node port by running `kubectl describe $service -n $namespace`). Both LoadBalancer and Kubernetes service should be configured to maintain session affinity. LoadBalancer session affinity should be configured as per instructions for your Kubernetes/cloud provider. Service session affinity is configured by overriding the default Helm chart values (see the above example). Make sure you configure networking rules to allow the LoadBalancer to communicate with the Kubernetes cluster worker node on the node port. !!!tip For more information about Kubernetes service session affinity, see [Kubernetes documentation](https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity){.external}. diff --git a/src/main/charts/bamboo/README.md b/src/main/charts/bamboo/README.md index b254bd6c0..57fe0cb32 100644 --- a/src/main/charts/bamboo/README.md +++ b/src/main/charts/bamboo/README.md @@ -87,7 +87,7 @@ Kubernetes: `>=1.21.x-0` | bamboo.service.annotations | object | `{}` | Additional annotations to apply to the Service | | bamboo.service.contextPath | string | `nil` | The Tomcat context path that Bamboo will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | bamboo.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| bamboo.service.nodePort | string | `nil` | NodePort for Bamboo service | +| bamboo.service.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Bamboo service | | bamboo.service.port | int | `80` | The port on which the Bamboo K8s Service will listen for http traffic | | bamboo.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | bamboo.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/bamboo/values.yaml b/src/main/charts/bamboo/values.yaml index 6e893bc2a..5945e902f 100644 --- a/src/main/charts/bamboo/values.yaml +++ b/src/main/charts/bamboo/values.yaml @@ -568,7 +568,7 @@ bamboo: # type: ClusterIP - # -- NodePort for Bamboo service + # -- Only applicable if service.type is NodePort. NodePort for Bamboo service # nodePort: diff --git a/src/main/charts/bitbucket/README.md b/src/main/charts/bitbucket/README.md index faeb43018..1d8d1fc61 100644 --- a/src/main/charts/bitbucket/README.md +++ b/src/main/charts/bitbucket/README.md @@ -122,12 +122,12 @@ Kubernetes: `>=1.21.x-0` | bitbucket.service.annotations | object | `{}` | Additional annotations to apply to the Service | | bitbucket.service.contextPath | string | `nil` | The context path that Bitbucket will use. | | bitbucket.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| bitbucket.service.nodePort | string | `nil` | NodePort for Bitbucket service | +| bitbucket.service.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Bitbucket service | | bitbucket.service.port | int | `80` | The port on which the Bitbucket K8s HTTP Service will listen | | bitbucket.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | bitbucket.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | | bitbucket.service.sessionAffinityConfig.clientIP.timeoutSeconds | string | `nil` | Specifies the seconds of ClientIP type session sticky time. The value must be > 0 && <= 86400 (for 1 day) if ServiceAffinity == "ClientIP". Default value is 10800 (for 3 hours). | -| bitbucket.service.sshNodePort | string | `nil` | SSH NodePort for Bitbucket service | +| bitbucket.service.sshNodePort | string | `nil` | SSH Only applicable if service.type is NodePort. NodePort for Bitbucket service | | bitbucket.service.sshPort | int | `7999` | The port on which the Bitbucket K8s SSH Service will listen | | bitbucket.service.type | string | `"ClusterIP"` | The type of K8s service to use for Bitbucket | | bitbucket.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Bitbucket container. Set to 'false' to disable this behaviour. | @@ -138,7 +138,7 @@ Kubernetes: `>=1.21.x-0` | bitbucket.sshService.enabled | bool | `false` | Set to 'true' if an additional SSH Service should be created | | bitbucket.sshService.host | string | `nil` | The hostname of the SSH service. If set, it'll be used to configure the SSH base URL for the application. | | bitbucket.sshService.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| bitbucket.sshService.nodePort | string | `nil` | NodePort for Bitbucket ssh service | +| bitbucket.sshService.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Bitbucket ssh service | | bitbucket.sshService.port | int | `22` | Port to expose the SSH service on. | | bitbucket.sshService.type | string | `"LoadBalancer"` | SSH Service type | | bitbucket.startupProbe.enabled | bool | `false` | Whether to apply the startupProbe check to pod. | diff --git a/src/main/charts/bitbucket/values.yaml b/src/main/charts/bitbucket/values.yaml index 6e75faf17..180110fcc 100644 --- a/src/main/charts/bitbucket/values.yaml +++ b/src/main/charts/bitbucket/values.yaml @@ -542,11 +542,11 @@ bitbucket: # type: ClusterIP - # -- NodePort for Bitbucket service + # -- Only applicable if service.type is NodePort. NodePort for Bitbucket service # nodePort: - # -- SSH NodePort for Bitbucket service + # -- SSH Only applicable if service.type is NodePort. NodePort for Bitbucket service # sshNodePort: @@ -601,7 +601,7 @@ bitbucket: # type: LoadBalancer - # -- NodePort for Bitbucket ssh service + # -- Only applicable if service.type is NodePort. NodePort for Bitbucket ssh service # nodePort: diff --git a/src/main/charts/confluence/README.md b/src/main/charts/confluence/README.md index 7855c2f7c..354eab9b7 100644 --- a/src/main/charts/confluence/README.md +++ b/src/main/charts/confluence/README.md @@ -88,7 +88,7 @@ Kubernetes: `>=1.21.x-0` | confluence.service.annotations | object | `{}` | Additional annotations to apply to the Service | | confluence.service.contextPath | string | `nil` | The Tomcat context path that Confluence will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | confluence.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| confluence.service.nodePort | string | `nil` | NodePort for Confluence service | +| confluence.service.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Confluence service | | confluence.service.port | int | `80` | The port on which the Confluence K8s Service will listen | | confluence.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | confluence.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | @@ -224,7 +224,7 @@ Kubernetes: `>=1.21.x-0` | synchrony.securityContextEnabled | bool | `true` | | | synchrony.service.annotations | object | `{}` | Annotations to apply to Synchrony Service | | synchrony.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| synchrony.service.nodePort | string | `nil` | NodePort for Synchrony service | +| synchrony.service.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Synchrony service | | synchrony.service.port | int | `80` | The port on which the Synchrony K8s Service will listen | | synchrony.service.type | string | `"ClusterIP"` | The type of K8s service to use for Synchrony | | synchrony.setPermissions | bool | `true` | Boolean to define whether to set synchrony home directory permissions on startup of Synchrony container. Set to 'false' to disable this behaviour. | diff --git a/src/main/charts/confluence/values.yaml b/src/main/charts/confluence/values.yaml index b633f646d..de3b5d154 100644 --- a/src/main/charts/confluence/values.yaml +++ b/src/main/charts/confluence/values.yaml @@ -583,7 +583,7 @@ confluence: # type: ClusterIP - # -- NodePort for Confluence service + # -- Only applicable if service.type is NodePort. NodePort for Confluence service # nodePort: @@ -1213,7 +1213,7 @@ synchrony: # type: ClusterIP - # -- NodePort for Synchrony service + # -- Only applicable if service.type is NodePort. NodePort for Synchrony service # nodePort: diff --git a/src/main/charts/crowd/README.md b/src/main/charts/crowd/README.md index ae9ae765b..7b5580710 100644 --- a/src/main/charts/crowd/README.md +++ b/src/main/charts/crowd/README.md @@ -70,7 +70,7 @@ Kubernetes: `>=1.21.x-0` | crowd.service.annotations | object | `{}` | Additional annotations to apply to the Service | | crowd.service.contextPath | string | `"/crowd"` | The Tomcat context path that Crowd will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | crowd.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| crowd.service.nodePort | string | `nil` | NodePort for Crowd service | +| crowd.service.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Crowd service | | crowd.service.port | int | `80` | The port on which the Crowd K8s Service will listen | | crowd.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | crowd.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/crowd/values.yaml b/src/main/charts/crowd/values.yaml index b128c32aa..25e12f326 100644 --- a/src/main/charts/crowd/values.yaml +++ b/src/main/charts/crowd/values.yaml @@ -116,7 +116,7 @@ crowd: # type: ClusterIP - # -- NodePort for Crowd service + # -- Only applicable if service.type is NodePort. NodePort for Crowd service # nodePort: diff --git a/src/main/charts/jira/README.md b/src/main/charts/jira/README.md index 9109aa514..0199ac3d3 100644 --- a/src/main/charts/jira/README.md +++ b/src/main/charts/jira/README.md @@ -121,7 +121,7 @@ Kubernetes: `>=1.21.x-0` | jira.service.annotations | object | `{}` | Additional annotations to apply to the Service | | jira.service.contextPath | string | `nil` | The Tomcat context path that Jira will use. The ATL_TOMCAT_CONTEXTPATH will be set automatically. | | jira.service.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. | -| jira.service.nodePort | string | `nil` | NodePort for Jira service | +| jira.service.nodePort | string | `nil` | Only applicable if service.type is NodePort. NodePort for Jira service | | jira.service.port | int | `80` | The port on which the Jira K8s Service will listen | | jira.service.sessionAffinity | string | `"None"` | Session affinity type. If you want to make sure that connections from a particular client are passed to the same pod each time, set sessionAffinity to ClientIP. See: https://kubernetes.io/docs/reference/networking/virtual-ips/#session-affinity | | jira.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration | diff --git a/src/main/charts/jira/values.yaml b/src/main/charts/jira/values.yaml index 0afb9f05f..cf6ab2493 100644 --- a/src/main/charts/jira/values.yaml +++ b/src/main/charts/jira/values.yaml @@ -473,7 +473,7 @@ jira: # type: ClusterIP - # -- NodePort for Jira service + # -- Only applicable if service.type is NodePort. NodePort for Jira service # nodePort: