From 65aa5245f677ce58b703841152b326005da6e56d Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Mon, 20 Jan 2025 17:30:54 +0100 Subject: [PATCH] fix: Make the dynamic plugins root PVC storage class configurable [RHDHBUGS-156][RHIDP-5573] (#69) * Extract the dynamic plugins root PVC spec in a `dynamicPlugins.cache.volumeClaimSpec` field in the values file This way, the whole PVC spec is configurable, including the storage class name, along with other things like the PVC size and access modes. * Bump the Chart version * Extract the PostgreSQL PVC storageClass field to highlight that this configurable as well See https://github.com/bitnami/charts/blob/postgresql/12.10.0/bitnami/postgresql/README.md#postgresql-primary-parameters * Add test values file * Regenerate README --- .github/workflows/test.yml | 26 +++++++++++++++++++ charts/backstage/Chart.yaml | 2 +- charts/backstage/README.md | 3 ++- ...-custom-dynamic-pvc-claim-spec-values.yaml | 18 +++++++++++++ charts/backstage/templates/pvcs.yaml | 6 +---- charts/backstage/values.yaml | 13 ++++++++++ 6 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 charts/backstage/ci/with-custom-dynamic-pvc-claim-spec-values.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fb2082e..a932a702 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,6 +65,19 @@ jobs: - name: Create KIND Cluster uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 + - name: Create custom storage class + run: | + cat <= 1.25.0-0` | Key | Description | Type | Default | |-----|-------------|------|---------| +| dynamicPlugins.cache.volumeClaimSpec | Spec of the dynamic plugins root volume claim.
Note that, by default, this is set to use the default storage class, if available in the cluster. | object | `{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"5Gi"}},"storageClassName":null}` | | global.auth | Enable service authentication within Backstage instance | object | `{"backend":{"enabled":true,"existingSecret":"","value":""}}` | | global.auth.backend | Backend service to service authentication
Ref: https://backstage.io/docs/auth/service-to-service-auth/ | object | `{"enabled":true,"existingSecret":"","value":""}` | | global.auth.backend.enabled | Enable backend service to service authentication, unless configured otherwise it generates a secret value | bool | `true` | diff --git a/charts/backstage/ci/with-custom-dynamic-pvc-claim-spec-values.yaml b/charts/backstage/ci/with-custom-dynamic-pvc-claim-spec-values.yaml new file mode 100644 index 00000000..e98f0bde --- /dev/null +++ b/charts/backstage/ci/with-custom-dynamic-pvc-claim-spec-values.yaml @@ -0,0 +1,18 @@ +# Workaround for kind cluster in CI which has no Routes +route: + enabled: false +upstream: + postgresql: + primary: + persistence: + # This custom-sc storage class is created in the test GH Workflow + storageClass: custom-sc + +dynamicPlugins: + cache: + volumeClaimSpec: + resources: + requests: + storage: 3Gi + # This custom-sc storage class is created in the test GH Workflow + storageClassName: custom-sc diff --git a/charts/backstage/templates/pvcs.yaml b/charts/backstage/templates/pvcs.yaml index f441e2da..a674b3c5 100644 --- a/charts/backstage/templates/pvcs.yaml +++ b/charts/backstage/templates/pvcs.yaml @@ -3,8 +3,4 @@ apiVersion: v1 metadata: name: {{ printf "%s-dynamic-plugins-root" .Release.Name }} spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 5Gi + {{- toYaml .Values.dynamicPlugins.cache.volumeClaimSpec | nindent 2 }} diff --git a/charts/backstage/values.yaml b/charts/backstage/values.yaml index 3f1edba4..fc0b47a8 100644 --- a/charts/backstage/values.yaml +++ b/charts/backstage/values.yaml @@ -253,6 +253,7 @@ upstream: enabled: true size: 1Gi mountPath: /var/lib/pgsql/data + storageClass: null extraEnvVars: - name: POSTGRESQL_ADMIN_PASSWORD valueFrom: @@ -307,3 +308,15 @@ route: # -- Indicates the desired behavior for insecure connections to a route. #
While each router may make its own decisions on which ports to expose, this is normally port 80. The only valid values are None, Redirect, or empty for disabled. insecureEdgeTerminationPolicy: "Redirect" + +dynamicPlugins: + cache: + # -- Spec of the dynamic plugins root volume claim. + #
Note that, by default, this is set to use the default storage class, if available in the cluster. + volumeClaimSpec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi + storageClassName: null