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

Added synchrony.service.url option #965

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/charts/confluence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ Kubernetes: `>=1.21.x-0`
| 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.service.url | string | `nil` | Complete URL of Synchrony Service (i.e. https://public.mydomain.com/synchrony). If left empty, it is calculated from ingress.https and ingress.host |
| 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. |
| synchrony.shutdown.terminationGracePeriodSeconds | int | `25` | The termination grace period for pods during shutdown. This should be set to the Synchrony internal grace period (default 20 seconds), plus a small buffer to allow the JVM to fully terminate. |
| synchrony.tolerations | list | `[]` | Standard K8s tolerations that will be applied to all Synchrony pods |
Expand Down
7 changes: 5 additions & 2 deletions src/main/charts/confluence/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,11 @@ Pod labels
{{- $synchronyIngressPath = regexReplaceAll $sanitizePathRegex .Values.synchrony.ingress.path "" }}
{{- end }}
{{- if .Values.synchrony.enabled -}}
{{- if .Values.ingress.https -}}-Dsynchrony.service.url=https://{{ .Values.ingress.host }}/{{ $synchronyIngressPath }}/v1
{{- else }}-Dsynchrony.service.url=http://{{ .Values.ingress.host }}/{{ $synchronyIngressPath }}/v1
{{- if .Values.synchrony.service.url -}}-Dsynchrony.service.url={{ .Values.synchrony.service.url }}/v1
{{- else -}}
{{- if .Values.ingress.https -}}-Dsynchrony.service.url=https://{{ .Values.ingress.host }}/{{ $synchronyIngressPath }}/v1
{{- else }}-Dsynchrony.service.url=http://{{ .Values.ingress.host }}/{{ $synchronyIngressPath }}/v1
{{- end }}
{{- end }}
{{- else -}}
-Dsynchrony.btf.disabled=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,16 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SYNCHRONY_SERVICE_URL
{{ if .Values.ingress.https }}
value: "https://{{ .Values.ingress.host }}/synchrony"
- name: SYNCHRONY_SERVICE_URL
{{ if .Values.synchrony.service.url }}
value: "{{ .Values.synchrony.service.url }}"
{{ else }}
value: "http://{{ .Values.ingress.host }}/synchrony"
{{- end }}
{{ if .Values.ingress.https }}
value: "https://{{ .Values.ingress.host }}/synchrony"
{{ else }}
value: "http://{{ .Values.ingress.host }}/synchrony"
{{- end }}
{{ end }}
{{- include "synchrony.databaseEnvVars" . | nindent 12 }}
{{- include "synchrony.clusteringEnvVars" . | nindent 12 }}
{{- if .Values.synchrony.nodeSelector }}
Expand Down
3 changes: 3 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,9 @@ synchrony:
#
annotations: {}

# -- Complete URL of Synchrony Service (i.e. https://public.mydomain.com/synchrony). If left empty, it is calculated from ingress.https and ingress.host
url:

# -- If 'synchrony.ingress.path' is defined, a dedicated Synchrony ingress object is created.
# This is useful if you need to deploy multiple instances of Confluence with Synchrony enabled
# using the same Ingress hostname and different synchrony paths
Expand Down
27 changes: 27 additions & 0 deletions src/test/java/test/SynchronyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,31 @@ void synchrony_confluence_topology_constraints(Product product) throws Exception
assertThat(topologySpreadConstraints.get(0).get("whenUnsatisfiable")).hasTextContaining("ScheduleAnyway");
assertThat(topologySpreadConstraints.get(0).get("labelSelector").get("matchLabels").get("myLabel")).hasTextContaining("mySelector");
}

@ParameterizedTest
@EnumSource(value = Product.class, names = "confluence")
void synchrony_service_url(Product product) throws Exception {
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
"synchrony.enabled", "true",
"ingress.host", "atlassian.net",
"ingress.path", "confluence",
"ingress.https", "false",
"synchrony.service.url", "https://atlassian.net/synchrony",
));

resources.assertContains(Kind.StatefulSet, product.getHelmReleaseName() + "-synchrony");
resources.assertContains(Kind.Service, product.getHelmReleaseName() + "-synchrony");

final var sysProps = resources.get(Kind.ConfigMap, product.getHelmReleaseName() + "-jvm-config")
.getNode("data", "additional_jvm_args");

assertThat(sysProps)
.hasTextContaining("-Dsynchrony.service.url=https://atlassian.net/synchrony/v1")
.hasTextNotContaining("-Dsynchrony.service.url=http://atlassian.net/synchrony/v1");

resources.getStatefulSet(product.getHelmReleaseName() + "-synchrony")
.getContainer()
.getEnv()
.assertHasValue("SYNCHRONY_SERVICE_URL", "https://atlassian.net/synchrony/v1");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ data:
nodePort: null
port: 80
type: ClusterIP
url: null
setPermissions: true
shutdown:
terminationGracePeriodSeconds: 25
Expand Down
Loading