utils

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddVeleroExcludeLabelToObjectMeta added in v1.1.0

func AddVeleroExcludeLabelToObjectMeta(objectMeta *metav1.ObjectMeta)

Adds the Velero label to exclude this K8S resource from the backup

func AppendVeleroExcludeLabels added in v1.1.0

func AppendVeleroExcludeLabels(origLabels map[string]string) map[string]string

func CompareVersion added in v1.2.0

func CompareVersion(currentVersion string, minVersion string) int

If currentVersion < minVersion, return -1 If currentVersion == minVersion, return 0 If currentVersion > minVersion, return 1 Assume input versions are both valid

func CreateKubeClientSet added in v1.2.0

func CreateKubeClientSet() (*kubernetes.Clientset, error)

func CreatePluginClientSet added in v1.2.0

func CreatePluginClientSet() (*plugin_clientset.Clientset, error)

func DeleteSvcSnapshot added in v1.1.0

func DeleteSvcSnapshot(svcSnapshotName string, gcSnapshotName string, gcSnapshotNamespace string, guestConfig *rest.Config, logger logrus.FieldLogger) error

Provide a utility function in guest cluster to clean up corresponding supervisor cluster snapshot CR

func GetBackupdriverClient added in v1.1.0

func GetBackupdriverClient(config *rest.Config) (v1alpha1.BackupdriverV1alpha1Interface, error)

func GetBool

func GetBool(str string, defValue bool) bool

func GetCSIClusterType added in v1.2.0

func GetCSIClusterType(kubeClient kubernetes.Interface) (constants.ClusterFlavor, error)

func GetCSIClusterTypeFromEnv added in v1.2.0

func GetCSIClusterTypeFromEnv(containers []k8sv1.Container) (constants.ClusterFlavor, error)

func GetCSIInstalledVersion added in v1.2.0

func GetCSIInstalledVersion(kubeClient kubernetes.Interface) (string, error)

func GetCSIVersionFromImage added in v1.2.0

func GetCSIVersionFromImage(containers []k8sv1.Container) (string, error)

func GetClusterFlavor added in v1.1.0

func GetClusterFlavor(config *rest.Config) (constants.ClusterFlavor, error)

func GetComponentFromImage added in v1.1.0

func GetComponentFromImage(image string, component string) string

func GetComponentsFromImage added in v1.1.0

func GetComponentsFromImage(image string) map[string]string

func GetDefaultS3PETM added in v1.1.0

func GetDefaultS3PETM(logger logrus.FieldLogger) (*s3repository.ProtectedEntityTypeManager, error)

func GetIVDPETMFromParamsMap

func GetIVDPETMFromParamsMap(params map[string]interface{}, logger logrus.FieldLogger) (*ivd.IVDProtectedEntityTypeManager, error)

func GetKubeClientConfig added in v1.2.0

func GetKubeClientConfig() (*rest.Config, error)

func GetS3PETMFromParamsMap

func GetS3PETMFromParamsMap(params map[string]interface{}, logger logrus.FieldLogger) (*s3repository.ProtectedEntityTypeManager, error)

func GetS3SessionOptionsFromParamsMap added in v1.1.1

func GetS3SessionOptionsFromParamsMap(params map[string]interface{}, logger logrus.FieldLogger) (session.Options, error)

func GetStringFromParamsMap

func GetStringFromParamsMap(params map[string]interface{}, key string, logger logrus.FieldLogger) (value string, ok bool)

func GetSupervisorConfig added in v1.1.0

func GetSupervisorConfig(guestConfig *rest.Config, logger logrus.FieldLogger) (*rest.Config, string, error)

* Get the configuration to access the Supervisor namespace from the GuestCluster. * This routine will be called only for guest cluster. * * The secret to access the Supervisor Cluster will be written in the backup driver * namespace. The steps to get the Supervisor cluster config are: * 1. Create the backup-driver namespace if it does not exist. This is a fixed namespace * where the para virt backup driver secret will be written. * 2. Wait for the para virt backup driver secret to be written. * 3. Get the supervisor cluster configuration from the cert and token in the secret. * TODO: Handle update of the para virt backup driver secret

func GetSupervisorParameters added in v1.1.0

func GetSupervisorParameters(config *rest.Config, ns string, logger logrus.FieldLogger) (map[string]string, error)

* Get Supervisor parameters present as annotations in the supervisor namespace for the guest. * We do not return all the annotations, but only annotations required but guest cluster plugin.

func GetVcConfigSecretFilterFunc added in v1.1.0

func GetVcConfigSecretFilterFunc(logger logrus.FieldLogger) func(obj interface{}) bool

func GetVersionFromImage added in v1.2.0

func GetVersionFromImage(containers []k8sv1.Container, imageName string) string

Return version in the format: vX.Y.Z

func IsFeatureEnabled added in v1.1.0

func IsFeatureEnabled(feature string, defValue bool, logger logrus.FieldLogger) bool

func ParseLines added in v1.0.2

func ParseLines(lines []string, params map[string]interface{}, logger logrus.FieldLogger)

func PatchUpload added in v1.1.0

func PatchUpload(req *datamover_api.Upload, mutate func(*datamover_api.Upload), uploadClient datamover_client.UploadInterface, logger logrus.FieldLogger) (*datamover_api.Upload, error)

func RetrieveBSLFromBackup added in v1.1.0

func RetrieveBSLFromBackup(ctx context.Context, backupName string, config *rest.Config, logger logrus.FieldLogger) (string, error)

func RetrieveParamsFromBSL added in v1.1.0

func RetrieveParamsFromBSL(repositoryParams map[string]string, bslName string, config *rest.Config,
	logger logrus.FieldLogger) error

func RetrievePodNodesByVolumeId

func RetrievePodNodesByVolumeId(volumeId string) (string, error)

func RetrieveVSLFromVeleroBSLs

func RetrieveVSLFromVeleroBSLs(params map[string]interface{}, bslName string, config *rest.Config, logger logrus.FieldLogger) error

* Retrieve the Volume Snapshot Location(VSL) as the remote storage location * for the data manager component in plugin from the Backup Storage Locations(BSLs) * of Velero. It will always pick up the first available one.

func RetrieveVcConfigSecret

func RetrieveVcConfigSecret(params map[string]interface{}, config *rest.Config, logger logrus.FieldLogger) error

* In the CSI setup, VC credential is stored as a secret * under the kube-system namespace.

func RetrieveVddkLogLevel added in v1.2.0

func RetrieveVddkLogLevel(params map[string]interface{}, logger logrus.FieldLogger) error

Types

type ClientConfigNotFoundError added in v1.2.0

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

func NewClientConfigNotFoundError added in v1.2.0

func NewClientConfigNotFoundError(errMsg string) ClientConfigNotFoundError

func (ClientConfigNotFoundError) Error added in v1.2.0

func (this ClientConfigNotFoundError) Error() string

type NotFoundError added in v1.0.1

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

func NewNotFoundError added in v1.0.1

func NewNotFoundError(errMsg string) NotFoundError

func (NotFoundError) Error added in v1.0.1

func (this NotFoundError) Error() string

Jump to

Keyboard shortcuts

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