github.com/banzaicloud/operator-tools@v0.28.10/pkg/volume/README.md (about)

     1  
     2  ## KubernetesVolume
     3  
     4  Configure volumes in custom types for underlying pods in a uniform way.
     5  
     6  ```go
     7  type SomeCustomApp struct {
     8  	BufferStorage *volume.KubernetesVolume `json:"bufferStorage,omitempty"` 
     9  }
    10  ```
    11  
    12  And this is how you would configure it through yaml
    13  ```yaml
    14  someCustomApp:
    15    bufferStorage:
    16      hostPath:
    17        path: "/buffer" # set this here, or provide a default in the code
    18  ```
    19  
    20  In the operator you can use the `GetVolume` method on the object in a generic way:
    21  ```go
    22  // provide a default path if hostPath is used but no actual path has been configured explicitly
    23  someCustomApp.bufferStorage.WithDefaultHostPath("/opt/buffer")
    24  
    25  volume := someCustomApp.bufferStorage.GetVolume(
    26    "volumeName",
    27  ))
    28  ```