pvc

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Poll is a poll interval for PVC tests
	Poll = 2 * time.Second
	// Timeout is a timeout interval for PVC operations
	Timeout = 1800 * time.Second
	// Block volume mode
	Block = "Block"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// KubeClient *core.KubeClient
	Interface tcorev1.PersistentVolumeClaimInterface
	ClientSet kubernetes.Interface
	Namespace string
	Timeout   int
}

Client conatins pvc interface and kubeclient

func (*Client) CheckAnnotationsForVolumes

func (c *Client) CheckAnnotationsForVolumes(ctx context.Context, scObject *v2.StorageClass) error

CheckAnnotationsForVolumes checking annotations for every pvc, that belongs to PVCClient, to be Bound

func (*Client) Create

Create uses client interface to make API call for creating provided PersistentVolumeClaim

func (*Client) CreateMultiple

func (c *Client) CreateMultiple(ctx context.Context, pvc *v1.PersistentVolumeClaim, pvcNum int, pvcSize string) error

CreateMultiple creates multiple instances of provided PersistentVolumeClaim

func (*Client) CreatePVCObject

func (c *Client) CreatePVCObject(_ context.Context, remotePVObject *v1.PersistentVolume, remoteNamespace string) v1.PersistentVolumeClaim

CreatePVCObject will read the remotepvobject and return pvc object for the same

func (*Client) Delete

Delete deletes PersistentVolumeClaim from Kubernetes

func (*Client) DeleteAll

func (c *Client) DeleteAll(ctx context.Context) error

DeleteAll deletes all client pvcs in timely manner, using event subscription model

func (*Client) Get

func (c *Client) Get(ctx context.Context, name string) *PersistentVolumeClaim

Get uses client interface to make API call for getting provided PersistentVolumeClaim

func (*Client) MakePVC

func (c *Client) MakePVC(cfg *Config) *v1.PersistentVolumeClaim

MakePVC creates new PersistentVolumeClaim object from Config

func (*Client) MakePVCFromYaml

func (c *Client) MakePVCFromYaml(ctx context.Context, filePath string) (*v1.PersistentVolumeClaim, error)

MakePVCFromYaml makes PersistentVolumeClaim object from provided yaml file

func (*Client) Update

Update updates a PersistentVolumeClaim

func (*Client) WaitForAllToBeBound

func (c *Client) WaitForAllToBeBound(ctx context.Context) error

WaitForAllToBeBound waits for every pvc, that belongs to PVCClient, to be Bound

type Config

type Config struct {
	// Name defaults to "" if unspecified
	Name string

	// NamePrefix defaults to "pvc-" if unspecified
	NamePrefix string

	// SnapName
	SnapName string

	// SourceVolumeName
	SourceVolumeName string

	// ClaimSize must be specified in the Quantity format. Defaults to 2Gi if
	// unspecified
	ClaimSize string
	// AccessModes defaults to RWO if unspecified
	AccessModes      []v1.PersistentVolumeAccessMode
	Annotations      map[string]string
	Selector         *metav1.LabelSelector
	StorageClassName *string
	// VolumeMode defaults to nil if unspecified or specified as the empty
	// string
	VolumeMode *v1.PersistentVolumeMode
	// Labels to group the volumes for vgs
	Labels map[string]string
}

Config describes PersistentVolumeClaim

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	Client  *Client
	Object  *v1.PersistentVolumeClaim
	Deleted bool
	// contains filtered or unexported fields
}

PersistentVolumeClaim conatins pvc client and claim

func (*PersistentVolumeClaim) GetError

func (pvc *PersistentVolumeClaim) GetError() error

GetError returns PVC error

func (*PersistentVolumeClaim) HasError

func (pvc *PersistentVolumeClaim) HasError() bool

HasError checks if PVC contains error

func (*PersistentVolumeClaim) Sync

Sync waits until PVC is deleted or bound

func (*PersistentVolumeClaim) WaitToBeBound

func (pvc *PersistentVolumeClaim) WaitToBeBound(ctx context.Context) error

WaitToBeBound waits until PVC is Bound

func (*PersistentVolumeClaim) WaitUntilGone

func (pvc *PersistentVolumeClaim) WaitUntilGone(ctx context.Context) error

WaitUntilGone stalls until said PVC no longer can be found in Kubernetes

Jump to

Keyboard shortcuts

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