client

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package client ...

Package client TODO

Package client ...

Package client ...

Index

Constants

View Source
const (
	LEVEL0 = iota
	LEVEL1
	LEVEL2
	LEVEL3
	LEVEL4
)

Each level has 2 spaces for PrefixWriter.

Variables

This section is empty.

Functions

func DescribeEvents

func DescribeEvents(el *corev1.EventList, w PrefixWriter)

DescribeEvents describes events.

Types

type Client

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

Client is the internal client for Kubernetes.

func NewFromKubeConfig

func NewFromKubeConfig(kubeconfig string, l *zap.SugaredLogger) (*Client, error)

NewFromKubeConfig returns new Client from path to a kubeconfig.

func (*Client) ApplyFile

func (c *Client) ApplyFile(fileBytes []byte) error

ApplyFile accepts manifest file contents, parses into []runtime.Object and applies them against the cluster.

func (*Client) ApplyManifestFile added in v0.5.0

func (c *Client) ApplyManifestFile(fileBytes []byte, namespace string) error

ApplyManifestFile accepts manifest file contents, parses into []runtime.Object and applies them against the cluster.

func (*Client) ApplyObject

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 stored *rest.Config.

func (*Client) CreateBackupStorage added in v0.8.0

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

CreateBackupStorage creates an backupStorage.

func (*Client) CreateMonitoringConfig added in v0.8.0

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

CreateMonitoringConfig creates an monitoringConfig.

func (*Client) CreateNamespace

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

CreateNamespace creates a new namespace.

func (*Client) CreateOperatorGroup

func (c *Client) CreateOperatorGroup(ctx context.Context, namespace, name string, targetNamespaces []string) (*v1.OperatorGroup, error)

CreateOperatorGroup creates an operator group to be used as part of a subscription.

func (*Client) CreateSubscription added in v0.8.0

func (c *Client) CreateSubscription(ctx context.Context, namespace string, subscription *v1alpha1.Subscription) (*v1alpha1.Subscription, error)

CreateSubscription creates an OLM subscription.

func (*Client) CreateSubscriptionForCatalog

func (c *Client) CreateSubscriptionForCatalog(ctx context.Context, namespace, name, catalogNamespace, catalog,
	packageName, channel, startingCSV string, approval v1alpha1.Approval,
) (*v1alpha1.Subscription, error)

CreateSubscriptionForCatalog creates an OLM subscription.

func (*Client) DeleteAllMonitoringResources

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

DeleteAllMonitoringResources deletes all resources related to monitoring from k8s cluster.

func (*Client) DeleteBackupStorage added in v0.8.0

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

DeleteBackupStorage deletes the backupStorage.

func (*Client) DeleteClusterServiceVersion added in v0.8.0

func (c *Client) DeleteClusterServiceVersion(
	ctx context.Context,
	key types.NamespacedName,
) error

DeleteClusterServiceVersion deletes a CSV by namespaced name.

func (*Client) DeleteFile

func (c *Client) DeleteFile(fileBytes []byte) error

DeleteFile accepts manifest file contents parses into []runtime.Object and deletes them from the cluster.

func (*Client) DeleteManifestFile added in v0.5.0

func (c *Client) DeleteManifestFile(fileBytes []byte, namespace string) error

DeleteManifestFile accepts manifest file contents, parses into []runtime.Object and deletes them from the cluster.

func (*Client) DeleteMonitoringConfig added in v0.8.0

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

DeleteMonitoringConfig deletes the monitoringConfig.

func (*Client) DeleteNamespace added in v0.8.0

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

DeleteNamespace deletes a namespace.

func (*Client) DeleteObject

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

DeleteObject deletes object from the k8s cluster.

func (*Client) DeletePod added in v0.4.0

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

DeletePod deletes a pod by given name in the given namespace.

func (Client) DoCSVWait

func (c Client) DoCSVWait(ctx context.Context, key types.NamespacedName) error

DoCSVWait waits until for a CSV to be applied.

func (*Client) DoPackageWait

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

DoPackageWait for the package to be available in OLM.

func (Client) DoRolloutWait

func (c Client) DoRolloutWait(ctx context.Context, key types.NamespacedName) error

DoRolloutWait waits until a deployment has been rolled out susccessfully or there is an error.

func (*Client) GenerateKubeConfigWithToken

func (c *Client) GenerateKubeConfigWithToken(user string, secret *corev1.Secret) ([]byte, error)

GenerateKubeConfigWithToken generates kubeconfig with a user and token provided as a secret.

func (*Client) GetBackupStorage added in v0.8.0

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

GetBackupStorage returns the backupStorage.

func (*Client) GetClusterRoleBinding added in v0.8.0

func (c *Client) GetClusterRoleBinding(ctx context.Context, name string) (*rbacv1.ClusterRoleBinding, error)

GetClusterRoleBinding returns cluster role binding by given name.

func (*Client) GetClusterServiceVersion

func (c *Client) GetClusterServiceVersion(
	ctx context.Context,
	key types.NamespacedName,
) (*v1alpha1.ClusterServiceVersion, error)

GetClusterServiceVersion retrieve a CSV by namespaced name.

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.8.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.8.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.8.0

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

GetDatabaseEngine returns database clusters by provided name.

func (*Client) GetDeployment

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

GetDeployment returns deployment by name.

func (*Client) GetEvents

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

GetEvents retrieves events from a pod by a name.

func (*Client) GetInstallPlan

func (c *Client) GetInstallPlan(ctx context.Context, namespace string, name string) (*v1alpha1.InstallPlan, error)

GetInstallPlan retrieves an OLM install plan by namespace and name.

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, pod, container string) (string, error)

GetLogs returns logs for pod.

func (*Client) GetMonitoringConfig added in v0.8.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) GetOperatorGroup

func (c *Client) GetOperatorGroup(ctx context.Context, namespace, name string) (*v1.OperatorGroup, error)

GetOperatorGroup retrieves an operator group details by namespace and name.

func (*Client) GetPackageManifest

func (c *Client) GetPackageManifest(ctx context.Context, namespace, name string) (*packagev1.PackageManifest, error)

GetPackageManifest returns a package manifest by given 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, name, namespace string) (*corev1.Secret, error)

GetSecret returns secret by name.

func (*Client) GetSecretsForServiceAccount

func (c *Client) GetSecretsForServiceAccount(ctx context.Context, accountName string) (*corev1.Secret, error)

GetSecretsForServiceAccount returns secret by given service account name.

func (*Client) GetServerVersion

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

GetServerVersion returns server version.

func (*Client) GetService added in v0.5.0

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

GetService returns k8s service by provided namespace and name.

func (*Client) GetStorageClasses

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

GetStorageClasses returns all storage classes available in the cluster.

func (*Client) GetSubscription

func (c *Client) GetSubscription(ctx context.Context, namespace, name string) (*v1alpha1.Subscription, error)

GetSubscription retrieves an OLM subscription by namespace and name.

func (Client) GetSubscriptionCSV

func (c Client) GetSubscriptionCSV(ctx context.Context, subKey types.NamespacedName) (types.NamespacedName, error)

GetSubscriptionCSV retrieves a subscription CSV.

func (*Client) ListBackupStorages added in v0.8.0

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

ListBackupStorages returns the backupStorage.

func (*Client) ListCRDs

func (c *Client) ListCRDs(
	ctx context.Context,
	labelSelector *metav1.LabelSelector,
) (*apiextv1.CustomResourceDefinitionList, error)

ListCRDs returns a list of CRDs.

func (*Client) ListCRs

func (c *Client) ListCRs(
	ctx context.Context,
	namespace string,
	gvr schema.GroupVersionResource,
	labelSelector *metav1.LabelSelector,
) (*unstructured.UnstructuredList, error)

ListCRs returns a list of CRs.

func (*Client) ListClusterServiceVersion

func (c *Client) ListClusterServiceVersion(
	ctx context.Context,
	namespace string,
) (*v1alpha1.ClusterServiceVersionList, error)

ListClusterServiceVersion list all CSVs for the given namespace.

func (*Client) ListDatabaseClusterBackups added in v0.8.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.8.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.8.0

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

ListDatabaseEngines returns list of managed database clusters.

func (*Client) ListDeployments added in v0.4.0

func (c *Client) ListDeployments(ctx context.Context, namespace string) (*appsv1.DeploymentList, error)

ListDeployments returns deployment by name.

func (*Client) ListMonitoringConfigs added in v0.8.0

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

ListMonitoringConfigs returns the monitoringConfig.

func (*Client) ListPods added in v0.4.0

func (c *Client) ListPods(ctx context.Context, namespace string, options metav1.ListOptions) (*corev1.PodList, error)

ListPods lists pods.

func (*Client) ListSecrets

func (c *Client) ListSecrets(ctx context.Context) (*corev1.SecretList, error)

ListSecrets returns secrets.

func (*Client) ListSubscriptions

func (c *Client) ListSubscriptions(ctx context.Context, namespace string) (*v1alpha1.SubscriptionList, error)

ListSubscriptions all the subscriptions in the namespace.

func (*Client) UpdateBackupStorage added in v0.8.0

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

UpdateBackupStorage updates an backupStorage.

func (*Client) UpdateInstallPlan

func (c *Client) UpdateInstallPlan(
	ctx context.Context,
	namespace string,
	installPlan *v1alpha1.InstallPlan,
) (*v1alpha1.InstallPlan, error)

UpdateInstallPlan updates the existing install plan in the specified namespace.

func (*Client) UpdateMonitoringConfig added in v0.8.0

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

UpdateMonitoringConfig updates an monitoringConfig.

func (*Client) UpdateSubscription added in v0.8.0

func (c *Client) UpdateSubscription(ctx context.Context, namespace string, subscription *v1alpha1.Subscription) (*v1alpha1.Subscription, error)

UpdateSubscription updates an OLM subscription.

type Cluster

type Cluster struct {
	CertificateAuthorityData []byte `json:"certificate-authority-data"` //nolint:tagliatelle
	Server                   string `json:"server"`
}

Cluster contains information about how to communicate with a kubernetes cluster.

type ClusterInfo

type ClusterInfo struct {
	Name    string  `json:"name"`
	Cluster Cluster `json:"cluster"`
}

ClusterInfo is a struct used to parse Cluster config from kubeconfig.

type Config

type Config struct {
	// Legacy field from pkg/api/types.go TypeMeta.
	Kind string `json:"kind,omitempty"`
	// Legacy field from pkg/api/types.go TypeMeta.
	APIVersion string `json:"apiVersion,omitempty"`
	// Preferences holds general information to be use for cli interactions
	Clusters []ClusterInfo `json:"clusters"`
	// AuthInfos is a map of referencable names to user configs
	Users []UserInfo `json:"users"`
	// Contexts is a map of referencable names to context configs
	Contexts []ContextInfo `json:"contexts"`
	// CurrentContext is the name of the context that you would like to use by default
	CurrentContext string `json:"current-context"` //nolint:tagliatelle
}

Config holds the information needed to build connect to remote kubernetes clusters as a given user.

type Context

type Context struct {
	Cluster   string `json:"cluster"`
	User      string `json:"user"`
	Namespace string `json:"namespace"`
}

Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with).

type ContextInfo

type ContextInfo struct {
	Name    string  `json:"name"`
	Context Context `json:"context"`
}

ContextInfo is a struct used to parse Context config from kubeconfig.

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, namespace, name string) (*everestv1alpha1.BackupStorage, error)
	// ListBackupStorages returns the backupStorage.
	ListBackupStorages(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.BackupStorageList, error)
	// DeleteBackupStorage deletes the backupStorage.
	DeleteBackupStorage(ctx context.Context, namespace, name string) error
	// ClusterName returns the name of the k8s cluster.
	ClusterName() string
	// GetSecretsForServiceAccount returns secret by given service account name.
	GetSecretsForServiceAccount(ctx context.Context, accountName string) (*corev1.Secret, error)
	// GenerateKubeConfigWithToken generates kubeconfig with a user and token provided as a secret.
	GenerateKubeConfigWithToken(user string, secret *corev1.Secret) ([]byte, error)
	// GetServerVersion returns server version.
	GetServerVersion() (*version.Info, error)
	// GetStorageClasses returns all storage classes available in the cluster.
	GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error)
	// GetDeployment returns deployment by name.
	GetDeployment(ctx context.Context, name string, namespace string) (*appsv1.Deployment, error)
	// ListDeployments returns deployment by name.
	ListDeployments(ctx context.Context, namespace string) (*appsv1.DeploymentList, error)
	// GetSecret returns secret by name.
	GetSecret(ctx context.Context, name, namespace string) (*corev1.Secret, error)
	// ListSecrets returns secrets.
	ListSecrets(ctx context.Context) (*corev1.SecretList, error)
	// DeleteObject deletes object from the k8s cluster.
	DeleteObject(obj runtime.Object) error
	// ApplyObject applies object.
	ApplyObject(obj runtime.Object) error
	// Config returns stored *rest.Config.
	Config() *rest.Config
	// GetPersistentVolumes returns Persistent Volumes available in the cluster.
	GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error)
	// GetPods returns list of pods.
	GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error)
	// ListPods lists pods.
	ListPods(ctx context.Context, namespace string, options metav1.ListOptions) (*corev1.PodList, error)
	// DeletePod deletes a pod by given name in the given namespace.
	DeletePod(ctx context.Context, namespace, name string) error
	// GetNodes returns list of nodes.
	GetNodes(ctx context.Context) (*corev1.NodeList, error)
	// GetLogs returns logs for pod.
	GetLogs(ctx context.Context, pod, container string) (string, error)
	// GetEvents retrieves events from a pod by a name.
	GetEvents(ctx context.Context, name string) (string, error)
	// ApplyFile accepts manifest file contents, parses into []runtime.Object
	// and applies them against the cluster.
	ApplyFile(fileBytes []byte) error
	// ApplyManifestFile accepts manifest file contents, parses into []runtime.Object
	// and applies them against the cluster.
	ApplyManifestFile(fileBytes []byte, namespace string) error
	// DeleteManifestFile accepts manifest file contents, parses into []runtime.Object
	// and deletes them from the cluster.
	DeleteManifestFile(fileBytes []byte, namespace string) error
	// DoCSVWait waits until for a CSV to be applied.
	DoCSVWait(ctx context.Context, key types.NamespacedName) error
	// GetSubscriptionCSV retrieves a subscription CSV.
	GetSubscriptionCSV(ctx context.Context, subKey types.NamespacedName) (types.NamespacedName, error)
	// DoRolloutWait waits until a deployment has been rolled out susccessfully or there is an error.
	DoRolloutWait(ctx context.Context, key types.NamespacedName) error
	// CreateNamespace creates a new namespace.
	CreateNamespace(name string) error
	// GetOperatorGroup retrieves an operator group details by namespace and name.
	GetOperatorGroup(ctx context.Context, namespace, name string) (*v1.OperatorGroup, error)
	// CreateOperatorGroup creates an operator group to be used as part of a subscription.
	CreateOperatorGroup(ctx context.Context, namespace, name string, targetNamespaces []string) (*v1.OperatorGroup, error)
	// CreateSubscription creates an OLM subscription.
	CreateSubscription(ctx context.Context, namespace string, subscription *v1alpha1.Subscription) (*v1alpha1.Subscription, error)
	// UpdateSubscription updates an OLM subscription.
	UpdateSubscription(ctx context.Context, namespace string, subscription *v1alpha1.Subscription) (*v1alpha1.Subscription, error)
	// CreateSubscriptionForCatalog creates an OLM subscription.
	CreateSubscriptionForCatalog(ctx context.Context, namespace, name, catalogNamespace, catalog, packageName, channel, startingCSV string, approval v1alpha1.Approval) (*v1alpha1.Subscription, error)
	// GetSubscription retrieves an OLM subscription by namespace and name.
	GetSubscription(ctx context.Context, namespace, name string) (*v1alpha1.Subscription, error)
	// ListSubscriptions all the subscriptions in the namespace.
	ListSubscriptions(ctx context.Context, namespace string) (*v1alpha1.SubscriptionList, error)
	// GetInstallPlan retrieves an OLM install plan by namespace and name.
	GetInstallPlan(ctx context.Context, namespace string, name string) (*v1alpha1.InstallPlan, error)
	// DoPackageWait for the package to be available in OLM.
	DoPackageWait(ctx context.Context, namespace, name string) error
	// GetPackageManifest returns a package manifest by given name.
	GetPackageManifest(ctx context.Context, namespace, name string) (*packagev1.PackageManifest, error)
	// UpdateInstallPlan updates the existing install plan in the specified namespace.
	UpdateInstallPlan(ctx context.Context, namespace string, installPlan *v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error)
	// ListCRDs returns a list of CRDs.
	ListCRDs(ctx context.Context, labelSelector *metav1.LabelSelector) (*apiextv1.CustomResourceDefinitionList, error)
	// ListCRs returns a list of CRs.
	ListCRs(ctx context.Context, namespace string, gvr schema.GroupVersionResource, labelSelector *metav1.LabelSelector) (*unstructured.UnstructuredList, error)
	// GetClusterServiceVersion retrieve a CSV by namespaced name.
	GetClusterServiceVersion(ctx context.Context, key types.NamespacedName) (*v1alpha1.ClusterServiceVersion, error)
	// ListClusterServiceVersion list all CSVs for the given namespace.
	ListClusterServiceVersion(ctx context.Context, namespace string) (*v1alpha1.ClusterServiceVersionList, error)
	// DeleteClusterServiceVersion deletes a CSV by namespaced name.
	DeleteClusterServiceVersion(ctx context.Context, key types.NamespacedName) error
	// DeleteFile accepts manifest file contents parses into []runtime.Object
	// and deletes them from the cluster.
	DeleteFile(fileBytes []byte) error
	// GetService returns k8s service by provided namespace and name.
	GetService(ctx context.Context, namespace, name string) (*corev1.Service, error)
	// GetClusterRoleBinding returns cluster role binding by given name.
	GetClusterRoleBinding(ctx context.Context, name string) (*rbacv1.ClusterRoleBinding, 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)
	// DeleteAllMonitoringResources deletes all resources related to monitoring from k8s cluster.
	DeleteAllMonitoringResources(ctx context.Context, namespace string) 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)
	// DeleteNamespace deletes a namespace.
	DeleteNamespace(ctx context.Context, name string) error
}

KubeClientConnector ...

type MockKubeClientConnector

type MockKubeClientConnector struct {
	mock.Mock
}

MockKubeClientConnector is an autogenerated mock type for the KubeClientConnector type

func NewMockKubeClientConnector

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) ApplyFile

func (_m *MockKubeClientConnector) ApplyFile(fileBytes []byte) error

ApplyFile provides a mock function with given fields: fileBytes

func (*MockKubeClientConnector) ApplyManifestFile added in v0.5.0

func (_m *MockKubeClientConnector) ApplyManifestFile(fileBytes []byte, namespace string) error

ApplyManifestFile provides a mock function with given fields: fileBytes, namespace

func (*MockKubeClientConnector) ApplyObject

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.8.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.8.0

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

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

func (*MockKubeClientConnector) CreateNamespace

func (_m *MockKubeClientConnector) CreateNamespace(name string) error

CreateNamespace provides a mock function with given fields: name

func (*MockKubeClientConnector) CreateOperatorGroup

func (_m *MockKubeClientConnector) CreateOperatorGroup(ctx context.Context, namespace string, name string, targetNamespaces []string) (*v1.OperatorGroup, error)

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

func (*MockKubeClientConnector) CreateSubscription added in v0.8.0

func (_m *MockKubeClientConnector) CreateSubscription(ctx context.Context, namespace string, subscription *operatorsv1alpha1.Subscription) (*operatorsv1alpha1.Subscription, error)

CreateSubscription provides a mock function with given fields: ctx, namespace, subscription

func (*MockKubeClientConnector) CreateSubscriptionForCatalog

func (_m *MockKubeClientConnector) CreateSubscriptionForCatalog(ctx context.Context, namespace string, name string, catalogNamespace string, catalog string, packageName string, channel string, startingCSV string, approval operatorsv1alpha1.Approval) (*operatorsv1alpha1.Subscription, error)

CreateSubscriptionForCatalog provides a mock function with given fields: ctx, namespace, name, catalogNamespace, catalog, packageName, channel, startingCSV, approval

func (*MockKubeClientConnector) DeleteAllMonitoringResources

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

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

func (*MockKubeClientConnector) DeleteBackupStorage added in v0.8.0

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

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

func (*MockKubeClientConnector) DeleteClusterServiceVersion added in v0.8.0

func (_m *MockKubeClientConnector) DeleteClusterServiceVersion(ctx context.Context, key types.NamespacedName) error

DeleteClusterServiceVersion provides a mock function with given fields: ctx, key

func (*MockKubeClientConnector) DeleteFile

func (_m *MockKubeClientConnector) DeleteFile(fileBytes []byte) error

DeleteFile provides a mock function with given fields: fileBytes

func (*MockKubeClientConnector) DeleteManifestFile added in v0.5.0

func (_m *MockKubeClientConnector) DeleteManifestFile(fileBytes []byte, namespace string) error

DeleteManifestFile provides a mock function with given fields: fileBytes, namespace

func (*MockKubeClientConnector) DeleteMonitoringConfig added in v0.8.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) DeleteNamespace added in v0.8.0

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

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

func (*MockKubeClientConnector) DeleteObject

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

DeleteObject provides a mock function with given fields: obj

func (*MockKubeClientConnector) DeletePod added in v0.4.0

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

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

func (*MockKubeClientConnector) DoCSVWait

DoCSVWait provides a mock function with given fields: ctx, key

func (*MockKubeClientConnector) DoPackageWait

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

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

func (*MockKubeClientConnector) DoRolloutWait

func (_m *MockKubeClientConnector) DoRolloutWait(ctx context.Context, key types.NamespacedName) error

DoRolloutWait provides a mock function with given fields: ctx, key

func (*MockKubeClientConnector) GenerateKubeConfigWithToken

func (_m *MockKubeClientConnector) GenerateKubeConfigWithToken(user string, secret *corev1.Secret) ([]byte, error)

GenerateKubeConfigWithToken provides a mock function with given fields: user, secret

func (*MockKubeClientConnector) GetBackupStorage added in v0.8.0

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

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

func (*MockKubeClientConnector) GetClusterRoleBinding added in v0.8.0

func (_m *MockKubeClientConnector) GetClusterRoleBinding(ctx context.Context, name string) (*rbacv1.ClusterRoleBinding, error)

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

func (*MockKubeClientConnector) GetClusterServiceVersion

GetClusterServiceVersion provides a mock function with given fields: ctx, key

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.8.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.8.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.8.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

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) GetEvents

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

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

func (*MockKubeClientConnector) GetInstallPlan

func (_m *MockKubeClientConnector) GetInstallPlan(ctx context.Context, namespace string, name string) (*operatorsv1alpha1.InstallPlan, error)

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

func (*MockKubeClientConnector) GetLogs

func (_m *MockKubeClientConnector) GetLogs(ctx context.Context, pod string, container string) (string, error)

GetLogs provides a mock function with given fields: ctx, pod, container

func (*MockKubeClientConnector) GetMonitoringConfig added in v0.8.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) (*corev1.Namespace, error)

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

func (*MockKubeClientConnector) GetNodes

GetNodes provides a mock function with given fields: ctx

func (*MockKubeClientConnector) GetOperatorGroup

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

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

func (*MockKubeClientConnector) GetPackageManifest

func (_m *MockKubeClientConnector) GetPackageManifest(ctx context.Context, namespace string, name string) (*operatorsv1.PackageManifest, error)

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

func (*MockKubeClientConnector) GetPersistentVolumes

func (_m *MockKubeClientConnector) GetPersistentVolumes(ctx context.Context) (*corev1.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) (*corev1.PodList, error)

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

func (*MockKubeClientConnector) GetSecret

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

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

func (*MockKubeClientConnector) GetSecretsForServiceAccount

func (_m *MockKubeClientConnector) GetSecretsForServiceAccount(ctx context.Context, accountName string) (*corev1.Secret, error)

GetSecretsForServiceAccount provides a mock function with given fields: ctx, accountName

func (*MockKubeClientConnector) GetServerVersion

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

GetServerVersion provides a mock function with given fields:

func (*MockKubeClientConnector) GetService added in v0.5.0

func (_m *MockKubeClientConnector) GetService(ctx context.Context, namespace string, name string) (*corev1.Service, error)

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

func (*MockKubeClientConnector) GetStorageClasses

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

GetStorageClasses provides a mock function with given fields: ctx

func (*MockKubeClientConnector) GetSubscription

func (_m *MockKubeClientConnector) GetSubscription(ctx context.Context, namespace string, name string) (*operatorsv1alpha1.Subscription, error)

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

func (*MockKubeClientConnector) GetSubscriptionCSV

func (_m *MockKubeClientConnector) GetSubscriptionCSV(ctx context.Context, subKey types.NamespacedName) (types.NamespacedName, error)

GetSubscriptionCSV provides a mock function with given fields: ctx, subKey

func (*MockKubeClientConnector) ListBackupStorages added in v0.8.0

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

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

func (*MockKubeClientConnector) ListCRDs

ListCRDs provides a mock function with given fields: ctx, labelSelector

func (*MockKubeClientConnector) ListCRs

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

func (*MockKubeClientConnector) ListClusterServiceVersion

func (_m *MockKubeClientConnector) ListClusterServiceVersion(ctx context.Context, namespace string) (*operatorsv1alpha1.ClusterServiceVersionList, error)

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

func (*MockKubeClientConnector) ListDatabaseClusterBackups added in v0.8.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.8.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.8.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) ListDeployments added in v0.4.0

func (_m *MockKubeClientConnector) ListDeployments(ctx context.Context, namespace string) (*appsv1.DeploymentList, error)

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

func (*MockKubeClientConnector) ListMonitoringConfigs added in v0.8.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) ListPods added in v0.4.0

func (_m *MockKubeClientConnector) ListPods(ctx context.Context, namespace string, options metav1.ListOptions) (*corev1.PodList, error)

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

func (*MockKubeClientConnector) ListSecrets

func (_m *MockKubeClientConnector) ListSecrets(ctx context.Context) (*corev1.SecretList, error)

ListSecrets provides a mock function with given fields: ctx

func (*MockKubeClientConnector) ListSubscriptions

func (_m *MockKubeClientConnector) ListSubscriptions(ctx context.Context, namespace string) (*operatorsv1alpha1.SubscriptionList, error)

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

func (*MockKubeClientConnector) UpdateBackupStorage added in v0.8.0

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

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

func (*MockKubeClientConnector) UpdateInstallPlan

func (_m *MockKubeClientConnector) UpdateInstallPlan(ctx context.Context, namespace string, installPlan *operatorsv1alpha1.InstallPlan) (*operatorsv1alpha1.InstallPlan, error)

UpdateInstallPlan provides a mock function with given fields: ctx, namespace, installPlan

func (*MockKubeClientConnector) UpdateMonitoringConfig added in v0.8.0

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

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

func (*MockKubeClientConnector) UpdateSubscription added in v0.8.0

func (_m *MockKubeClientConnector) UpdateSubscription(ctx context.Context, namespace string, subscription *operatorsv1alpha1.Subscription) (*operatorsv1alpha1.Subscription, error)

UpdateSubscription provides a mock function with given fields: ctx, namespace, subscription

type PrefixWriter

type PrefixWriter interface {
	// Writef writes text with the specified indentation level.
	Writef(level int, format string, a ...interface{})
	// WriteLine writes an entire line with no indentation level.
	WriteLine(a ...interface{})
	// Flush forces indentation to be reset.
	Flush()
}

PrefixWriter can write text at various indentation levels.

func NewPrefixWriter

func NewPrefixWriter(out io.Writer) PrefixWriter

NewPrefixWriter creates a new PrefixWriter.

type SortableEvents

type SortableEvents []corev1.Event

SortableEvents implements sort.Interface for []api.Event based on the Timestamp field.

func (SortableEvents) Len

func (list SortableEvents) Len() int

func (SortableEvents) Less

func (list SortableEvents) Less(i, j int) bool

func (SortableEvents) Swap

func (list SortableEvents) Swap(i, j int)

type User

type User struct {
	Token string `json:"token"`
}

User contains information that describes identity information. This is use to tell the kubernetes cluster who you are.

type UserInfo

type UserInfo struct {
	Name string `json:"name"`
	User User   `json:"user"`
}

UserInfo is a struct used to parse User config from kubeconfig.

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.
Package database TODO
Package database TODO

Jump to

Keyboard shortcuts

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