Skip to content

Commit

Permalink
CLIP-1799: StatefulSet PVC auto deletion (#736)
Browse files Browse the repository at this point in the history
* CLIP-1799: Made StatefulSet PVC auto deletion possible by adding sts pvc retention policy.

* CLIP-1799: Added sts pvc retention policy to Synchrony home; Added unit tests.

* CLIP-1799: Updated Helm version for unit test.

* CLIP-1799: Updated kind test.

* CLIP-1799: Refactor.
  • Loading branch information
yzha645 authored Dec 18, 2023
1 parent 4c5c5af commit d3fe5c6
Show file tree
Hide file tree
Showing 26 changed files with 1,134 additions and 919 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
runs-on: ubuntu-latest
env:
# See: https://github.com/kubernetes-sigs/kind/tags
KIND_VERSION: "v0.17.0"
KIND_VERSION: "v0.20.0"
# See: https://hub.docker.com/r/kindest/node/tags
K8S_VERSION: "v1.25.3"
K8S_VERSION: "v1.28.0"
DC_APP: ${{inputs.dc_app}}
LICENSE: ${{ secrets[format('{0}_LICENSE', inputs.dc_app)] }}

Expand All @@ -43,7 +43,7 @@ jobs:
- name: Pin Helm version
uses: azure/setup-helm@v3
with:
version: v3.9.2
version: v3.13.3

- name: Create KinD cluster
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.9.4
version: v3.13.3

- name: Execute helm dependency update for bamboo chart
run: helm dependency update src/main/charts/bamboo
Expand Down
89 changes: 44 additions & 45 deletions src/main/charts/bamboo-agent/README.md

Large diffs are not rendered by default.

329 changes: 164 additions & 165 deletions src/main/charts/bamboo/README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/main/charts/bamboo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ For each additional plugin declared, generate a volume mount that injects that l

{{- define "bamboo.volumeClaimTemplates" -}}
{{- if or .Values.volumes.localHome.persistentVolumeClaim.create .Values.bamboo.additionalVolumeClaimTemplates }}
{{- if and .Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenDeleted .Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenScaled }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{.Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenDeleted}}
whenScaled: {{.Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenScaled}}
{{- end}}
volumeClaimTemplates:
{{- if .Values.volumes.localHome.persistentVolumeClaim.create }}
- metadata:
Expand Down
18 changes: 18 additions & 0 deletions src/main/charts/bamboo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ volumes:
requests:
storage: 1Gi

# This field controls if and how PVCs are deleted during the lifecycle of a StatefulSet.
# Only configure the below two attributes when your Kubernetes version is 1.27+, and
# feature gate StatefulSetAutoDeletePVC is enabled.
#
# For each policy that you can configure, you can set the value to either Delete or Retain.
#
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
#
persistentVolumeClaimRetentionPolicy:

# -- Configures the volume retention behavior that applies when the StatefulSet is deleted.
#
whenDeleted:

# -- Configures the volume retention behavior that applies when the replica count of the StatefulSet is reduced.
#
whenScaled:

# -- Static provisioning of local-home using K8s PVs and PVCs
#
# NOTE: Due to the ephemeral nature of pods this approach to provisioning volumes for
Expand Down
421 changes: 211 additions & 210 deletions src/main/charts/bitbucket/README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/main/charts/bitbucket/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ Define additional hosts here to allow template overrides when used as a sub char
{{- define "bitbucket.volumeClaimTemplates" -}}
{{- if or .Values.volumes.localHome.persistentVolumeClaim.create .Values.bitbucket.additionalVolumeClaimTemplates }}
{{- if and .Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenDeleted .Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenScaled }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{.Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenDeleted}}
whenScaled: {{.Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenScaled}}
{{- end}}
volumeClaimTemplates:
{{- if .Values.volumes.localHome.persistentVolumeClaim.create }}
- metadata:
Expand Down
18 changes: 18 additions & 0 deletions src/main/charts/bitbucket/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,24 @@ volumes:
requests:
storage: 1Gi

# This field controls if and how PVCs are deleted during the lifecycle of a StatefulSet.
# Only configure the below two attributes when your Kubernetes version is 1.27+, and
# feature gate StatefulSetAutoDeletePVC is enabled.
#
# For each policy that you can configure, you can set the value to either Delete or Retain.
#
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
#
persistentVolumeClaimRetentionPolicy:

# -- Configures the volume retention behavior that applies when the StatefulSet is deleted.
#
whenDeleted:

# -- Configures the volume retention behavior that applies when the replica count of the StatefulSet is reduced.
#
whenScaled:

# -- Static provisioning of local-home using K8s PVs and PVCs
#
# NOTE: Due to the ephemeral nature of pods this approach to provisioning volumes for
Expand Down
391 changes: 197 additions & 194 deletions src/main/charts/confluence/README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/main/charts/confluence/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ For each additional plugin declared, generate a volume mount that injects that l

{{- define "confluence.volumeClaimTemplates" -}}
{{- if or .Values.volumes.localHome.persistentVolumeClaim.create .Values.confluence.additionalVolumeClaimTemplates }}
{{- if and .Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenDeleted .Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenScaled }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{.Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenDeleted}}
whenScaled: {{.Values.volumes.localHome.persistentVolumeClaimRetentionPolicy.whenScaled}}
{{- end}}
volumeClaimTemplates:
{{- if .Values.volumes.localHome.persistentVolumeClaim.create }}
- metadata:
Expand Down Expand Up @@ -566,6 +571,11 @@ volumeClaimTemplates:

{{- define "synchrony.volumeClaimTemplates" -}}
{{ if .Values.volumes.synchronyHome.persistentVolumeClaim.create }}
{{- if and .Values.volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenDeleted .Values.volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenScaled }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{.Values.volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenDeleted}}
whenScaled: {{.Values.volumes.synchronyHome.persistentVolumeClaimRetentionPolicy.whenScaled}}
{{- end}}
volumeClaimTemplates:
- metadata:
name: synchrony-home
Expand Down
36 changes: 36 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,24 @@ volumes:
requests:
storage: 1Gi

# This field controls if and how PVCs are deleted during the lifecycle of a StatefulSet.
# Only configure the below two attributes when your Kubernetes version is 1.27+, and
# feature gate StatefulSetAutoDeletePVC is enabled.
#
# For each policy that you can configure, you can set the value to either Delete or Retain.
#
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
#
persistentVolumeClaimRetentionPolicy:

# -- Configures the volume retention behavior that applies when the StatefulSet is deleted.
#
whenDeleted:

# -- Configures the volume retention behavior that applies when the replica count of the StatefulSet is reduced.
#
whenScaled:

# -- Static provisioning of local-home using K8s PVs and PVCs
#
# NOTE: Due to the ephemeral nature of pods this approach to provisioning volumes for
Expand Down Expand Up @@ -363,6 +381,24 @@ volumes:
requests:
storage: 1Gi

# This field controls if and how PVCs are deleted during the lifecycle of a StatefulSet.
# Only configure the below two attributes when your Kubernetes version is 1.27+, and
# feature gate StatefulSetAutoDeletePVC is enabled.
#
# For each policy that you can configure, you can set the value to either Delete or Retain.
#
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
#
persistentVolumeClaimRetentionPolicy:

# -- Configures the volume retention behavior that applies when the StatefulSet is deleted.
#
whenDeleted:

# -- Configures the volume retention behavior that applies when the replica count of the StatefulSet is reduced.
#
whenScaled:

# -- Static provisioning of synchrony-home using K8s PVs and PVCs
#
# NOTE: Due to the ephemeral nature of pods this approach to provisioning volumes for
Expand Down
Loading

0 comments on commit d3fe5c6

Please sign in to comment.