Skip to content

feat: add option to disable CSIDriver Helm hooks#197

Merged
zxh326 merged 5 commits intojuicedata:mainfrom
mt5225:feature/optional-csidriver-hooks
Dec 4, 2025
Merged

feat: add option to disable CSIDriver Helm hooks#197
zxh326 merged 5 commits intojuicedata:mainfrom
mt5225:feature/optional-csidriver-hooks

Conversation

@mt5225
Copy link
Copy Markdown
Contributor

@mt5225 mt5225 commented Nov 22, 2025

Summary

This PR adds a configuration option to allow users to disable Helm hooks on the CSIDriver resource. This addresses issues with ArgoCD and other GitOps tools.

Problem

The CSIDriver resource currently has these Helm hook annotations:

annotations:
  "helm.sh/hook": pre-install,pre-upgrade
  "helm.sh/hook-delete-policy": before-hook-creation
  "helm.sh/resource-policy": keep

In ArgoCD and GitOps workflows, this combination causes the CSIDriver to be deleted and recreated on every sync operation, even when there are no changes to the CSIDriver itself. This happens because:

  1. ArgoCD treats resources with helm.sh/hook as hook resources that execute on every sync
  2. The before-hook-creation policy deletes the existing CSIDriver before creating a new one
  3. If the sync is interrupted or creation fails, the CSIDriver remains missing
  4. This breaks all PVCs using the CSI driver, causing mount failures and cluster instability

Solution

This PR adds a new configuration option:

csidriver:
  # Default: false (hooks enabled for backward compatibility)
  disableHooks: false

When set to true, the Helm hooks are not applied to the CSIDriver resource, treating it as a regular resource that is created once and persists across syncs.

Changes

  • Added csidriver.disableHooks value in values.yaml (default: false)
  • Updated templates/csidriver.yaml to conditionally include hook annotations
  • Bumped chart version from 0.30.2 to 0.30.3
  • Added documentation in values.yaml explaining the option and use case

Backward Compatibility

  • Default behavior unchanged (hooks enabled by default)
  • Existing deployments will continue to work as before
  • Users can opt-in to disable hooks by setting csidriver.disableHooks: true

Testing

For ArgoCD users experiencing CSIDriver missing issues:

helm upgrade juicefs-csi-driver juicedata/juicefs-csi-driver \
  --set csidriver.disableHooks=true

After this change, the CSIDriver will no longer be deleted/recreated on every ArgoCD sync.

References

Fixes CSIDriver randomly going missing in ArgoCD deployments.

Add csidriver.disableHooks configuration option to allow users to disable
Helm hooks on the CSIDriver resource. This addresses issues with ArgoCD
and other GitOps tools where the combination of:
- helm.sh/hook: pre-install,pre-upgrade
- helm.sh/hook-delete-policy: before-hook-creation

causes the CSIDriver resource to be deleted and recreated on every sync,
potentially causing it to go missing if the creation fails or sync is
interrupted. This leads to PVC mount failures and cluster instability.

When csidriver.disableHooks is set to true, the CSIDriver will be
created as a regular resource without hooks, preventing the
deletion/recreation cycle.

Changes:
- Add csidriver.disableHooks value (default: false for backward compatibility)
- Update csidriver.yaml template to conditionally include hook annotations
- Bump chart version from 0.30.2 to 0.30.3

Fixes random CSIDriver missing issues in ArgoCD deployments.
@mt5225 mt5225 requested a review from zxh326 November 22, 2025 04:26
Comment thread charts/juicefs-csi-driver/values.yaml
metadata:
name: {{ include "driverName" . }}
annotations:
{{- if not .Values.csidriver.disableHooks }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to also allow annotations in addition to disabling these ones? For example, if I wanted to add argocd.argoproj.io/sync-wave: "-5".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, checking in here

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

Signed-off-by: Xuhui zhang <xuhui@juicedata.io>
@zxh326 zxh326 merged commit ea07a9f into juicedata:main Dec 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants