---
# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/helmrelease-helm-v2beta1.json
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: local-path-provisioner
spec:
  interval: 30m
  chart:
    spec:
      chart: democratic-csi
      version: 0.14.2
      sourceRef:
        name: democratic-csi
        kind: HelmRepository
        namespace: flux-system
  values:
    csiDriver:
      name: "org.democratic-csi.local-hostpath"
      attachRequired: false
      storageCapacity: true # With storage capacity tracking, the scheduler filters out nodes which do not have enough capacity.
      fsGroupPolicy: File # fsGroupChangePolicy

    storageClasses:
      - name: local-hostpath
        defaultClass: true
        reclaimPolicy: Delete
        volumeBindingMode: WaitForFirstConsumer
        # distributed support is not yet ready for expansion
        allowVolumeExpansion: false

    volumeSnapshotClasses:
      - name: local-hostpath
        deletionPolicy: Delete
        parameters:
          dummy: {}

    controller:
      enabled: true
      strategy: node
      externalAttacher:
        enabled: false
      externalProvisioner:
        enabled: true
        image: registry.k8s.io/sig-storage/csi-provisioner:v3.6.2
        extraArgs:
          - --leader-election=false
          - --node-deployment=true
          - --node-deployment-immediate-binding=false
          - --feature-gates=Topology=true
          - --strict-topology=true
          - --enable-capacity=true
          - --capacity-ownerref-level=1
      externalResizer:
        enabled: false
      externalSnapshotter:
        enabled: true
        extraArgs:
          - --leader-election=false
          - --node-deployment=true

    node:
      driver:
        extraVolumeMounts:
          - name: local-hostpath
            mountPath: /var/mnt/lpnvme/demo-csi-local-path
            mountPropagation: Bidirectional

      driverRegistrar:
        enabled: true
        image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.9.1

      extraVolumes:
        - name: local-hostpath
          hostPath:
            path: /var/mnt/lpnvme/demo-csi-local-path
            type: DirectoryOrCreate

    driver:
      config:
        driver: local-hostpath
        instance_id:
        local-hostpath:
          shareBasePath: "/var/mnt/lpnvme/demo-csi-local-path"
          controllerBasePath: "/var/mnt/lpnvme/demo-csi-local-path"
          dirPermissionsMode: "0770"
          dirPermissionsUser: 0
          dirPermissionsGroup: 0