k8sclient

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: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NamespacePoll is a poll interval for Namespace tests
	NamespacePoll = 2 * time.Second
	// NamespaceTimeout is a timeout interval for Namespace operations
	NamespaceTimeout = 1800 * time.Second
)

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(configPath string) (*rest.Config, error)

GetConfig reads and returns rest.config

func GetConfigFromFile

func GetConfigFromFile(kubeconfig string) (*rest.Config, error)

GetConfigFromFile creates *rest.Config object from provided config path

func RandomSuffix

func RandomSuffix() string

RandomSuffix returns a random suffix to use when naming resources

Types

type Clients

type Clients struct {
	PVCClient              *pvc.Client
	PodClient              *pod.Client
	StatefulSetClient      *statefulset.Client
	VaClient               *va.Client
	MetricsClient          *metrics.Client
	SnapClientGA           *snapv1.SnapshotClient
	SnapClientBeta         *snapbeta.SnapshotClient
	PersistentVolumeClient *pv.Client
	NodeClient             *node.Client
	SCClient               *sc.Client
	RgClient               *rg.Client
	VgsClient              *volumegroupsnapshot.Client
	KubeClient             *KubeClient
	CSISCClient            *csistoragecapacity.Client
}

Clients contains client handles for K8s resources

type KubeClient

type KubeClient struct {
	ClientSet   kubernetes.Interface
	Config      *rest.Config
	VersionInfo *version.Info

	Minor int
	// contains filtered or unexported fields
}

KubeClient is a central entity of framework, that gives access to kubernetes client handle

func NewKubeClient

func NewKubeClient(config *rest.Config, timeout int) (*KubeClient, error)

NewKubeClient is a KubeClient constructor, that creates new instance of KubeClient from provided config

func NewRemoteKubeClient

func NewRemoteKubeClient(config *rest.Config, timeout int) (*KubeClient, error)

NewRemoteKubeClient is a KubeClient constructor, that creates new instance of KubeClient from provided config

func (*KubeClient) CreateCSISCClient

func (c *KubeClient) CreateCSISCClient(namespace string) (*csistoragecapacity.Client, error)

CreateCSISCClient creates a new instance of CSI Storage capacity client

func (*KubeClient) CreateMetricsClient

func (c *KubeClient) CreateMetricsClient(namespace string) (*metrics.Client, error)

CreateMetricsClient creates a new instance of metrics client

func (*KubeClient) CreateNamespace

func (c *KubeClient) CreateNamespace(ctx context.Context, namespace string) (*v1.Namespace, error)

CreateNamespace creates new namespace with provided name

func (*KubeClient) CreateNamespaceWithSuffix

func (c *KubeClient) CreateNamespaceWithSuffix(ctx context.Context, namespace string) (*v1.Namespace, error)

CreateNamespaceWithSuffix creates new namespace with provided name and appends random suffix

func (*KubeClient) CreateNodeClient

func (c *KubeClient) CreateNodeClient() (*node.Client, error)

CreateNodeClient creates a new instance of node client

func (*KubeClient) CreatePVCClient

func (c *KubeClient) CreatePVCClient(namespace string) (*pvc.Client, error)

CreatePVCClient creates a new instance of Client in supplied namespace

func (*KubeClient) CreatePVClient

func (c *KubeClient) CreatePVClient() (*pv.Client, error)

CreatePVClient creates a new instance of persistent volume client

func (*KubeClient) CreatePodClient

func (c *KubeClient) CreatePodClient(namespace string) (*pod.Client, error)

CreatePodClient creates a new instance of Pod client

func (*KubeClient) CreateRGClient

func (c *KubeClient) CreateRGClient() (*rg.Client, error)

CreateRGClient creates a new instance of replication group client

func (*KubeClient) CreateSCClient

func (c *KubeClient) CreateSCClient() (*sc.Client, error)

CreateSCClient creates storage class client

func (*KubeClient) CreateSnapshotBetaClient

func (c *KubeClient) CreateSnapshotBetaClient(namespace string) (*snapbeta.SnapshotClient, error)

CreateSnapshotBetaClient creates a new instance of beta snapshot client

func (*KubeClient) CreateSnapshotContentBetaClient

func (c *KubeClient) CreateSnapshotContentBetaClient() (*contentbeta.SnapshotContentClient, error)

CreateSnapshotContentBetaClient creates a new instance of beta snapshot contents client

func (*KubeClient) CreateSnapshotContentGAClient

func (c *KubeClient) CreateSnapshotContentGAClient() (*contentv1.SnapshotContentClient, error)

CreateSnapshotContentGAClient creates a new instance of snapshot contents client

func (*KubeClient) CreateSnapshotGAClient

func (c *KubeClient) CreateSnapshotGAClient(namespace string) (*snapv1.SnapshotClient, error)

CreateSnapshotGAClient creates a new instance of snapshot client

func (*KubeClient) CreateStatefulSetClient

func (c *KubeClient) CreateStatefulSetClient(namespace string) (*statefulset.Client, error)

CreateStatefulSetClient creates a new instance of StatefulSetClient in supplied namespace

func (*KubeClient) CreateVGSClient

func (c *KubeClient) CreateVGSClient() (*volumegroupsnapshot.Client, error)

CreateVGSClient creates a new instance of volume group snapshot client

func (*KubeClient) CreateVaClient

func (c *KubeClient) CreateVaClient(namespace string) (*va.Client, error)

CreateVaClient creates a new instance of volume attachment client

func (*KubeClient) DeleteNamespace

func (c *KubeClient) DeleteNamespace(ctx context.Context, namespace string) error

DeleteNamespace deletes all resources inside namespace, and waits for termination

func (*KubeClient) ForceDeleteNamespace

func (c *KubeClient) ForceDeleteNamespace(ctx context.Context, namespace string) error

ForceDeleteNamespace force deletes the namespace and its resources

func (*KubeClient) NamespaceExists

func (c *KubeClient) NamespaceExists(ctx context.Context, namespace string) (bool, error)

NamespaceExists checks whether a namespace exists

func (*KubeClient) SetTimeout

func (c *KubeClient) SetTimeout(val int)

SetTimeout sets client timeout

func (*KubeClient) SnapshotClassExists

func (c *KubeClient) SnapshotClassExists(snapClass string) (bool, error)

SnapshotClassExists checks whether snapshot class exists

func (*KubeClient) StorageClassExists

func (c *KubeClient) StorageClassExists(ctx context.Context, storageClass string) (bool, error)

StorageClassExists checks whether a storage class exists

func (*KubeClient) Timeout

func (c *KubeClient) Timeout() int

Timeout returns client timeout

type KubeClientInterface

type KubeClientInterface interface {
	CreateStatefulSetClient(namespace string) (*statefulset.Client, error)
	CreatePVCClient(namespace string) (*pvc.Client, error)
	CreatePodClient(namespace string) (*pod.Client, error)
	CreateVaClient(namespace string) (*va.Client, error)
	CreateMetricsClient(namespace string) (*metrics.Client, error)
	CreateNamespace(namespace string) (*v1.Namespace, error)
	CreateNamespaceWithSuffix(namespace string) (*v1.Namespace, error)
	DeleteNamespace(namespace string) error
	StorageClassExists(storageClass string) (bool, error)
	NamespaceExists(namespace string) (bool, error)
	CreateSCClient(namespace string) (*sc.Client, error)
	CreateRGClient(namespace string) (*rg.Client, error)
	CreateCSISCClient(namespace string) (*csistoragecapacity.Client, error)
	Timeout() int
}

KubeClientInterface contains Kube APIs

Jump to

Keyboard shortcuts

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