utils

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0, MIT Imports: 9 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"
	// OSC is a constant for the OpenShift storage provider.
	OCS = "OCS"
)

Variables

This section is empty.

Functions

func CheckStatefulSet added in v0.12.0

func CheckStatefulSet(etcdReplicas int32, statefulSet *appsv1.StatefulSet) error

CheckStatefulSet checks whether the given StatefulSet is healthy. 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.

func GetClientServiceName added in v0.9.0

func GetClientServiceName(etcd *druidv1alpha1.Etcd) string

GetClientServiceName returns the client service name of ETCD cluster reachable by external client

func GetConfigmapName added in v0.9.0

func GetConfigmapName(etcd *druidv1alpha1.Etcd) string

GetConfigmapName returns the name of the configmap based on the given `etcd` object.

func GetCronJobName added in v0.9.0

func GetCronJobName(etcd *druidv1alpha1.Etcd) string

GetCronJobName returns the legacy compaction cron job name

func GetDeltaSnapshotLeaseName added in v0.12.0

func GetDeltaSnapshotLeaseName(etcd *druidv1alpha1.Etcd) string

GetDeltaSnapshotLeaseName returns the name of the delta snapshot lease based on the given `etcd` object.

func GetFullSnapshotLeaseName added in v0.12.0

func GetFullSnapshotLeaseName(etcd *druidv1alpha1.Etcd) string

GetFullSnapshotLeaseName returns the name of the full snapshot lease based on the given `etcd` object.

func GetJobName added in v0.9.0

func GetJobName(etcd *druidv1alpha1.Etcd) string

GetJobName returns the compaction job name

func GetOrdinalPodName added in v0.9.0

func GetOrdinalPodName(etcd *druidv1alpha1.Etcd, order int) string

GetOrdinalPodName returns the ETCD pod name based on the order

func GetPeerServiceName added in v0.9.0

func GetPeerServiceName(etcd *druidv1alpha1.Etcd) string

GetPeerServiceName returns the peer service name of ETCD cluster reachable by members within the ETCD cluster

func GetServiceAccountName added in v0.9.0

func GetServiceAccountName(etcd *druidv1alpha1.Etcd) string

GetServiceAccountName returns the service account name

func GetStoreValues added in v0.7.0

func GetStoreValues(ctx context.Context, client client.Client, store *druidv1alpha1.StoreSpec, namespace string) (map[string]interface{}, error)

GetStoreValues converts the values in the StoreSpec to a map, or returns an error if the storage provider is unsupported.

func IsPodInCrashloopBackoff added in v0.1.4

func IsPodInCrashloopBackoff(status v1.PodStatus) bool

IsPodInCrashloopBackoff checks if the pod is in CrashloopBackoff from its status fields.

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 MergeMaps

func MergeMaps(a, b map[string]interface{}) map[string]interface{}

MergeMaps takes two maps <a>, <b> and merges them. If <b> defines a value with a key already existing in the <a> map, the <a> value for that key will be overwritten.

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.

func TimeElapsed

func TimeElapsed(timestamp *metav1.Time, duration time.Duration) bool

TimeElapsed takes a <timestamp> and a <duration> checks whether the elapsed time until now is less than the <duration>. If yes, it returns true, otherwise it returns false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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