Class: Kube::Cluster::Standard::JuiceFS::PersistentVolume

Inherits:
Object
  • Object
show all
Defined in:
lib/kube/cluster/standard/juice_fs/persistent_volume.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, storage:, sub_path:, secret:, secret_namespace:, access_modes: ["ReadWriteMany"], reclaim_policy: "Retain", &block) ⇒ PersistentVolume

Returns a new instance of PersistentVolume.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/kube/cluster/standard/juice_fs/persistent_volume.rb', line 26

def initialize(name:, storage:, sub_path:, secret:, secret_namespace:,
               access_modes: ["ReadWriteMany"], reclaim_policy: "Retain", &block)
  super() {
    .name = name

    spec.capacity                      = { storage: storage }
    spec.accessModes                   = access_modes
    spec.persistentVolumeReclaimPolicy = reclaim_policy
    # Empty (not absent) so no StorageClass can claim this PV and the
    # matching PVC binds by volumeName alone.
    spec.storageClassName              = ""
    spec.csi = {
      driver:               "csi.juicefs.com",
      volumeHandle:         name,
      fsType:               "juicefs",
      nodePublishSecretRef: { name: secret, namespace: secret_namespace },
      volumeAttributes:     { subPath: sub_path },
    }

    instance_exec(&block) if block
  }
end