From b9a89ca9d4b83010c77061af73622770409ec8ff Mon Sep 17 00:00:00 2001 From: Matt Bacchi Date: Fri, 11 Aug 2023 13:02:16 -0400 Subject: [PATCH 1/6] Fix PVC name template Example of usage: ... persistentVolumeClaims: - claimName: efs-storage storageClass: accessModes: - ReadWriteMany name: efs-mono storage: 1Gi ... --- charts/service/templates/pvc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/service/templates/pvc.yaml b/charts/service/templates/pvc.yaml index 5bb5458..20f2d4a 100644 --- a/charts/service/templates/pvc.yaml +++ b/charts/service/templates/pvc.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ .persistentVolumeClaim.claimName }} + name: {{ .claimName }} spec: accessModes: {{ .storageClass.accessModes }} storageClassName: {{ .storageClass.name }} From cd11f97beeedc82d5d54b98504985b4499a49d6f Mon Sep 17 00:00:00 2001 From: Matt Bacchi Date: Fri, 11 Aug 2023 13:04:44 -0400 Subject: [PATCH 2/6] Also update ci values --- charts/service/ci/custom-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/service/ci/custom-values.yaml b/charts/service/ci/custom-values.yaml index 2237a20..3af62f1 100644 --- a/charts/service/ci/custom-values.yaml +++ b/charts/service/ci/custom-values.yaml @@ -98,7 +98,7 @@ hostAliases: - anotherhost.com - anotherhost2.com -persistentVolumeClaim: +persistentVolumeClaims: - claimName: test-efs storageClass: accessModes: From f6ef26051b2361e2b9385495cb130566d13d7023 Mon Sep 17 00:00:00 2001 From: Matt Bacchi Date: Fri, 11 Aug 2023 13:07:07 -0400 Subject: [PATCH 3/6] Bump version Signed-off-by: Leon Pham --- charts/service/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/service/Chart.yaml b/charts/service/Chart.yaml index 72fa0ea..02755f2 100644 --- a/charts/service/Chart.yaml +++ b/charts/service/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: service description: A generic k8s service chart type: application -version: 1.7.5 +version: 1.7.6 maintainers: - email: devops@codecademy.com name: devops From c8a342302c2838a02bf6202affe3ee31a21b06ea Mon Sep 17 00:00:00 2001 From: Leon Pham Date: Tue, 15 Aug 2023 14:32:56 -0400 Subject: [PATCH 4/6] Fix PVC related testing by setting up a PV Add some documentation on testing Signed-off-by: Leon Pham --- .github/workflows/lint-test.yaml | 1 + README.md | 15 +++++++++++++++ charts/service/ci/custom-values.yaml | 2 +- ci/pv.yaml | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 ci/pv.yaml diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 5d3f872..b2755c3 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -46,5 +46,6 @@ jobs: helm repo add kedacore https://kedacore.github.io/charts helm repo update helm install keda kedacore/keda + kubectl apply -f ci/pv.yaml ct install --config ct.yaml if: steps.list-changed.outputs.changed == 'true' diff --git a/README.md b/README.md index 00b50a2..5b2e4a9 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,21 @@ $ helm repo add codecademy https://codecademy-engineering.github.io/helm-charts You can then run `helm search repo codecademy` to see the charts. +## Tests +You can test the charts locally using a [Kind](https://kind.sigs.k8s.io/) cluster and [chart testing](https://github.com/helm/chart-testing). + +Once you've installed both you can run the following commands to test: +``` +kind create cluster +kubectl apply -f charts/service/ci/pv.yaml + +helm repo add kedacore https://kedacore.github.io/charts +helm repo update +helm install keda kedacore/keda + +ct install --config ct.yaml +``` + ## Contribution Guidelines We'd love to have you contribute! Please refer to our [contribution guidelines](CONTRIBUTING.md) for details. diff --git a/charts/service/ci/custom-values.yaml b/charts/service/ci/custom-values.yaml index 3af62f1..0748412 100644 --- a/charts/service/ci/custom-values.yaml +++ b/charts/service/ci/custom-values.yaml @@ -103,5 +103,5 @@ persistentVolumeClaims: storageClass: accessModes: - ReadWriteMany - name: efs + name: manual storage: 1Gi diff --git a/ci/pv.yaml b/ci/pv.yaml new file mode 100644 index 0000000..2035431 --- /dev/null +++ b/ci/pv.yaml @@ -0,0 +1,15 @@ +# Create a persistent volume to test PVCs in CI +apiVersion: v1 +kind: PersistentVolume +metadata: + name: test-pv + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/tmp/data" \ No newline at end of file From 2c6a52bbbb9cbc4dc06c26b4b70907bb68e4ecb5 Mon Sep 17 00:00:00 2001 From: Leon Pham Date: Tue, 15 Aug 2023 15:39:54 -0400 Subject: [PATCH 5/6] Swap to using a standard storage class which Kind should have Signed-off-by: Leon Pham --- charts/service/ci/custom-values.yaml | 4 ++-- ci/pv.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/service/ci/custom-values.yaml b/charts/service/ci/custom-values.yaml index 0748412..7c995b7 100644 --- a/charts/service/ci/custom-values.yaml +++ b/charts/service/ci/custom-values.yaml @@ -99,9 +99,9 @@ hostAliases: - anotherhost2.com persistentVolumeClaims: - - claimName: test-efs + - claimName: test-pv storageClass: accessModes: - ReadWriteMany - name: manual + name: standard storage: 1Gi diff --git a/ci/pv.yaml b/ci/pv.yaml index 2035431..7a6b348 100644 --- a/ci/pv.yaml +++ b/ci/pv.yaml @@ -4,9 +4,9 @@ kind: PersistentVolume metadata: name: test-pv labels: - type: local + type: standard spec: - storageClassName: manual + storageClassName: standard capacity: storage: 1Gi accessModes: From 2c6f9528b473a62a355b17041de41eb66684a06f Mon Sep 17 00:00:00 2001 From: Leon Pham Date: Wed, 16 Aug 2023 09:38:44 -0400 Subject: [PATCH 6/6] Add volume entries for the service Signed-off-by: Leon Pham --- charts/service/ci/custom-values.yaml | 13 +++++++++++-- ci/pv.yaml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/charts/service/ci/custom-values.yaml b/charts/service/ci/custom-values.yaml index 7c995b7..38fe81f 100644 --- a/charts/service/ci/custom-values.yaml +++ b/charts/service/ci/custom-values.yaml @@ -98,10 +98,19 @@ hostAliases: - anotherhost.com - anotherhost2.com +volumeMounts: + - name: test-pv + mountPath: /tmp/ + +volumes: + - name: test-pv + persistentVolumeClaim: + claimName: test-pvc + persistentVolumeClaims: - - claimName: test-pv + - claimName: test-pvc storageClass: accessModes: - - ReadWriteMany + - ReadWriteOnce name: standard storage: 1Gi diff --git a/ci/pv.yaml b/ci/pv.yaml index 7a6b348..442865a 100644 --- a/ci/pv.yaml +++ b/ci/pv.yaml @@ -12,4 +12,4 @@ spec: accessModes: - ReadWriteOnce hostPath: - path: "/tmp/data" \ No newline at end of file + path: "/tmp/" \ No newline at end of file