volume

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 3

README

KubernetesVolume

Configure volumes in custom types for underlying pods in a uniform way.

type SomeCustomApp struct {
	BufferStorage *volume.KubernetesVolume `json:"bufferStorage,omitempty"` 
}

And this is how you would configure it through yaml

someCustomApp:
  bufferStorage:
    hostPath:
      path: "/buffer" # set this here, or provide a default in the code

In the operator you can use the GetVolume method on the object in a generic way:

// provide a default path if hostPath is used but no actual path has been configured explicitly
someCustomApp.bufferStorage.WithDefaultHostPath("/opt/buffer")

volume := someCustomApp.bufferStorage.GetVolume(
  "volumeName",
))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubernetesVolume

type KubernetesVolume struct {
	// Deprecated, use hostPath
	HostPathLegacy *corev1.HostPathVolumeSource `json:"host_path,omitempty"`
	HostPath       *corev1.HostPathVolumeSource `json:"hostPath,omitempty"`
	EmptyDir       *corev1.EmptyDirVolumeSource `json:"emptyDir,omitempty"`
	SecretSource   *corev1.SecretVolumeSource   `json:"secret,omitempty"`
	// PersistentVolumeClaim defines the Spec and the Source at the same time.
	// The PVC will be created with the configured spec and the name defined in the source.
	PersistentVolumeClaim *PersistentVolumeClaim `json:"pvc,omitempty"`
}

func (*KubernetesVolume) ApplyPVCForStatefulSet

func (v *KubernetesVolume) ApplyPVCForStatefulSet(containerName string, path string, spec *v1.StatefulSetSpec, meta func(name string) metav1.ObjectMeta) error

func (*KubernetesVolume) ApplyVolumeForPodSpec

func (v *KubernetesVolume) ApplyVolumeForPodSpec(volumeName, containerName string, path string, spec *corev1.PodSpec) error

func (*KubernetesVolume) DeepCopy

func (in *KubernetesVolume) DeepCopy() *KubernetesVolume

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesVolume.

func (*KubernetesVolume) DeepCopyInto

func (in *KubernetesVolume) DeepCopyInto(out *KubernetesVolume)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*KubernetesVolume) GetVolume

func (v *KubernetesVolume) GetVolume(name string) (corev1.Volume, error)

GetVolume returns a default emptydir volume if none configured

`name` will be the name of the volume and the lowest level directory in case a hostPath mount is used

func (*KubernetesVolume) WithDefaultHostPath

func (v *KubernetesVolume) WithDefaultHostPath(path string)

`path` is the path in case the hostPath volume type is used and no path has been defined explicitly

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	PersistentVolumeClaimSpec corev1.PersistentVolumeClaimSpec         `json:"spec,omitempty"`
	PersistentVolumeSource    corev1.PersistentVolumeClaimVolumeSource `json:"source,omitempty"`
}

func (*PersistentVolumeClaim) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeClaim.

func (*PersistentVolumeClaim) DeepCopyInto

func (in *PersistentVolumeClaim) DeepCopyInto(out *PersistentVolumeClaim)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL