Skip to content

Commit 179bbaa

Browse files
authored
Configure jira session timeout (#987)
* Make Jira session timeout configurable * Add default test * Fix comment --------- Co-authored-by: Yevhen Ivantsov <[email protected]>
1 parent 6bc446c commit 179bbaa

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

docs/docs/containers/JIRA.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ as a non-root user.
519519

520520
See: [How to clear Jira's plugin cache](https://confluence.atlassian.com/jirakb/how-to-clear-jira-s-plugin-cache-1157468195.html).
521521

522+
* `ATL_JIRA_SESSION_TIMEOUT`
523+
524+
The default Tomcat session timeout (in minutes) for all newly created sessions which is set in web.xml. Defaults to 30.
525+
522526
### Advanced Configuration
523527

524528
As mentioned at the top of this section, the settings from the environment are

src/main/charts/jira/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Kubernetes: `>=1.21.x-0`
131131
| jira.service.sessionAffinityConfig | object | `{"clientIP":{"timeoutSeconds":null}}` | Session affinity configuration |
132132
| jira.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). |
133133
| jira.service.type | string | `"ClusterIP"` | The type of K8s service to use for Jira |
134+
| jira.session.timeout | string | `nil` | User session timeout. Set to 30 minutes in web.xml |
134135
| jira.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Jira container. Set to 'false' to disable this behaviour. |
135136
| jira.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-jira/src/master/shutdown-wait.sh) for details. |
136137
| jira.shutdown.terminationGracePeriodSeconds | int | `30` | The termination grace period for pods during shutdown. This should be set to the internal grace period, plus a small buffer to allow the JVM to fully terminate. |

src/main/charts/jira/templates/statefulset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ spec:
122122
image: {{ include "jira.image" . | quote }}
123123
imagePullPolicy: {{ .Values.image.pullPolicy }}
124124
env:
125+
{{- if .Values.jira.session.timeout }}
126+
- name: ATL_JIRA_SESSION_TIMEOUT
127+
value: {{ .Values.jira.session.timeout | quote }}
128+
{{- end }}
125129
{{- include "jira.tunnelVars" . | nindent 12 }}
126130
{{ if .Values.ingress.https }}
127131
- name: ATL_TOMCAT_SCHEME

src/main/charts/jira/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,12 @@ jira:
712712
#
713713
endpointOverride:
714714

715+
session:
716+
717+
# -- User session timeout. Set to 30 minutes in web.xml
718+
#
719+
timeout:
720+
715721
# Data Center clustering
716722
#
717723
clustering:

src/test/java/test/ContainersTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,28 @@ void nfx_permission_fixer_container_default_custom_resources(Product product) th
133133
assertThat(nfsPermissionFixerContainer.get("resources").get("limits").get("cpu")).hasValueEqualTo(2);
134134
assertThat(nfsPermissionFixerContainer.get("resources").get("limits").get("memory")).hasTextEqualTo("3Gi");
135135
}
136+
137+
@ParameterizedTest
138+
@EnumSource(value = Product.class, names = {"jira"}, mode = EnumSource.Mode.INCLUDE)
139+
void jira_session_timeout(Product product) throws Exception {
140+
final var pname = product.name().toLowerCase();
141+
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
142+
pname+".session.timeout", "60"
143+
));
144+
145+
final var statefulSet = resources.getStatefulSet(product.getHelmReleaseName());
146+
final var env = statefulSet.getContainer().getEnv();
147+
env.assertHasValue("ATL_JIRA_SESSION_TIMEOUT", "60");
148+
}
149+
150+
@ParameterizedTest
151+
@EnumSource(value = Product.class, names = {"jira"}, mode = EnumSource.Mode.INCLUDE)
152+
void jira_session_timeout_default(Product product) throws Exception {
153+
final var pname = product.name().toLowerCase();
154+
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of());
155+
156+
final var statefulSet = resources.getStatefulSet(product.getHelmReleaseName());
157+
final var env = statefulSet.getContainer().getEnv();
158+
env.assertDoesNotHaveAnyOf("ATL_JIRA_SESSION_TIMEOUT");
159+
}
136160
}

src/test/resources/expected_helm_output/jira/output.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ data:
213213
clientIP:
214214
timeoutSeconds: null
215215
type: ClusterIP
216+
session:
217+
timeout: null
216218
setPermissions: true
217219
shutdown:
218220
command: /shutdown-wait.sh

0 commit comments

Comments
 (0)