Skip to content

Commit

Permalink
CLIP-1911: Make shared home pvc access mode configurable (#855)
Browse files Browse the repository at this point in the history
* CLIP-1911: Made shared home pvc access mode configurable for Crowd.

* CLIP-1911: Made shared home pvc access mode configurable for other products.

* CLIP-1911: Added unit tests.

* CLIP-1911: Fixed unit tests.

* CLIP-1911: Updated docs.

* CLIP-1911: Fixed space line.

* CLIP-1911: Added comment regarding the usage of RWO access mode.
  • Loading branch information
yzha645 authored Aug 9, 2024
1 parent 22ed01f commit c0bb8bc
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 28 deletions.
7 changes: 3 additions & 4 deletions src/main/charts/bamboo-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A chart for installing Bamboo Data Center remote agents on Kubernetes

For installation please follow [the documentation](https://atlassian.github.io/data-center-helm-charts/).

**Homepage:** <https://www.atlassian.com/software/bamboo>

## Source Code
Expand Down Expand Up @@ -69,7 +71,4 @@ Kubernetes: `>=1.21.x-0`
| serviceAccount.imagePullSecrets | list | `[]` | For Docker images hosted in private registries, define the list of image pull secrets that should be utilized by the created ServiceAccount https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod |
| serviceAccount.name | string | `nil` | The name of the ServiceAccount to be used by the pods. If not specified, but the "serviceAccount.create" flag is set to 'true', then the ServiceAccount name will be auto-generated, otherwise the 'default' ServiceAccount will be used. https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server |
| tolerations | list | `[]` | Standard K8s tolerations that will be applied to all Bamboo agent pods |
| volumes | object | `{"additional":null}` | Defines additional volumes that should be applied to all Bamboo agent pods. Note that this will not create any corresponding volume mounts which need to be defined in bamboo.additionalVolumeMounts |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| volumes | object | `{"additional":null}` | Defines additional volumes that should be applied to all Bamboo agent pods. Note that this will not create any corresponding volume mounts which need to be defined in bamboo.additionalVolumeMounts |
8 changes: 4 additions & 4 deletions src/main/charts/bamboo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A chart for installing Bamboo Data Center on Kubernetes

For installation please follow [the documentation](https://atlassian.github.io/data-center-helm-charts/).

**Homepage:** <https://www.atlassian.com/software/bamboo>

## Source Code
Expand Down Expand Up @@ -198,10 +200,8 @@ Kubernetes: `>=1.21.x-0`
| volumes.sharedHome.nfsPermissionFixer.imageTag | string | `"latest"` | Image tag for the permission fixer init container. Defaults to latest |
| volumes.sharedHome.nfsPermissionFixer.mountPath | string | `"/shared-home"` | The path in the K8s initContainer where the shared-home volume will be mounted |
| volumes.sharedHome.nfsPermissionFixer.resources | object | `{}` | Resources requests and limits for nfsPermissionFixer init container See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
| volumes.sharedHome.persistentVolumeClaim.accessModes | list | `["ReadWriteMany"]` | Specify the access modes that should be used for the 'shared-home' volume claim. Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations. Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable. https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes |
| volumes.sharedHome.persistentVolumeClaim.create | bool | `false` | If 'true', then a 'PersistentVolumeClaim' and 'PersistentVolume' will be dynamically created for shared-home based on the 'StorageClassName' supplied below. |
| volumes.sharedHome.persistentVolumeClaim.resources | object | `{"requests":{"storage":"1Gi"}}` | Specifies the standard K8s resource requests and/or limits for the shared-home volume claims. |
| volumes.sharedHome.persistentVolumeClaim.storageClassName | string | `nil` | Specify the name of the 'StorageClass' that should be used for the 'shared-home' volume claim. |
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Bamboo container. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Bamboo container. |
4 changes: 3 additions & 1 deletion src/main/charts/bamboo/templates/shared-home-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ metadata:
{{- include "common.labels.commonLabels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteMany
{{ range .Values.volumes.sharedHome.persistentVolumeClaim.accessModes }}
- {{ . }}
{{ end }}
{{- if .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName }}
storageClassName: {{ .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName | quote }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions src/main/charts/bamboo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ volumes:
#
create: false

# -- Specify the access modes that should be used for the 'shared-home' volume claim.
# Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations.
# Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable.
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes
#
accessModes:
- ReadWriteMany

# -- Specify the name of the 'StorageClass' that should be used for the 'shared-home'
#volume claim.
#
Expand Down
7 changes: 3 additions & 4 deletions src/main/charts/bitbucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A chart for installing Bitbucket Data Center on Kubernetes

For installation please follow [the documentation](https://atlassian.github.io/data-center-helm-charts/).

**Homepage:** <https://atlassian.github.io/data-center-helm-charts/>

## Source Code
Expand Down Expand Up @@ -256,7 +258,4 @@ Kubernetes: `>=1.21.x-0`
| volumes.sharedHome.persistentVolumeClaim.resources | object | `{"requests":{"storage":"1Gi"}}` | Specifies the standard K8s resource requests and/or limits for the shared-home volume claims. |
| volumes.sharedHome.persistentVolumeClaim.storageClassName | string | `nil` | Specify the name of the 'StorageClass' that should be used If set to non-empty string value, this will specify the storage class to be used. If left without value, the default Storage Class will be utilised. Alternatively, can be set to the empty string "", to indicate that no Storage Class should be used here. |
| volumes.sharedHome.persistentVolumeClaim.volumeName | string | `nil` | If persistentVolume.create and persistentVolumeClaim.create are both true then any value supplied here is ignored and the default used. A custom value here is useful when bringing your own 'PersistentVolume' i.e. 'persistentVolume.create' is false. |
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Bitbucket container. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Bitbucket container. |
8 changes: 4 additions & 4 deletions src/main/charts/confluence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A chart for installing Confluence Data Center on Kubernetes

For installation please follow [the documentation](https://atlassian.github.io/data-center-helm-charts/).

**Homepage:** <https://atlassian.github.io/data-center-helm-charts/>

## Source Code
Expand Down Expand Up @@ -243,6 +245,7 @@ Kubernetes: `>=1.21.x-0`
| volumes.sharedHome.nfsPermissionFixer.imageTag | string | `"latest"` | Image tag for the permission fixer init container. Defaults to latest |
| volumes.sharedHome.nfsPermissionFixer.mountPath | string | `"/shared-home"` | The path in the K8s initContainer where the shared-home volume will be mounted |
| volumes.sharedHome.nfsPermissionFixer.resources | object | `{}` | Resources requests and limits for nfsPermissionFixer init container See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
| volumes.sharedHome.persistentVolumeClaim.accessModes | list | `["ReadWriteMany"]` | Specify the access modes that should be used for the 'shared-home' volume claim. Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations. Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable. https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes |
| volumes.sharedHome.persistentVolumeClaim.create | bool | `false` | If 'true', then a 'PersistentVolumeClaim' and 'PersistentVolume' will be dynamically created for shared-home based on the 'StorageClassName' supplied below. |
| volumes.sharedHome.persistentVolumeClaim.resources | object | `{"requests":{"storage":"1Gi"}}` | Specifies the standard K8s resource requests limits for the shared-home volume claims. |
| volumes.sharedHome.persistentVolumeClaim.storageClassName | string | `nil` | Specify the name of the 'StorageClass' that should be used for the 'shared-home' volume claim. |
Expand All @@ -253,7 +256,4 @@ Kubernetes: `>=1.21.x-0`
| volumes.synchronyHome.persistentVolumeClaim.resources | object | `{"requests":{"storage":"1Gi"}}` | Specifies the standard K8s resource requests for the synchrony-home volume claims. |
| volumes.synchronyHome.persistentVolumeClaim.storageClassName | string | `nil` | Specify the name of the 'StorageClass' that should be used for the synchrony-home volume claim. |
| volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenDeleted | string | `nil` | Configures the volume retention behavior that applies when the StatefulSet is deleted. |
| volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenScaled | string | `nil` | Configures the volume retention behavior that applies when the replica count of the StatefulSet is reduced. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenScaled | string | `nil` | Configures the volume retention behavior that applies when the replica count of the StatefulSet is reduced. |
4 changes: 3 additions & 1 deletion src/main/charts/confluence/templates/shared-home-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ metadata:
{{- include "common.labels.commonLabels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteMany
{{ range .Values.volumes.sharedHome.persistentVolumeClaim.accessModes }}
- {{ . }}
{{ end }}
{{- if .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName }}
storageClassName: {{ .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName | quote }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ volumes:
#
create: false

# -- Specify the access modes that should be used for the 'shared-home' volume claim.
# Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations.
# Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable.
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes
#
accessModes:
- ReadWriteMany

# -- Specify the name of the 'StorageClass' that should be used for the 'shared-home'
# volume claim.
#
Expand Down
8 changes: 4 additions & 4 deletions src/main/charts/crowd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A chart for installing Crowd Data Center on Kubernetes

For installation please follow [the documentation](https://atlassian.github.io/data-center-helm-charts/).

**Homepage:** <https://atlassian.github.io/data-center-helm-charts/>

## Source Code
Expand Down Expand Up @@ -185,10 +187,8 @@ Kubernetes: `>=1.21.x-0`
| volumes.sharedHome.nfsPermissionFixer.imageTag | string | `"latest"` | Image tag for the permission fixer init container. Defaults to latest |
| volumes.sharedHome.nfsPermissionFixer.mountPath | string | `"/shared-home"` | The path in the K8s initContainer where the shared-home volume will be mounted |
| volumes.sharedHome.nfsPermissionFixer.resources | object | `{}` | Resources requests and limits for nfsPermissionFixer init container See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
| volumes.sharedHome.persistentVolumeClaim.accessModes | list | `["ReadWriteMany"]` | Specify the access modes that should be used for the 'shared-home' volume claim. Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations. Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable. https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes |
| volumes.sharedHome.persistentVolumeClaim.create | bool | `false` | If 'true', then a 'PersistentVolumeClaim' and 'PersistentVolume' will be dynamically created for shared-home based on the 'StorageClassName' supplied below. |
| volumes.sharedHome.persistentVolumeClaim.resources | object | `{"requests":{"storage":"1Gi"}}` | Specifies the standard K8s resource requests and/or limits for the shared-home volume claims. |
| volumes.sharedHome.persistentVolumeClaim.storageClassName | string | `nil` | Specify the name of the 'StorageClass' that should be used for the 'shared-home' volume claim. |
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Crowd container. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Crowd container. |
4 changes: 3 additions & 1 deletion src/main/charts/crowd/templates/shared-home-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ metadata:
{{- include "common.labels.commonLabels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteMany
{{ range .Values.volumes.sharedHome.persistentVolumeClaim.accessModes }}
- {{ . }}
{{ end }}
{{- if .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName }}
storageClassName: {{ .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName | quote }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions src/main/charts/crowd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,14 @@ volumes:
#
create: false

# -- Specify the access modes that should be used for the 'shared-home' volume claim.
# Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations.
# Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable.
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes
#
accessModes:
- ReadWriteMany

# -- Specify the name of the 'StorageClass' that should be used for the 'shared-home'
# volume claim.
#
Expand Down
8 changes: 4 additions & 4 deletions src/main/charts/jira/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A chart for installing Jira Data Center on Kubernetes

For installation please follow [the documentation](https://atlassian.github.io/data-center-helm-charts/).

**Homepage:** <https://atlassian.github.io/data-center-helm-charts/>

## Source Code
Expand Down Expand Up @@ -186,10 +188,8 @@ Kubernetes: `>=1.21.x-0`
| volumes.sharedHome.nfsPermissionFixer.imageTag | string | `"latest"` | Image tag for the permission fixer init container. Defaults to latest |
| volumes.sharedHome.nfsPermissionFixer.mountPath | string | `"/shared-home"` | The path in the K8s initContainer where the shared-home volume will be mounted |
| volumes.sharedHome.nfsPermissionFixer.resources | object | `{}` | Resources requests and limits for nfsPermissionFixer init container See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
| volumes.sharedHome.persistentVolumeClaim.accessModes | list | `["ReadWriteMany"]` | Specify the access modes that should be used for the 'shared-home' volume claim. Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations. Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable. https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes |
| volumes.sharedHome.persistentVolumeClaim.create | bool | `false` | If 'true', then a 'PersistentVolumeClaim' and 'PersistentVolume' will be dynamically created for shared-home based on the 'StorageClassName' supplied below. |
| volumes.sharedHome.persistentVolumeClaim.resources | object | `{"requests":{"storage":"1Gi"}}` | Specifies the standard K8s resource requests and/or limits for the shared-home volume claims. |
| volumes.sharedHome.persistentVolumeClaim.storageClassName | string | `nil` | Specify the name of the 'StorageClass' that should be used for the 'shared-home' volume claim. |
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Jira container. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
| volumes.sharedHome.subPath | string | `nil` | Specifies the sub-directory of the shared-home volume that will be mounted in to the Jira container. |
4 changes: 3 additions & 1 deletion src/main/charts/jira/templates/shared-home-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ metadata:
{{- include "common.labels.commonLabels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteMany
{{ range .Values.volumes.sharedHome.persistentVolumeClaim.accessModes }}
- {{ . }}
{{ end }}
{{- if .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName }}
storageClassName: {{ .Values.volumes.sharedHome.persistentVolumeClaim.storageClassName | quote }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions src/main/charts/jira/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ volumes:
#
create: false

# -- Specify the access modes that should be used for the 'shared-home' volume claim.
# Note: 'ReadWriteOnce' (RWO) is suitable only for single-node installations.
# Be aware that changing the access mode of an existing PVC might be impossible, as the PVC spec is immutable.
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes
#
accessModes:
- ReadWriteMany

# -- Specify the name of the 'StorageClass' that should be used for the 'shared-home'
#volume claim.
#
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/test/VolumesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@ void sharedHome_pvc_create(Product product) throws Exception {
.hasTextEqualTo(product.getHelmReleaseName() + "-shared-home"));
}

@ParameterizedTest
@EnumSource(value = Product.class, names = {"bamboo_agent", "bitbucket"}, mode = EnumSource.Mode.EXCLUDE)
void sharedHome_pvc_create_access_modes(Product product) throws Exception {
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
"volumes.sharedHome.persistentVolumeClaim.create", "true",
"volumes.sharedHome.persistentVolumeClaim.accessModes[0]", "ReadWriteOnce"
));

final var accessModes = resources.get(PersistentVolumeClaim).getSpec().get("accessModes");
assertThat(accessModes).isArrayWithChildren("ReadWriteOnce");
}

@ParameterizedTest
@EnumSource(value = Product.class, names = {"bitbucket"})
void sharedHome_pvc_create_access_mode(Product product) throws Exception {
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
"volumes.sharedHome.persistentVolumeClaim.create", "true",
"volumes.sharedHome.persistentVolumeClaim.accessMode", "ReadWriteOnce"
));

final var accessModes = resources.get(PersistentVolumeClaim).getSpec().get("accessModes");
assertThat(accessModes).isArrayWithChildren("ReadWriteOnce");
}

@ParameterizedTest
@EnumSource(value = Product.class, names = {"bamboo_agent"}, mode = EnumSource.Mode.EXCLUDE)
void localHome_custom_volume(Product product) throws Exception {
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/expected_helm_output/bamboo/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ data:
mountPath: /shared-home
resources: {}
persistentVolumeClaim:
accessModes:
- ReadWriteMany
create: false
resources:
requests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ data:
mountPath: /shared-home
resources: {}
persistentVolumeClaim:
accessModes:
- ReadWriteMany
create: false
resources:
requests:
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/expected_helm_output/crowd/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ data:
mountPath: /shared-home
resources: {}
persistentVolumeClaim:
accessModes:
- ReadWriteMany
create: false
resources:
requests:
Expand Down
Loading

0 comments on commit c0bb8bc

Please sign in to comment.