connection

package
v1.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(address string, log logr.Logger) (*grpc.ClientConn, error)

Connect establishes connection to socket

func GetControllerClient

func GetControllerClient(restConfig *rest.Config, scheme *runtime.Scheme) (ctrlClient.Client, error)

GetControllerClient - Returns a controller client which reads and writes directly to API server

Types

type ConnHandler

type ConnHandler interface {
	Verify(ctx context.Context) error
	GetConnection(clusterID string) (RemoteClusterClient, error)
}

ConnHandler - Interface

type MultiClusterClient

type MultiClusterClient interface {
	GetConnection(clusterID string) (RemoteClusterClient, error)
	GetClusterID() string
}

MultiClusterClient interface of client that manages multiple clusters at once

type PendingState

type PendingState struct {
	MaxPending int

	Log logr.Logger
	// contains filtered or unexported fields
}

PendingState type limits the number of pending requests by making sure there are no other requests for the same RG, otherwise a "pending" error is returned. Additionally, no more than maxPending requests are processed at a time without returning an "overload" error.

type RemoteClusterClient

type RemoteClusterClient interface {
	GetStorageClass(ctx context.Context, storageClassName string) (*storageV1.StorageClass, error)
	ListStorageClass(ctx context.Context) (*storageV1.StorageClassList, error)
	CreateStorageClass(ctx context.Context, storageClass *storageV1.StorageClass) error
	ListCustomResourceDefinitions(ctx context.Context) (*apiExtensionsv1.CustomResourceDefinitionList, error)
	GetCustomResourceDefinitions(ctx context.Context, crdName string) (*apiExtensionsv1.CustomResourceDefinition, error)
	GetPersistentVolume(ctx context.Context, persistentVolumeName string) (*corev1.PersistentVolume, error)
	CreatePersistentVolume(ctx context.Context, volume *corev1.PersistentVolume) error
	UpdatePersistentVolume(ctx context.Context, volume *corev1.PersistentVolume) error
	GetPersistentVolumeClaim(ctx context.Context, namespace, claimName string) (*corev1.PersistentVolumeClaim, error)
	UpdatePersistentVolumeClaim(ctx context.Context, claim *corev1.PersistentVolumeClaim) error
	GetReplicationGroup(ctx context.Context, replicationGroupName string) (*repv1.DellCSIReplicationGroup, error)
	UpdateReplicationGroup(ctx context.Context, group *repv1.DellCSIReplicationGroup) error
	ListReplicationGroup(ctx context.Context) (*repv1.DellCSIReplicationGroupList, error)
	CreateReplicationGroup(ctx context.Context, group *repv1.DellCSIReplicationGroup) error
	CreateSnapshotContent(ctx context.Context, content *s1.VolumeSnapshotContent) error
	CreateSnapshotObject(ctx context.Context, content *s1.VolumeSnapshot) error
	GetSnapshotClass(ctx context.Context, snapClassName string) (*s1.VolumeSnapshotClass, error)
	CreateNamespace(ctx context.Context, content *corev1.Namespace) error
	GetNamespace(ctx context.Context, namespace string) (*corev1.Namespace, error)
}

RemoteClusterClient interface provides methods for creating, modifying, deleting objects on a remote k8s cluster

type RemoteK8sConnHandler

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

RemoteK8sConnHandler handler of remote Kubernetes cluster connection

func (*RemoteK8sConnHandler) AddOrUpdateConfig

func (k8sConnHandler *RemoteK8sConnHandler) AddOrUpdateConfig(clusterID string, config *rest.Config, log logr.Logger)

AddOrUpdateConfig adds (or updates) config to the list of managed clusters

func (*RemoteK8sConnHandler) GetConnection

func (k8sConnHandler *RemoteK8sConnHandler) GetConnection(clusterID string) (RemoteClusterClient, error)

GetConnection returns client from the map of managed clusters

func (*RemoteK8sConnHandler) Verify

func (k8sConnHandler *RemoteK8sConnHandler) Verify(ctx context.Context) error

Verify if the connections have been established properly and all the required APIs are available on the remote cluster

type RemoteK8sControllerClient

type RemoteK8sControllerClient struct {
	ClusterID string
	Client    ctrlClient.Client
}

RemoteK8sControllerClient - Represents a single controller split client

func (*RemoteK8sControllerClient) CreateNamespace added in v1.4.0

func (c *RemoteK8sControllerClient) CreateNamespace(ctx context.Context, content *corev1.Namespace) error

CreateNamespace creates a desired namespace on the remote cluster.

func (*RemoteK8sControllerClient) CreatePersistentVolume

func (c *RemoteK8sControllerClient) CreatePersistentVolume(ctx context.Context, volume *corev1.PersistentVolume) error

CreatePersistentVolume creates persistent volume object in current cluster

func (*RemoteK8sControllerClient) CreateReplicationGroup

func (c *RemoteK8sControllerClient) CreateReplicationGroup(ctx context.Context, group *repv1.DellCSIReplicationGroup) error

CreateReplicationGroup creates replication group object in current cluster

func (*RemoteK8sControllerClient) CreateSnapshotContent added in v1.4.0

func (c *RemoteK8sControllerClient) CreateSnapshotContent(ctx context.Context, content *s1.VolumeSnapshotContent) error

CreateSnapshotContent creates the snapshot content on the remote cluster

func (*RemoteK8sControllerClient) CreateSnapshotObject added in v1.4.0

func (c *RemoteK8sControllerClient) CreateSnapshotObject(ctx context.Context, content *s1.VolumeSnapshot) error

CreateSnapshotObject creates the snapshot on the remote cluster

func (*RemoteK8sControllerClient) CreateStorageClass

func (c *RemoteK8sControllerClient) CreateStorageClass(ctx context.Context, storageClass *storageV1.StorageClass) error

CreateStorageClass creates storage class object in current cluster

func (*RemoteK8sControllerClient) GetCustomResourceDefinitions

func (c *RemoteK8sControllerClient) GetCustomResourceDefinitions(ctx context.Context, crdName string) (*apiExtensionsv1.CustomResourceDefinition, error)

GetCustomResourceDefinitions returns custom resource definition object by querying cluster using custom resource definition name

func (*RemoteK8sControllerClient) GetNamespace added in v1.4.0

func (c *RemoteK8sControllerClient) GetNamespace(ctx context.Context, namespace string) (*corev1.Namespace, error)

GetNamespace returns the desired namespace from the remote cluster.

func (*RemoteK8sControllerClient) GetPersistentVolume

func (c *RemoteK8sControllerClient) GetPersistentVolume(ctx context.Context, persistentVolumeName string) (*corev1.PersistentVolume, error)

GetPersistentVolume returns persistent volume object by querying cluster using persistent volume name

func (*RemoteK8sControllerClient) GetPersistentVolumeClaim

func (c *RemoteK8sControllerClient) GetPersistentVolumeClaim(ctx context.Context, namespace, claimName string) (*corev1.PersistentVolumeClaim, error)

GetPersistentVolumeClaim returns persistent volume claim object by querying cluster using persistent volume claim name

func (*RemoteK8sControllerClient) GetReplicationGroup

func (c *RemoteK8sControllerClient) GetReplicationGroup(ctx context.Context, replicationGroupName string) (*repv1.DellCSIReplicationGroup, error)

GetReplicationGroup returns replication group object by querying cluster using replication group name

func (*RemoteK8sControllerClient) GetSnapshotClass added in v1.4.0

func (c *RemoteK8sControllerClient) GetSnapshotClass(ctx context.Context, snapClassName string) (*s1.VolumeSnapshotClass, error)

GetSnapshotClass returns snapshot class object by querying cluster using snapshot class name.

func (*RemoteK8sControllerClient) GetStorageClass

func (c *RemoteK8sControllerClient) GetStorageClass(ctx context.Context, storageClassName string) (*storageV1.StorageClass, error)

GetStorageClass returns storage class object by querying cluster using storage class name

func (*RemoteK8sControllerClient) ListCustomResourceDefinitions

ListCustomResourceDefinitions returns list of custom resource definition objects that are currently in cluster

func (*RemoteK8sControllerClient) ListReplicationGroup

ListReplicationGroup returns list of all replication group objects that are currently in cluster

func (*RemoteK8sControllerClient) ListStorageClass

ListStorageClass returns list of all storage classes objects that are currently in cluster

func (*RemoteK8sControllerClient) UpdatePersistentVolume

func (c *RemoteK8sControllerClient) UpdatePersistentVolume(ctx context.Context, volume *corev1.PersistentVolume) error

UpdatePersistentVolume updates persistent volume object in current cluster

func (*RemoteK8sControllerClient) UpdatePersistentVolumeClaim

func (c *RemoteK8sControllerClient) UpdatePersistentVolumeClaim(ctx context.Context, claim *corev1.PersistentVolumeClaim) error

UpdatePersistentVolumeClaim updates persistent volume claim object in current cluster

func (*RemoteK8sControllerClient) UpdateReplicationGroup

func (c *RemoteK8sControllerClient) UpdateReplicationGroup(ctx context.Context, replicationGroup *repv1.DellCSIReplicationGroup) error

UpdateReplicationGroup updates replication group object in current cluster

type RgIDType

type RgIDType string

RgIDType represents replication group id

func (RgIDType) CheckAndUpdatePendingState

func (rgID RgIDType) CheckAndUpdatePendingState(ps *PendingState) error

CheckAndUpdatePendingState sets state of current RG as pending if allowed by current capacity

func (RgIDType) ClearPending

func (rgID RgIDType) ClearPending(ps *PendingState)

ClearPending removes current replication group from pending list

Jump to

Keyboard shortcuts

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