jenkins-infra / helm-charts

Helm chart repository containing the jenkins-infra public charts.
7 stars 23 forks source link

feat(artifact-caching-proxy) allow customization of the PVC template prefix (for statefulset) #1205

Closed dduportal closed 3 weeks ago

dduportal commented 3 weeks ago

While working on https://github.com/jenkins-infra/helpdesk/issues/3837, we've been stucked with specifying existing PV for the ACP statefulset.

See https://github.com/jenkins-infra/azure/pull/775#issuecomment-2210796493

As per https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/preexisting-pd#pv_to_statefulset, we can determine the name of the PVCs in advance so we can specify the binding PV <-> PVC on the PV side (in Terraform) using the claimRef attribute.

As such, this PR allows customizing the prefix used by Statefulset to generate the PVC names.

Tested against production with the following helmfile diff:

 persistence:
-  storageClass: managed-csi-premium-retain
+  enabled: true
+  size: 32
+  storageClass: statically-provisionned
+  # Deterministic name - https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/preexisting-pd#pv_to_statefulset
+  # to ensure the Terraform-managed PV can specify `claimRef`with the full generated name
+  claimPrefix: data
    volumeClaimTemplates:
    - metadata:
-       name: nginx-cache
+       name: data
      spec:
-       storageClassName: managed-csi-premium-retain
+       storageClassName: statically-provisionned
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
-           storage: "100Gi"
+           storage: "32Gi"