Skip to content

Commit

Permalink
feat: allow cloning home-pvc from custom dataSource (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuasimon-taulia authored Jul 28, 2023
1 parent bba3b55 commit 1f32bcc
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
4 changes: 4 additions & 0 deletions charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.
The changelog until v1.5.7 was auto-generated based on git commits.
Those entries include a reference to the git commit to be able to get more details.

## 4.5.0

Added `.Values.persistence.dataSource` to allow cloning home PVC from existing dataSource.

## 4.4.2

Update Jenkins image and appVersion to jenkins lts release version 2.401.3
Expand Down
2 changes: 1 addition & 1 deletion charts/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: jenkins
home: https://jenkins.io/
version: 4.4.2
version: 4.5.0
appVersion: 2.401.3
description: Jenkins - Build great things at any scale! The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.
sources:
Expand Down
25 changes: 13 additions & 12 deletions charts/jenkins/VALUES_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,19 @@ The following tables list the configurable parameters of the Jenkins chart and t

### Persistence

| Parameter | Description | Default |
| --------------------------- | ------------------------------- | --------------- |
| `persistence.enabled` | Enable the use of a Jenkins PVC | `true` |
| `persistence.existingClaim` | Provide the name of a PVC | `nil` |
| `persistence.storageClass` | Storage class for the PVC | `nil` |
| `persistence.annotations` | Annotations for the PVC | `{}` |
| `persistence.labels` | Labels for the PVC | `{}` |
| `persistence.accessMode` | The PVC access mode | `ReadWriteOnce` |
| `persistence.size` | The size of the PVC | `8Gi` |
| `persistence.subPath` | SubPath for jenkins-home mount | `nil` |
| `persistence.volumes` | Additional volumes | `nil` |
| `persistence.mounts` | Additional mounts | `nil` |
| Parameter | Description | Default |
| --------------------------- | -------------------------------------- | --------------- |
| `persistence.enabled` | Enable the use of a Jenkins PVC | `true` |
| `persistence.existingClaim` | Provide the name of a PVC | `nil` |
| `persistence.storageClass` | Storage class for the PVC | `nil` |
| `persistence.annotations` | Annotations for the PVC | `{}` |
| `persistence.labels` | Labels for the PVC | `{}` |
| `persistence.accessMode` | The PVC access mode | `ReadWriteOnce` |
| `persistence.size` | The size of the PVC | `8Gi` |
| `persistence.dataSource` | Existing data source to clone PVC from | `nil` |
| `persistence.subPath` | SubPath for jenkins-home mount | `nil` |
| `persistence.volumes` | Additional volumes | `nil` |
| `persistence.mounts` | Additional mounts | `nil` |

### Backup

Expand Down
4 changes: 4 additions & 0 deletions charts/jenkins/templates/home-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ metadata:
{{ toYaml .Values.persistence.labels | indent 4 }}
{{- end }}
spec:
{{- if .Values.persistence.dataSource }}
dataSource:
{{ toYaml .Values.persistence.dataSource | indent 4 }}
{{- end }}
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
Expand Down
17 changes: 17 additions & 0 deletions charts/jenkins/unittests/home-pvc-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ tests:
path: spec.resources.requests
value:
storage: 8Gi
- isNull:
path: spec.dataSource
- isNull:
path: spec.storageClassName

Expand Down Expand Up @@ -92,3 +94,18 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: jenkins
test-label: test-value

- it: clone from dataSource
set:
persistence:
dataSource:
name: PVC-NAME
kind: PersistentVolumeClaim
asserts:
- equal:
path: spec.dataSource.name
value: PVC-NAME
- equal:
path: spec.dataSource.kind
value: PersistentVolumeClaim

5 changes: 5 additions & 0 deletions charts/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,11 @@ persistence:
labels: {}
accessMode: "ReadWriteOnce"
size: "8Gi"
# Existing data source to clone PVC from
# ref: https://kubernetes.io/docs/concepts/storage/volume-pvc-datasource/
dataSource:
# name: PVC-NAME
# kind: PersistentVolumeClaim
volumes:
# - name: nothing
# emptyDir: {}
Expand Down

0 comments on commit 1f32bcc

Please sign in to comment.