client

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package client ...

Package client provides a way to communicate with a k8s cluster.

Package client ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the internal client for Kubernetes.

func NewInCluster added in v0.5.0

func NewInCluster() (*Client, error)

NewInCluster creates a client using incluster authentication.

func (*Client) ApplyObject added in v0.2.0

func (c *Client) ApplyObject(obj runtime.Object) error

ApplyObject applies object.

func (*Client) ClusterName

func (c *Client) ClusterName() string

ClusterName returns the name of the k8s cluster.

func (*Client) Config added in v0.5.0

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

Config returns restConfig to the pkg/kubernetes.Kubernetes client.

func (*Client) CreateBackupStorage added in v0.2.0

func (c *Client) CreateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error

CreateBackupStorage creates an backupStorage.

func (*Client) CreateMonitoringConfig added in v0.2.0

func (c *Client) CreateMonitoringConfig(ctx context.Context, config *everestv1alpha1.MonitoringConfig) error

CreateMonitoringConfig creates an monitoringConfig.

func (*Client) CreateSecret added in v0.2.0

func (c *Client) CreateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)

CreateSecret creates k8s Secret.

func (*Client) DeleteBackupStorage added in v0.2.0

func (c *Client) DeleteBackupStorage(ctx context.Context, name string) error

DeleteBackupStorage deletes the backupStorage.

func (*Client) DeleteMonitoringConfig added in v0.2.0

func (c *Client) DeleteMonitoringConfig(ctx context.Context, namespace, name string) error

DeleteMonitoringConfig deletes the monitoringConfig.

func (*Client) DeleteObject added in v0.2.0

func (c *Client) DeleteObject(obj runtime.Object) error

DeleteObject deletes object from the k8s cluster.

func (*Client) DeleteSecret added in v0.2.0

func (c *Client) DeleteSecret(ctx context.Context, namespace, name string) error

DeleteSecret deletes the k8s Secret.

func (*Client) GetBackupStorage added in v0.2.0

func (c *Client) GetBackupStorage(ctx context.Context, name string) (*everestv1alpha1.BackupStorage, error)

GetBackupStorage returns the backupStorage.

func (*Client) GetConfigMap added in v0.8.0

func (c *Client) GetConfigMap(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)

GetConfigMap fetches the config map in the provided namespace.

func (*Client) GetDatabaseCluster

func (c *Client) GetDatabaseCluster(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseCluster, error)

GetDatabaseCluster returns database clusters by provided name.

func (*Client) GetDatabaseClusterBackup added in v0.3.0

func (c *Client) GetDatabaseClusterBackup(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterBackup, error)

GetDatabaseClusterBackup returns database cluster backups by provided name.

func (*Client) GetDatabaseClusterRestore added in v0.3.0

func (c *Client) GetDatabaseClusterRestore(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterRestore, error)

GetDatabaseClusterRestore returns database clusters by provided name.

func (*Client) GetDatabaseEngine added in v0.3.0

func (c *Client) GetDatabaseEngine(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseEngine, error)

GetDatabaseEngine returns database clusters by provided name.

func (*Client) GetDeployment added in v0.8.0

func (c *Client) GetDeployment(ctx context.Context, name string, namespace string) (*appsv1.Deployment, error)

GetDeployment returns deployment by name.

func (*Client) GetMonitoringConfig added in v0.2.0

func (c *Client) GetMonitoringConfig(ctx context.Context, namespace, name string) (*everestv1alpha1.MonitoringConfig, error)

GetMonitoringConfig returns the monitoringConfig.

func (*Client) GetNamespace added in v0.2.0

func (c *Client) GetNamespace(ctx context.Context, name string) (*corev1.Namespace, error)

GetNamespace returns a namespace.

func (*Client) GetNodes

func (c *Client) GetNodes(ctx context.Context) (*corev1.NodeList, error)

GetNodes returns list of nodes.

func (*Client) GetObject added in v0.2.0

func (c *Client) GetObject(gvk schema.GroupVersionKind, name string, into runtime.Object) error

GetObject retrieves an object by provided group, version, kind and name.

func (*Client) GetPersistentVolumes

func (c *Client) GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error)

GetPersistentVolumes returns Persistent Volumes available in the cluster.

func (*Client) GetPods

func (c *Client) GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error)

GetPods returns list of pods.

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)

GetSecret returns secret by name.

func (*Client) GetServerVersion

func (c *Client) GetServerVersion() (*version.Info, error)

GetServerVersion returns server version.

func (*Client) GetStorageClasses

func (c *Client) GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error)

GetStorageClasses returns all storage classes available in the cluster.

func (*Client) ListBackupStorages added in v0.5.0

func (c *Client) ListBackupStorages(ctx context.Context, options metav1.ListOptions) (*everestv1alpha1.BackupStorageList, error)

ListBackupStorages returns the backupStorage.

func (*Client) ListDatabaseClusterBackups added in v0.3.0

func (c *Client) ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterBackupList, error)

ListDatabaseClusterBackups returns list of managed database cluster backups.

func (*Client) ListDatabaseClusterRestores added in v0.3.0

func (c *Client) ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterRestoreList, error)

ListDatabaseClusterRestores returns list of managed database clusters.

func (*Client) ListDatabaseClusters

func (c *Client) ListDatabaseClusters(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterList, error)

ListDatabaseClusters returns list of managed database clusters.

func (*Client) ListDatabaseEngines added in v0.3.0

func (c *Client) ListDatabaseEngines(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseEngineList, error)

ListDatabaseEngines returns list of managed database clusters.

func (*Client) ListMonitoringConfigs added in v0.2.0

func (c *Client) ListMonitoringConfigs(ctx context.Context, namespace string) (*everestv1alpha1.MonitoringConfigList, error)

ListMonitoringConfigs returns the monitoringConfig.

func (*Client) ListObjects added in v0.2.0

func (c *Client) ListObjects(gvk schema.GroupVersionKind, into runtime.Object) error

ListObjects lists objects by provided group, version, kind.

func (*Client) Namespace added in v0.5.0

func (c *Client) Namespace() string

Namespace returns the namespace of the k8s cluster.

func (*Client) UpdateBackupStorage added in v0.2.0

func (c *Client) UpdateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error

UpdateBackupStorage updates an backupStorage.

func (*Client) UpdateMonitoringConfig added in v0.5.0

func (c *Client) UpdateMonitoringConfig(ctx context.Context, config *everestv1alpha1.MonitoringConfig) error

UpdateMonitoringConfig updates an monitoringConfig.

func (*Client) UpdateSecret added in v0.2.0

func (c *Client) UpdateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)

UpdateSecret updates k8s Secret.

type KubeClientConnector

type KubeClientConnector interface {
	// CreateBackupStorage creates an backupStorage.
	CreateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error
	// UpdateBackupStorage updates an backupStorage.
	UpdateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error
	// GetBackupStorage returns the backupStorage.
	GetBackupStorage(ctx context.Context, name string) (*everestv1alpha1.BackupStorage, error)
	// ListBackupStorages returns the backupStorage.
	ListBackupStorages(ctx context.Context, options metav1.ListOptions) (*everestv1alpha1.BackupStorageList, error)
	// DeleteBackupStorage deletes the backupStorage.
	DeleteBackupStorage(ctx context.Context, name string) error
	// Config returns restConfig to the pkg/kubernetes.Kubernetes client.
	Config() *rest.Config
	// ClusterName returns the name of the k8s cluster.
	ClusterName() string
	// Namespace returns the namespace of the k8s cluster.
	Namespace() string
	// GetServerVersion returns server version.
	GetServerVersion() (*version.Info, error)
	// ApplyObject applies object.
	ApplyObject(obj runtime.Object) error
	// DeleteObject deletes object from the k8s cluster.
	DeleteObject(obj runtime.Object) error
	// ListObjects lists objects by provided group, version, kind.
	ListObjects(gvk schema.GroupVersionKind, into runtime.Object) error
	// GetObject retrieves an object by provided group, version, kind and name.
	GetObject(gvk schema.GroupVersionKind, name string, into runtime.Object) error
	// GetConfigMap fetches the config map in the provided namespace.
	GetConfigMap(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)
	// GetDeployment returns deployment by name.
	GetDeployment(ctx context.Context, name string, namespace string) (*appsv1.Deployment, error)
	// ListDatabaseClusters returns list of managed database clusters.
	ListDatabaseClusters(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterList, error)
	// GetDatabaseCluster returns database clusters by provided name.
	GetDatabaseCluster(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseCluster, error)
	// ListDatabaseClusterBackups returns list of managed database cluster backups.
	ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterBackupList, error)
	// GetDatabaseClusterBackup returns database cluster backups by provided name.
	GetDatabaseClusterBackup(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterBackup, error)
	// ListDatabaseClusterRestores returns list of managed database clusters.
	ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterRestoreList, error)
	// GetDatabaseClusterRestore returns database clusters by provided name.
	GetDatabaseClusterRestore(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterRestore, error)
	// ListDatabaseEngines returns list of managed database clusters.
	ListDatabaseEngines(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseEngineList, error)
	// GetDatabaseEngine returns database clusters by provided name.
	GetDatabaseEngine(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseEngine, error)
	// CreateMonitoringConfig creates an monitoringConfig.
	CreateMonitoringConfig(ctx context.Context, config *everestv1alpha1.MonitoringConfig) error
	// UpdateMonitoringConfig updates an monitoringConfig.
	UpdateMonitoringConfig(ctx context.Context, config *everestv1alpha1.MonitoringConfig) error
	// GetMonitoringConfig returns the monitoringConfig.
	GetMonitoringConfig(ctx context.Context, namespace, name string) (*everestv1alpha1.MonitoringConfig, error)
	// ListMonitoringConfigs returns the monitoringConfig.
	ListMonitoringConfigs(ctx context.Context, namespace string) (*everestv1alpha1.MonitoringConfigList, error)
	// DeleteMonitoringConfig deletes the monitoringConfig.
	DeleteMonitoringConfig(ctx context.Context, namespace, name string) error
	// GetNamespace returns a namespace.
	GetNamespace(ctx context.Context, name string) (*corev1.Namespace, error)
	// GetNodes returns list of nodes.
	GetNodes(ctx context.Context) (*corev1.NodeList, error)
	// GetPods returns list of pods.
	GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error)
	// GetSecret returns secret by name.
	GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)
	// UpdateSecret updates k8s Secret.
	UpdateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)
	// CreateSecret creates k8s Secret.
	CreateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)
	// DeleteSecret deletes the k8s Secret.
	DeleteSecret(ctx context.Context, namespace, name string) error
	// GetStorageClasses returns all storage classes available in the cluster.
	GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error)
	// GetPersistentVolumes returns Persistent Volumes available in the cluster.
	GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error)
}

KubeClientConnector ...

type MockKubeClientConnector

type MockKubeClientConnector struct {
	mock.Mock
}

MockKubeClientConnector is an autogenerated mock type for the KubeClientConnector type

func NewMockKubeClientConnector added in v0.2.0

func NewMockKubeClientConnector(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockKubeClientConnector

NewMockKubeClientConnector creates a new instance of MockKubeClientConnector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockKubeClientConnector) ApplyObject added in v0.2.0

func (_m *MockKubeClientConnector) ApplyObject(obj runtime.Object) error

ApplyObject provides a mock function with given fields: obj

func (*MockKubeClientConnector) ClusterName

func (_m *MockKubeClientConnector) ClusterName() string

ClusterName provides a mock function with given fields:

func (*MockKubeClientConnector) Config added in v0.5.0

func (_m *MockKubeClientConnector) Config() *rest.Config

Config provides a mock function with given fields:

func (*MockKubeClientConnector) CreateBackupStorage added in v0.2.0

func (_m *MockKubeClientConnector) CreateBackupStorage(ctx context.Context, storage *v1alpha1.BackupStorage) error

CreateBackupStorage provides a mock function with given fields: ctx, storage

func (*MockKubeClientConnector) CreateMonitoringConfig added in v0.2.0

func (_m *MockKubeClientConnector) CreateMonitoringConfig(ctx context.Context, config *v1alpha1.MonitoringConfig) error

CreateMonitoringConfig provides a mock function with given fields: ctx, config

func (*MockKubeClientConnector) CreateSecret added in v0.2.0

func (_m *MockKubeClientConnector) CreateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error)

CreateSecret provides a mock function with given fields: ctx, secret

func (*MockKubeClientConnector) DeleteBackupStorage added in v0.2.0

func (_m *MockKubeClientConnector) DeleteBackupStorage(ctx context.Context, name string) error

DeleteBackupStorage provides a mock function with given fields: ctx, name

func (*MockKubeClientConnector) DeleteMonitoringConfig added in v0.2.0

func (_m *MockKubeClientConnector) DeleteMonitoringConfig(ctx context.Context, namespace string, name string) error

DeleteMonitoringConfig provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) DeleteObject added in v0.2.0

func (_m *MockKubeClientConnector) DeleteObject(obj runtime.Object) error

DeleteObject provides a mock function with given fields: obj

func (*MockKubeClientConnector) DeleteSecret added in v0.2.0

func (_m *MockKubeClientConnector) DeleteSecret(ctx context.Context, namespace string, name string) error

DeleteSecret provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetBackupStorage added in v0.2.0

func (_m *MockKubeClientConnector) GetBackupStorage(ctx context.Context, name string) (*v1alpha1.BackupStorage, error)

GetBackupStorage provides a mock function with given fields: ctx, name

func (*MockKubeClientConnector) GetConfigMap added in v0.8.0

func (_m *MockKubeClientConnector) GetConfigMap(ctx context.Context, namespace string, name string) (*v1.ConfigMap, error)

GetConfigMap provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetDatabaseCluster

func (_m *MockKubeClientConnector) GetDatabaseCluster(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseCluster, error)

GetDatabaseCluster provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetDatabaseClusterBackup added in v0.3.0

func (_m *MockKubeClientConnector) GetDatabaseClusterBackup(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseClusterBackup, error)

GetDatabaseClusterBackup provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetDatabaseClusterRestore added in v0.3.0

func (_m *MockKubeClientConnector) GetDatabaseClusterRestore(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseClusterRestore, error)

GetDatabaseClusterRestore provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetDatabaseEngine added in v0.3.0

func (_m *MockKubeClientConnector) GetDatabaseEngine(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseEngine, error)

GetDatabaseEngine provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetDeployment added in v0.8.0

func (_m *MockKubeClientConnector) GetDeployment(ctx context.Context, name string, namespace string) (*appsv1.Deployment, error)

GetDeployment provides a mock function with given fields: ctx, name, namespace

func (*MockKubeClientConnector) GetMonitoringConfig added in v0.2.0

func (_m *MockKubeClientConnector) GetMonitoringConfig(ctx context.Context, namespace string, name string) (*v1alpha1.MonitoringConfig, error)

GetMonitoringConfig provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetNamespace added in v0.2.0

func (_m *MockKubeClientConnector) GetNamespace(ctx context.Context, name string) (*v1.Namespace, error)

GetNamespace provides a mock function with given fields: ctx, name

func (*MockKubeClientConnector) GetNodes

func (_m *MockKubeClientConnector) GetNodes(ctx context.Context) (*v1.NodeList, error)

GetNodes provides a mock function with given fields: ctx

func (*MockKubeClientConnector) GetObject added in v0.2.0

func (_m *MockKubeClientConnector) GetObject(gvk schema.GroupVersionKind, name string, into runtime.Object) error

GetObject provides a mock function with given fields: gvk, name, into

func (*MockKubeClientConnector) GetPersistentVolumes

func (_m *MockKubeClientConnector) GetPersistentVolumes(ctx context.Context) (*v1.PersistentVolumeList, error)

GetPersistentVolumes provides a mock function with given fields: ctx

func (*MockKubeClientConnector) GetPods

func (_m *MockKubeClientConnector) GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*v1.PodList, error)

GetPods provides a mock function with given fields: ctx, namespace, labelSelector

func (*MockKubeClientConnector) GetSecret

func (_m *MockKubeClientConnector) GetSecret(ctx context.Context, namespace string, name string) (*v1.Secret, error)

GetSecret provides a mock function with given fields: ctx, namespace, name

func (*MockKubeClientConnector) GetServerVersion

func (_m *MockKubeClientConnector) GetServerVersion() (*version.Info, error)

GetServerVersion provides a mock function with given fields:

func (*MockKubeClientConnector) GetStorageClasses

func (_m *MockKubeClientConnector) GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error)

GetStorageClasses provides a mock function with given fields: ctx

func (*MockKubeClientConnector) ListBackupStorages added in v0.5.0

func (_m *MockKubeClientConnector) ListBackupStorages(ctx context.Context, options metav1.ListOptions) (*v1alpha1.BackupStorageList, error)

ListBackupStorages provides a mock function with given fields: ctx, options

func (*MockKubeClientConnector) ListDatabaseClusterBackups added in v0.3.0

func (_m *MockKubeClientConnector) ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*v1alpha1.DatabaseClusterBackupList, error)

ListDatabaseClusterBackups provides a mock function with given fields: ctx, namespace, options

func (*MockKubeClientConnector) ListDatabaseClusterRestores added in v0.3.0

func (_m *MockKubeClientConnector) ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*v1alpha1.DatabaseClusterRestoreList, error)

ListDatabaseClusterRestores provides a mock function with given fields: ctx, namespace, options

func (*MockKubeClientConnector) ListDatabaseClusters

func (_m *MockKubeClientConnector) ListDatabaseClusters(ctx context.Context, namespace string, options metav1.ListOptions) (*v1alpha1.DatabaseClusterList, error)

ListDatabaseClusters provides a mock function with given fields: ctx, namespace, options

func (*MockKubeClientConnector) ListDatabaseEngines added in v0.3.0

func (_m *MockKubeClientConnector) ListDatabaseEngines(ctx context.Context, namespace string) (*v1alpha1.DatabaseEngineList, error)

ListDatabaseEngines provides a mock function with given fields: ctx, namespace

func (*MockKubeClientConnector) ListMonitoringConfigs added in v0.2.0

func (_m *MockKubeClientConnector) ListMonitoringConfigs(ctx context.Context, namespace string) (*v1alpha1.MonitoringConfigList, error)

ListMonitoringConfigs provides a mock function with given fields: ctx, namespace

func (*MockKubeClientConnector) ListObjects added in v0.2.0

ListObjects provides a mock function with given fields: gvk, into

func (*MockKubeClientConnector) Namespace added in v0.5.0

func (_m *MockKubeClientConnector) Namespace() string

Namespace provides a mock function with given fields:

func (*MockKubeClientConnector) UpdateBackupStorage added in v0.2.0

func (_m *MockKubeClientConnector) UpdateBackupStorage(ctx context.Context, storage *v1alpha1.BackupStorage) error

UpdateBackupStorage provides a mock function with given fields: ctx, storage

func (*MockKubeClientConnector) UpdateMonitoringConfig added in v0.5.0

func (_m *MockKubeClientConnector) UpdateMonitoringConfig(ctx context.Context, config *v1alpha1.MonitoringConfig) error

UpdateMonitoringConfig provides a mock function with given fields: ctx, config

func (*MockKubeClientConnector) UpdateSecret added in v0.2.0

func (_m *MockKubeClientConnector) UpdateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error)

UpdateSecret provides a mock function with given fields: ctx, secret

Directories

Path Synopsis
Package customresources provides methods to work with custom everest k8s resources.
Package customresources provides methods to work with custom everest k8s resources.

Jump to

Keyboard shortcuts

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