From e7d2a6d9872e627fd6e72bde60068e9fa00e9bac Mon Sep 17 00:00:00 2001 From: Sushil Tiwari Date: Thu, 19 Mar 2026 14:38:11 +0545 Subject: [PATCH 1/3] feat(helm): add support for strategy on deployments --- helm/snapshots/alpha-1.yaml | 2 ++ helm/snapshots/staging.yaml | 5 +++-- helm/templates/deployment.yaml | 2 ++ helm/templates/pvc.yaml | 2 +- helm/values/go-deploy.yaml | 3 --- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/helm/snapshots/alpha-1.yaml b/helm/snapshots/alpha-1.yaml index e75d743..dd1e840 100644 --- a/helm/snapshots/alpha-1.yaml +++ b/helm/snapshots/alpha-1.yaml @@ -103,6 +103,8 @@ metadata: app.kubernetes.io/managed-by: Helm spec: replicas: 1 + strategy: + type: Recreate selector: matchLabels: app.kubernetes.io/name: cacheppuccino-helm diff --git a/helm/snapshots/staging.yaml b/helm/snapshots/staging.yaml index 567d36d..f96afcc 100644 --- a/helm/snapshots/staging.yaml +++ b/helm/snapshots/staging.yaml @@ -46,9 +46,8 @@ metadata: app.kubernetes.io/version: "0.1.0" app.kubernetes.io/managed-by: Helm spec: - storageClassName: "azurefile-csi" accessModes: - - ReadWriteMany + - ReadWriteOnce resources: requests: storage: "512Mi" @@ -90,6 +89,8 @@ metadata: app.kubernetes.io/managed-by: Helm spec: replicas: 1 + strategy: + type: Recreate selector: matchLabels: app.kubernetes.io/name: cacheppuccino-helm diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index de78dbd..1d6912f 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -9,6 +9,8 @@ metadata: {{- include "cacheppuccino.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} + strategy: + type: Recreate selector: matchLabels: {{- include "cacheppuccino.selectorLabels" . | nindent 6 }} diff --git a/helm/templates/pvc.yaml b/helm/templates/pvc.yaml index 19ad433..b116344 100644 --- a/helm/templates/pvc.yaml +++ b/helm/templates/pvc.yaml @@ -10,7 +10,7 @@ spec: storageClassName: {{ .Values.sqlite.pvc.storageClassName | quote }} {{- end }} accessModes: - {{- toYaml .Values.sqlite.pvc.accessModes | nindent 4 }} + - ReadWriteOnce resources: requests: storage: {{ .Values.sqlite.pvc.size | quote }} diff --git a/helm/values/go-deploy.yaml b/helm/values/go-deploy.yaml index 5178980..38bbdc8 100644 --- a/helm/values/go-deploy.yaml +++ b/helm/values/go-deploy.yaml @@ -11,9 +11,6 @@ ingress: sqlite: pvc: size: 512Mi - storageClassName: azurefile-csi - accessModes: - - ReadWriteMany serviceAccount: create: true From 3cf38db9afc8778918206791711cb1806cfc4b91 Mon Sep 17 00:00:00 2001 From: Sushil Tiwari Date: Thu, 19 Mar 2026 16:04:20 +0545 Subject: [PATCH 2/3] doc: readme file about issue FailedAttachVolume --- helm/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 helm/README.md diff --git a/helm/README.md b/helm/README.md new file mode 100644 index 0000000..a9c465d --- /dev/null +++ b/helm/README.md @@ -0,0 +1,12 @@ +## Strategy + Azure storage + +### Why these errors happen (short) +- `FailedAttachVolume` / `FailedVolumeAttach`: usually occurs when the PVC is backed by ReadWriteOnce (RWO) storage and Kubernetes attempts to start a new Pod before the old Pod has fully released/detached the volume.Because the same volume can’t be attached to two Pods/nodes at once, the attach step fails and the rollout can get stuck. +- `database is locked` (SQLite): after switching the PVC `storageClass` to `azurefile-csi`, the app started hitting SQLite lock errors. + +We observed these issues during rollouts on Azure when multiple Pods briefly overlapped. + +### Current approach (what we use) +We use `strategy.type: Recreate` so upgrades run only one Pod at a time: +- switched back to the default storage class +- `Recreate` avoids parallel Pod overlap, which prevents volume attach conflicts and reduces the chance of SQLite locking problems From df073f538358f9143c714db9c68d6164f148c4df Mon Sep 17 00:00:00 2001 From: Sushil Tiwari Date: Thu, 19 Mar 2026 16:35:45 +0545 Subject: [PATCH 3/3] fix(ci): add tags and version logic on docker and helm --- .github/workflows/ci.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86d1c0a..e5a8b02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,6 @@ jobs: name: docker (build and push) runs-on: ubuntu-latest needs: [go] - # if: github.event_name != 'pull_request' permissions: contents: read @@ -82,10 +81,10 @@ jobs: images: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest,enable={{is_default_branch}} - type=sha,format=short,prefix=0.1.0- + type=sha,format=short,prefix=0.1.0-c type=ref,event=tag - - name: Build and push + - name: Build and push docker image uses: docker/build-push-action@v6 with: context: . @@ -159,13 +158,23 @@ jobs: mkdir -p dist helm package helm \ --destination dist \ - --version "${{ steps.ver.outputs.version }}" \ - --app-version "${{ steps.ver.outputs.version }}" + --version "${{ needs.docker.outputs.docker_image_tag }}" \ + --app-version "${{ needs.docker.outputs.docker_image_tag }}" - name: Push chart to GHCR (OCI) shell: bash run: | set -euo pipefail OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" - CHART_TGZ="$(ls -1 dist/cacheppuccino-*.tgz | head -n 1)" - helm push "${CHART_TGZ}" "oci://ghcr.io/${OWNER_LC}" + OCI_REPO="oci://ghcr.io/${OWNER_LC}" + PACKAGE_FILE="$(ls -1 dist/cacheppuccino-*.tgz | head -n 1)" + IMAGE="${{ needs.docker.outputs.docker_image_tag }}" + + # Add GitHub Actions summary + echo "# Helm Chart" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```yaml' >> $GITHUB_STEP_SUMMARY + helm push "$PACKAGE_FILE" "$OCI_REPO" 2>> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "> [!Important]" >> $GITHUB_STEP_SUMMARY + echo "> NOTE: Tagged Docker image & Helm chart version: **$IMAGE**" >> $GITHUB_STEP_SUMMARY