utils

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LocalProviderDefaultMountPath is the default path where the buckets directory is mounted.
	LocalProviderDefaultMountPath = "/etc/gardener/local-backupbuckets"
	// EtcdBackupSecretHostPath is the hostPath field in the etcd-backup secret.
	EtcdBackupSecretHostPath = "hostPath"
)
View Source
const (
	// S3 is a constant for the AWS and S3 compliant storage provider.
	S3 = "S3"
	// ABS is a constant for the Azure storage provider.
	ABS = "ABS"
	// GCS is a constant for the Google storage provider.
	GCS = "GCS"
	// OSS is a constant for the Alicloud storage provider.
	OSS = "OSS"
	// Swift is a constant for the OpenStack storage provider.
	Swift = "Swift"
	// Local is a constant for the Local storage provider.
	Local = "Local"
	// ECS is a constant for the EMC storage provider.
	ECS = "ECS"
	// OCS is a constant for the OpenShift storage provider.
	OCS = "OCS"
)
View Source
const PurposeMemberLease = "etcd-member-lease"

PurposeMemberLease is a constant used as a purpose for etcd member lease objects.

Variables

This section is empty.

Functions

func CheckVersionMeetsConstraint added in v0.14.0

func CheckVersionMeetsConstraint(version, constraint string) (bool, error)

CheckVersionMeetsConstraint returns true if the <version> meets the <constraint>.

func CompareVersions added in v0.14.0

func CompareVersions(version1, operator, version2 string) (bool, error)

CompareVersions returns true if the constraint <version1> compared by <operator> to <version2> returns true, and false otherwise. The comparison is based on semantic versions, i.e. <version1> and <version2> will be converted if needed.

func GetClusterK8sVersion added in v0.14.0

func GetClusterK8sVersion(config *rest.Config) (*semver.Version, error)

GetClusterK8sVersion returns the semver version of the cluster k8s version

func GetEtcdBackupRestoreImage added in v0.17.0

func GetEtcdBackupRestoreImage(iv imagevector.ImageVector) (*string, error)

GetEtcdBackupRestoreImage returns the image for backup-restore from the given image vector.

func GetEtcdImages added in v0.17.0

func GetEtcdImages(etcd *druidv1alpha1.Etcd, iv imagevector.ImageVector) (*string, *string, error)

GetEtcdImages returns images for etcd and backup-restore by inspecting the etcd spec and the image vector. It will give preference to images that are set in the etcd spec and only if the image is not found in it should it be picked up from the image vector if it's set there. A return value of nil for either of the images indicates that the image is not set.

func GetHostMountPathFromSecretRef added in v0.13.0

func GetHostMountPathFromSecretRef(ctx context.Context, client client.Client, logger logr.Logger, store *druidv1alpha1.StoreSpec, namespace string) (string, error)

GetHostMountPathFromSecretRef returns the hostPath configured for the given store.

func GetMemberLeaseLabels added in v0.18.1

func GetMemberLeaseLabels(etcdName string) map[string]string

GetMemberLeaseLabels creates a map of default labels for member lease.

func GetStatefulSet added in v0.17.0

func GetStatefulSet(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd) (*appsv1.StatefulSet, error)

GetStatefulSet fetches StatefulSet created for the etcd.

func IsPeerURLTLSEnabled added in v0.18.1

func IsPeerURLTLSEnabled(ctx context.Context, cli client.Client, namespace, etcdName string, logger logr.Logger) (bool, error)

IsPeerURLTLSEnabled checks if the TLS has been enabled for all existing members of an etcd cluster identified by etcdName and in the provided namespace.

func IsStatefulSetReady added in v0.17.0

func IsStatefulSetReady(etcdReplicas int32, statefulSet *appsv1.StatefulSet) (bool, string)

IsStatefulSetReady checks whether the given StatefulSet is ready and up-to-date. A StatefulSet is considered healthy if its controller observed its current revision, it is not in an update (i.e. UpdateRevision is empty) and if its current replicas are equal to desired replicas specified in ETCD specs. It returns ready status (bool) and in case it is not ready then the second return value holds the reason.

func Key

func Key(namespaceOrName string, nameOpt ...string) client.ObjectKey

Key creates a new client.ObjectKey from the given parameters. There are only two ways to call this function:

  • If only namespaceOrName is set, then a client.ObjectKey with name set to namespaceOrName is returned.
  • If namespaceOrName and one nameOpt is given, then a client.ObjectKey with namespace set to namespaceOrName and name set to nameOpt[0] is returned.

For all other cases, this method panics.

func Max added in v0.6.0

func Max(x, y int) int

Max returns the larger of x or y.

func MergeStringMaps

func MergeStringMaps(oldMap map[string]string, newMaps ...map[string]string) map[string]string

MergeStringMaps merges the content of the newMaps with the oldMap. If a key already exists then it gets overwritten by the last value with the same key.

func StorageProviderFromInfraProvider

func StorageProviderFromInfraProvider(infra *druidv1alpha1.StorageProvider) (string, error)

StorageProviderFromInfraProvider converts infra to object store provider.

Types

This section is empty.

Jump to

Keyboard shortcuts

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