storage

package
v1.20.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 10 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInstance

func SetInstance(i Ops)

SetInstance replaces the instance with the provided one. Should be used only for testing purposes.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a wrapper for the kubernetes storage client.

func New

New creates a new client.

func NewForConfig

func NewForConfig(c *rest.Config) (*Client, error)

NewForConfig creates a new client for the given config.

func (*Client) CreateStorageClass

func (c *Client) CreateStorageClass(sc *storagev1.StorageClass) (*storagev1.StorageClass, error)

CreateStorageClass creates the given storage class

func (*Client) CreateVolumeAttachment

func (c *Client) CreateVolumeAttachment(volumeAttachment *storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error)

CreateVolumeAttachment creates a volume attachment

func (*Client) DeleteStorageClass

func (c *Client) DeleteStorageClass(name string) error

DeleteStorageClass deletes the given storage class

func (*Client) DeleteVolumeAttachment

func (c *Client) DeleteVolumeAttachment(name string) error

DeleteVolumeAttachment deletes a given Volume Attachment by name

func (*Client) GetStorageClass

func (c *Client) GetStorageClass(name string) (*storagev1.StorageClass, error)

GetStorageClass returns the storage class for the give namme

func (*Client) GetStorageClassParams

func (c *Client) GetStorageClassParams(sc *storagev1.StorageClass) (map[string]string, error)

GetStorageClassParams returns the parameters of the given sc in the native map format

func (*Client) GetStorageClasses

func (c *Client) GetStorageClasses(labelSelector map[string]string) (*storagev1.StorageClassList, error)

GetStorageClasses returns all storageClasses that match given optional label selector

func (*Client) ListVolumeAttachments

func (c *Client) ListVolumeAttachments() (*storagev1.VolumeAttachmentList, error)

ListVolumeAttachments lists all volume attachments

func (*Client) SetConfig

func (c *Client) SetConfig(cfg *rest.Config)

SetConfig sets the config and resets the client

func (*Client) UpdateVolumeAttachment

func (c *Client) UpdateVolumeAttachment(volumeAttachment *storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error)

UpdateVolumeAttachment updates a volume attachment

func (*Client) UpdateVolumeAttachmentStatus

func (c *Client) UpdateVolumeAttachmentStatus(volumeAttachment *storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error)

UpdateVolumeAttachmentStatus updates a volume attachment status

func (*Client) ValidateStorageClass

func (c *Client) ValidateStorageClass(name string) (*storagev1.StorageClass, error)

ValidateStorageClass validates the given storage class

type Ops

type Ops interface {
	StorageClassOps
	VolumeAttachmentOps

	// SetConfig sets the config and resets the client
	SetConfig(config *rest.Config)
}

Ops is an interface to perform kubernetes related operations on the core resources.

func Instance

func Instance() Ops

Instance returns a singleton instance of the client.

func NewInstanceFromConfigFile

func NewInstanceFromConfigFile(config string) (Ops, error)

NewInstanceFromConfigFile returns new instance of client by using given config file

type StorageClassOps

type StorageClassOps interface {
	// GetStorageClasses returns all storageClasses that match given optional label selector
	GetStorageClasses(labelSelector map[string]string) (*storagev1.StorageClassList, error)
	// GetStorageClass returns the storage class for the give namme
	GetStorageClass(name string) (*storagev1.StorageClass, error)
	// CreateStorageClass creates the given storage class
	CreateStorageClass(sc *storagev1.StorageClass) (*storagev1.StorageClass, error)
	// DeleteStorageClass deletes the given storage class
	DeleteStorageClass(name string) error
	// GetStorageClassParams returns the parameters of the given sc in the native map format
	GetStorageClassParams(sc *storagev1.StorageClass) (map[string]string, error)
	// ValidateStorageClass validates the given storage class
	// TODO: This is currently the same as GetStorageClass. If no one is using it,
	// we should remove this method
	ValidateStorageClass(name string) (*storagev1.StorageClass, error)
}

StorageClassOps is an interface to perform k8s storage class operations

type VolumeAttachmentOps

type VolumeAttachmentOps interface {
	// ListVolumeAttachments lists all volume attachments
	ListVolumeAttachments() (*storagev1.VolumeAttachmentList, error)
	// DeleteVolumeAttachment deletes a given Volume Attachment by name
	DeleteVolumeAttachment(name string) error
	// CreateVolumeAttachment creates a volume attachment
	CreateVolumeAttachment(*storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error)
	// UpdateVolumeAttachment updates a volume attachment
	UpdateVolumeAttachment(*storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error)
	// UpdateVolumeAttachmentStatus updates a volume attachment status
	UpdateVolumeAttachmentStatus(*storagev1.VolumeAttachment) (*storagev1.VolumeAttachment, error)
}

VolumeAttachmentOps is an interface to perform k8s VolumeAttachmentOps operations

Jump to

Keyboard shortcuts

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