Skip to content

Commit

Permalink
Allow setting subPath for local-home volumes (#947)
Browse files Browse the repository at this point in the history
* Allow setting subPath for local-home volumes

* Update test output

---------

Co-authored-by: yivan-atl <[email protected]>
Co-authored-by: Yevhen Ivantsov <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2025
1 parent 2dda72a commit 5ef02ab
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/charts/bamboo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ on Tomcat's logs directory. THis ensures that Tomcat+Bamboo logs get captured in
{{ define "bamboo.volumeMounts" }}
- name: local-home
mountPath: {{ .Values.volumes.localHome.mountPath | quote }}
{{- if .Values.volumes.localHome.subPath }}
subPath: {{ .Values.volumes.localHome.subPath | quote }}
{{- end }}
- name: local-home
mountPath: {{ .Values.bamboo.accessLog.mountPath | quote }}
subPath: {{ .Values.bamboo.accessLog.localHomeSubPath | quote }}
Expand Down
5 changes: 5 additions & 0 deletions src/main/charts/bamboo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ volumes:
#
mountPath: "/var/atlassian/application-data/bamboo"

# -- Specifies the sub-directory of the local-home volume that will be mounted in to the
# Bamboo container.
#
subPath:

# A volume for 'shared-home' is required by Bamboo to effectively operate in multi-node
# environment
# https://confluence.atlassian.com/bamboo/bamboo-data-center-requirements-1063170547.html#BambooDataCenterrequirements-Sharedfilesystem
Expand Down
3 changes: 3 additions & 0 deletions src/main/charts/bitbucket/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ spec:
volumeMounts:
- name: local-home
mountPath: {{ .Values.volumes.localHome.mountPath | quote }}
{{- if .Values.volumes.localHome.subPath }}
subPath: {{ .Values.volumes.localHome.subPath | quote }}
{{- end }}
{{/* jmxExporter is saved to shared home but mirrors don't have one, so we need at least emptyDir */}}
{{- if or .Values.volumes.sharedHome.persistentVolumeClaim.create .Values.volumes.sharedHome.customVolume
(and (eq .Values.bitbucket.applicationMode "mirror") .Values.monitoring.exposeJmxMetrics) }}
Expand Down
5 changes: 5 additions & 0 deletions src/main/charts/bitbucket/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ volumes:
#
mountPath: "/var/atlassian/application-data/bitbucket"

# -- Specifies the sub-directory of the local-home volume that will be mounted in to the
# Bitbucket container.
#
subPath:

# An NFS volume for 'shared-home' is required by Bitbucket to effectively operate in multi-node
# environment.
#
Expand Down
3 changes: 3 additions & 0 deletions src/main/charts/confluence/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ on Tomcat's logs directory. THis ensures that Tomcat+Confluence logs get capture
{{ define "confluence.volumeMounts" }}
- name: local-home
mountPath: {{ .Values.volumes.localHome.mountPath | quote }}
{{- if .Values.volumes.localHome.subPath }}
subPath: {{ .Values.volumes.localHome.subPath | quote }}
{{- end }}
- name: local-home
mountPath: {{ .Values.confluence.accessLog.mountPath | quote }}
subPath: {{ .Values.confluence.accessLog.localHomeSubPath | quote }}
Expand Down
5 changes: 5 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ volumes:
#
mountPath: "/var/atlassian/application-data/confluence"

# -- Specifies the sub-directory of the local-home volume that will be mounted in to the
# Confluence container.
#
subPath:

# A volume for 'shared-home' is required by Confluence to effectively operate in multi-node
# environment
# https://confluence.atlassian.com/doc/set-up-a-confluence-data-center-cluster-982322030.html#SetupaConfluenceDataCentercluster-Setupandconfigureyourcluster
Expand Down
3 changes: 3 additions & 0 deletions src/main/charts/crowd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ on Tomcat's logs directory. THis ensures that Tomcat+Crowd logs get captured in
{{ define "crowd.volumeMounts" }}
- name: local-home
mountPath: {{ .Values.volumes.localHome.mountPath | quote }}
{{- if .Values.volumes.localHome.subPath }}
subPath: {{ .Values.volumes.localHome.subPath | quote }}
{{- end }}
- name: local-home
mountPath: {{ .Values.crowd.accessLog.mountPath | quote }}
subPath: {{ .Values.crowd.accessLog.localHomeSubPath | quote }}
Expand Down
5 changes: 5 additions & 0 deletions src/main/charts/crowd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,11 @@ volumes:
#
mountPath: "/var/atlassian/application-data/crowd"

# -- Specifies the sub-directory of the local-home volume that will be mounted in to the
# Crowd container.
#
subPath:

# A volume for 'shared-home' is required by Crowd to effectively operate in multi-node
# environment
# https://crowd.atlassian.com/doc/set-up-a-crowd-data-center-cluster-982322030.html#SetupaCrowdDataCentercluster-Setupandconfigureyourcluster
Expand Down
3 changes: 3 additions & 0 deletions src/main/charts/jira/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ on Tomcat's logs directory. THis ensures that Tomcat+Jira logs get captured in t
{{ define "jira.volumeMounts" }}
- name: local-home
mountPath: {{ .Values.volumes.localHome.mountPath | quote }}
{{- if .Values.volumes.localHome.subPath }}
subPath: {{ .Values.volumes.localHome.subPath | quote }}
{{- end }}
- name: local-home
mountPath: {{ .Values.jira.accessLog.mountPath | quote }}
subPath: {{ .Values.jira.accessLog.localHomeSubPath | quote }}
Expand Down
5 changes: 5 additions & 0 deletions src/main/charts/jira/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ volumes:
#
mountPath: "/var/atlassian/application-data/jira"

# -- Specifies the sub-directory of the local-home volume that will be mounted in to the
# Jira container.
#
subPath:

# A volume for 'shared-home' is required by Jira to effectively operate in multi-node
# environment
# https://confluence.atlassian.com/adminjiraserver/set-up-a-jira-data-center-cluster-993929600.html
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/test/VolumesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ void localHome_pvc_custom(Product product) throws Exception {
"volumes.localHome.persistentVolumeClaim.create", "true",
"volumes.localHome.persistentVolumeClaim.storageClassName", "foo",
"volumes.localHome.persistentVolumeClaim.resources.requests.storage", "2Gi",
"volumes.localHome.mountPath", "/foo/bar"));
"volumes.localHome.mountPath", "/foo/bar",
"volumes.localHome.subPath", "sub"));

final var statefulSet = resources.getStatefulSet(product.getHelmReleaseName());

Expand All @@ -127,6 +128,7 @@ void localHome_pvc_custom(Product product) throws Exception {
final var mount = statefulSet.getContainer().getVolumeMount("local-home");
assertThat(mount.get("name")).hasTextEqualTo("local-home");
assertThat(mount.get("mountPath")).hasTextEqualTo("/foo/bar");
assertThat(mount.get("subPath")).hasTextEqualTo("sub");
}

@ParameterizedTest
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/expected_helm_output/bamboo/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ data:
persistentVolumeClaimRetentionPolicy:
whenDeleted: null
whenScaled: null
subPath: null
sharedHome:
customVolume: {}
mountPath: /var/atlassian/application-data/shared-home
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ data:
persistentVolumeClaimRetentionPolicy:
whenDeleted: null
whenScaled: null
subPath: null
sharedHome:
customVolume: {}
mountPath: /var/atlassian/application-data/shared-home
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ data:
persistentVolumeClaimRetentionPolicy:
whenDeleted: null
whenScaled: null
subPath: null
sharedHome:
customVolume: {}
mountPath: /var/atlassian/application-data/shared-home
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/expected_helm_output/crowd/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ data:
persistentVolumeClaimRetentionPolicy:
whenDeleted: null
whenScaled: null
subPath: null
sharedHome:
customVolume: {}
mountPath: /var/atlassian/application-data/crowd/shared
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/expected_helm_output/jira/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ data:
persistentVolumeClaimRetentionPolicy:
whenDeleted: null
whenScaled: null
subPath: null
sharedHome:
customVolume: {}
mountPath: /var/atlassian/application-data/shared-home
Expand Down

0 comments on commit 5ef02ab

Please sign in to comment.