# infrastructure/longhorn/core/helmrelease.yaml
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: longhorn
  namespace: longhorn-system
spec:
  interval: 30m
  chart:
    spec:
      chart: longhorn
      version: 1.8.2
      sourceRef:
        kind: HelmRepository
        name: longhorn
        namespace: flux-system
  install:
    crds: Skip
    remediation: { retries: 3 }
    timeout: 15m
  upgrade:
    crds: Skip
    remediation:
      retries: 3
      remediateLastFailure: true
    cleanupOnFail: true
    timeout: 15m
  values:
    global:
      nodeSelector:
        longhorn-host: "true"
    service:
      ui:
        type: NodePort
        nodePort: 30824
    privateRegistry:
      createSecret: false
      registrySecret: longhorn-registry
    image:
      pullPolicy: IfNotPresent
      longhorn:
        engine:
          repository: registry.bstein.dev/infra/longhorn-engine
          tag: v1.8.2
        manager:
          repository: registry.bstein.dev/infra/longhorn-manager
          tag: v1.8.2
        ui:
          repository: registry.bstein.dev/infra/longhorn-ui
          tag: v1.8.2
        instanceManager:
          repository: registry.bstein.dev/infra/longhorn-instance-manager
          tag: v1.8.2
        shareManager:
          repository: registry.bstein.dev/infra/longhorn-share-manager
          tag: v1.8.2
        backingImageManager:
          repository: registry.bstein.dev/infra/longhorn-backing-image-manager
          tag: v1.8.2
        supportBundleKit:
          repository: registry.bstein.dev/infra/longhorn-support-bundle-kit
          tag: v0.0.56
      csi:
        attacher:
          repository: registry.bstein.dev/infra/longhorn-csi-attacher
          tag: v4.9.0
        provisioner:
          repository: registry.bstein.dev/infra/longhorn-csi-provisioner
          tag: v5.3.0
        nodeDriverRegistrar:
          repository: registry.bstein.dev/infra/longhorn-csi-node-driver-registrar
          tag: v2.14.0
        resizer:
          repository: registry.bstein.dev/infra/longhorn-csi-resizer
          tag: v1.13.2
        snapshotter:
          repository: registry.bstein.dev/infra/longhorn-csi-snapshotter
          tag: v8.2.0
        livenessProbe:
          repository: registry.bstein.dev/infra/longhorn-livenessprobe
          tag: v2.16.0
    defaultSettings:
      systemManagedPodsImagePullPolicy: if-not-present
      taintToleration: veles.bstein.dev/simulation=true:NoSchedule
    longhornManager:
      tolerations:
        - key: veles.bstein.dev/simulation
          operator: Equal
          value: "true"
          effect: NoSchedule
      nodeSelector:
        longhorn-host: "true"
    longhornDriver:
      tolerations:
        - key: veles.bstein.dev/simulation
          operator: Equal
          value: "true"
          effect: NoSchedule
      nodeSelector:
        longhorn-host: "true"
    longhornUI:
      nodeSelector:
        longhorn-host: "true"
