operator

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: 8 Imported by: 4

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 operator client.

func New

New builds a new operator client.

func NewForConfig

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

NewForConfig builds a new operator client for the given config.

func (*Client) CreateStorageCluster

func (c *Client) CreateStorageCluster(cluster *corev1.StorageCluster) (*corev1.StorageCluster, error)

CreateStorageCluster creates the given StorageCluster

func (*Client) CreateStorageNode

func (c *Client) CreateStorageNode(node *corev1.StorageNode) (*corev1.StorageNode, error)

CreateStorageNode creates the given StorageNode

func (*Client) DeleteStorageCluster

func (c *Client) DeleteStorageCluster(name, namespace string) error

DeleteStorageCluster deletes the given StorageCluster

func (*Client) DeleteStorageNode

func (c *Client) DeleteStorageNode(name, namespace string) error

DeleteStorageNode deletes the given StorageNode

func (*Client) GetStorageCluster

func (c *Client) GetStorageCluster(name, namespace string) (*corev1.StorageCluster, error)

GetStorageCluster gets the StorageCluster with given name and namespace

func (*Client) GetStorageNode

func (c *Client) GetStorageNode(name, namespace string) (*corev1.StorageNode, error)

GetStorageNode gets the StorageNode with given name and namespace

func (*Client) ListStorageClusters

func (c *Client) ListStorageClusters(namespace string) (*corev1.StorageClusterList, error)

ListStorageClusters lists all the StorageClusters

func (*Client) ListStorageNodes

func (c *Client) ListStorageNodes(namespace string) (*corev1.StorageNodeList, error)

ListStorageNodes lists all the StorageNodes

func (*Client) SetConfig

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

SetConfig sets the config and resets the client

func (*Client) UpdateStorageCluster

func (c *Client) UpdateStorageCluster(cluster *corev1.StorageCluster) (*corev1.StorageCluster, error)

UpdateStorageCluster updates the given StorageCluster

func (*Client) UpdateStorageClusterStatus

func (c *Client) UpdateStorageClusterStatus(cluster *corev1.StorageCluster) (*corev1.StorageCluster, error)

UpdateStorageClusterStatus update the status of given StorageCluster

func (*Client) UpdateStorageNode

func (c *Client) UpdateStorageNode(node *corev1.StorageNode) (*corev1.StorageNode, error)

UpdateStorageNode updates the given StorageNode

func (*Client) UpdateStorageNodeCondition

func (c *Client) UpdateStorageNodeCondition(
	status *corev1.NodeStatus,
	condition *corev1.NodeCondition,
) bool

UpdateStorageNodeCondition updates or creates the given condition in node status. Returns true if the condition is new or was changed.

func (*Client) UpdateStorageNodeStatus

func (c *Client) UpdateStorageNodeStatus(node *corev1.StorageNode) (*corev1.StorageNode, error)

UpdateStorageNodeStatus update the status of given StorageNode

type Ops

type Ops interface {
	StorageClusterOps
	StorageNodeOps

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

Ops is an interface to Operator operations.

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 StorageClusterOps

type StorageClusterOps interface {
	// CreateStorageCluster creates the given StorageCluster
	CreateStorageCluster(*corev1.StorageCluster) (*corev1.StorageCluster, error)
	// UpdateStorageCluster updates the given StorageCluster
	UpdateStorageCluster(*corev1.StorageCluster) (*corev1.StorageCluster, error)
	// GetStorageCluster gets the StorageCluster with given name and namespace
	GetStorageCluster(string, string) (*corev1.StorageCluster, error)
	// ListStorageClusters lists all the StorageClusters
	ListStorageClusters(string) (*corev1.StorageClusterList, error)
	// DeleteStorageCluster deletes the given StorageCluster
	DeleteStorageCluster(string, string) error
	// UpdateStorageClusterStatus update the status of given StorageCluster
	UpdateStorageClusterStatus(*corev1.StorageCluster) (*corev1.StorageCluster, error)
}

StorageClusterOps is an interface to perfrom k8s StorageCluster operations

type StorageNodeOps

type StorageNodeOps interface {
	// CreateStorageNode creates the given StorageNode
	CreateStorageNode(*corev1.StorageNode) (*corev1.StorageNode, error)
	// UpdateStorageNode updates the given StorageNode
	UpdateStorageNode(*corev1.StorageNode) (*corev1.StorageNode, error)
	// GetStorageNode gets the StorageNode with given name and namespace
	GetStorageNode(string, string) (*corev1.StorageNode, error)
	// ListStorageNodes lists all the StorageNodes
	ListStorageNodes(string) (*corev1.StorageNodeList, error)
	// DeleteStorageNode deletes the given StorageNode
	DeleteStorageNode(string, string) error
	// UpdateStorageNodeStatus update the status of given StorageNode
	UpdateStorageNodeStatus(*corev1.StorageNode) (*corev1.StorageNode, error)
	// UpdateStorageNodeCondition updates or creates the given condition in node status.
	// Returns true if the condition is new or was changed.
	UpdateStorageNodeCondition(*corev1.NodeStatus, *corev1.NodeCondition) bool
}

StorageNodeOps is an interface to perfrom k8s StorageNode operations

Jump to

Keyboard shortcuts

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