k8s

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: UPL-1.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

NewPodExecutor is to be overridden during unit tests

Functions

This section is empty.

Types

type K8s

type K8s interface {
	PopulateConnData(veleroNamespace, backupName string) (*model.ConnectionData, error)
	GetObjectStoreCreds(secretName, namespace, secretKey string) (*model.ObjectStoreSecret, error)
	GetBackup(veleroNamespace, backupName string) (*model.VeleroBackup, error)
	GetBackupStorageLocation(veleroNamespace, bslName string) (*model.VeleroBackupStorageLocation, error)
	ScaleDeployment(labelSelector, namespace, deploymentName string, replicaCount int32, log *zap.SugaredLogger) error
	CheckDeployment(labelSelector, namespace string) (bool, error)
	CheckPodStatus(podName, namespace, checkFlag string, timeout string, wg *sync.WaitGroup) error
	CheckAllPodsAfterRestore() error
	IsPodReady(pod *v1.Pod) (bool, error)
	ExecPod(cfg *rest.Config, pod *v1.Pod, container string, command []string) (string, string, error)
	UpdateKeystore(connData *model.ConnectionData, timeout string) (bool, error)
	ExecRetry(pod *v1.Pod, container, timeout string, execCmd []string) error
}

type K8sImpl

type K8sImpl struct {
	DynamicK8sInterface dynamic.Interface
	K8sClient           client.Client
	K8sInterface        kubernetes.Interface
	K8sConfig           *rest.Config
	CredentialProfile   string //default value `default`
	Log                 *zap.SugaredLogger
}

func New

func New(dclient dynamic.Interface, kclient client.Client, kclientInterface kubernetes.Interface, cfg *rest.Config, credentialProfile string, log *zap.SugaredLogger) *K8sImpl

func (*K8sImpl) CheckAllPodsAfterRestore

func (k *K8sImpl) CheckAllPodsAfterRestore() error

CheckAllPodsAfterRestore checks presence of pods part of Opensearch cluster implementation after restore

func (*K8sImpl) CheckDeployment

func (k *K8sImpl) CheckDeployment(labelSelector, namespace string) (bool, error)

CheckDeployment checks the existence of a deployment in anamespace

func (*K8sImpl) CheckPodStatus

func (k *K8sImpl) CheckPodStatus(podName, namespace, checkFlag string, timeout string, wg *sync.WaitGroup) error

CheckPodStatus checks the state of the pod depending on checkFlag

func (*K8sImpl) ExecPod

func (k *K8sImpl) ExecPod(pod *v1.Pod, container string, command []string) (string, string, error)

ExecPod runs a remote command a pod, returning the stdout and stderr of the command.

func (*K8sImpl) ExecRetry added in v0.0.30

func (k *K8sImpl) ExecRetry(pod *v1.Pod, container, timeout string, execCmd []string) error

func (*K8sImpl) GetBackup

func (k *K8sImpl) GetBackup(veleroNamespace, backupName string) (*model.VeleroBackup, error)

GetBackup Retrieves Velero backup object from the cluster

func (*K8sImpl) GetBackupStorageLocation

func (k *K8sImpl) GetBackupStorageLocation(veleroNamespace, bslName string) (*model.VeleroBackupStorageLocation, error)

GetBackupStorageLocation retrieves data from the Velero backup storage location

func (*K8sImpl) GetObjectStoreCreds

func (k *K8sImpl) GetObjectStoreCreds(secretName, namespace, secretKey string) (*model.ObjectStoreSecret, error)

GetObjectStoreCreds fetches credentials from Velero Backup object store location. This object will be pre-created before the execution of this hook

func (*K8sImpl) IsPodReady

func (k *K8sImpl) IsPodReady(pod *v1.Pod) (bool, error)

IsPodReady checks whether pod is Ready

func (*K8sImpl) PopulateConnData

func (k *K8sImpl) PopulateConnData(veleroNamespace, backupName string) (*model.ConnectionData, error)

PopulateConnData creates the connection object that's used to communicate to object store.

func (*K8sImpl) ScaleDeployment

func (k *K8sImpl) ScaleDeployment(labelSelector, namespace, deploymentName string, replicaCount int32) error

ScaleDeployment is used to scale a deployment to specific replica count labelSelectors, namespace, deploymentName are used to identify deployments and specific pods associated with them.

func (*K8sImpl) UpdateKeystore

func (k *K8sImpl) UpdateKeystore(connData *model.ConnectionData, timeout string) (bool, error)

UpdateKeystore Update Opensearch keystore with object store creds

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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