Documentation
¶
Index ¶
- Constants
- func AddFinalizers(ctx context.Context, writer client.Writer, obj client.Object, ...) error
- func ContainsAllDesiredLabels(actual, desired map[string]string) bool
- func ContainsLabel(actual map[string]string, key, value string) bool
- func DoesLabelSelectorMatchLabels(labelSelector *metav1.LabelSelector, resourceLabels map[string]string) (bool, error)
- func FetchPVCWarningMessagesForStatefulSet(ctx context.Context, cl client.Client, sts *appsv1.StatefulSet) (string, error)
- func GetBackupStoreProvider(etcd *druidv1alpha1.Etcd) (*string, error)
- func GetEtcdContainerPeerTLSVolumeMounts(sts *appsv1.StatefulSet) []corev1.VolumeMount
- func GetStatefulSet(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd) (*appsv1.StatefulSet, error)
- func GetStatefulSetContainerTLSVolumeMounts(sts *appsv1.StatefulSet) map[string][]corev1.VolumeMount
- func HasPodReadyConditionTrue(pod *corev1.Pod) bool
- func IsPeerURLInSyncForAllMembers(ctx context.Context, cl client.Client, logger logr.Logger, ...) (bool, error)
- func IsStatefulSetReady(etcdReplicas int32, statefulSet *appsv1.StatefulSet) (bool, string)
- func ListAllMemberLeaseObjectMeta(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd) ([]metav1.PartialObjectMetadata, error)
- func MatchPodConditions(conditions []corev1.PodCondition, condType corev1.PodConditionType, ...) bool
- func MountPathLocalStore(etcd *druidv1alpha1.Etcd, provider *string) string
- func RemoveAllFinalizers(ctx context.Context, writer client.Writer, obj client.Object) error
- func RemoveFinalizers(ctx context.Context, writer client.Writer, obj client.Object, ...) error
Constants ¶
const LeaseAnnotationKeyPeerURLTLSEnabled = "member.etcd.gardener.cloud/tls-enabled"
LeaseAnnotationKeyPeerURLTLSEnabled is the annotation key present on the member lease. If its value is `true` then it indicates that the member is TLS enabled. If the annotation is not present or its value is `false` then it indicates that the member is not TLS enabled.
Variables ¶
This section is empty.
Functions ¶
func AddFinalizers ¶
func AddFinalizers(ctx context.Context, writer client.Writer, obj client.Object, finalizers ...string) error
AddFinalizers ensures that the given finalizer is present in the given object and optimistic locking. If it is not set, it adds it and issues a patch. Note that this is done with a regular merge-patch since strategic merge-patches do not work with custom resources, see https://github.com/kubernetes/kubernetes/issues/105146.
func ContainsAllDesiredLabels ¶
ContainsAllDesiredLabels checks if the actual map contains all the desired labels.
func ContainsLabel ¶
ContainsLabel checks if the actual map contains the specified key-value pair.
func DoesLabelSelectorMatchLabels ¶
func DoesLabelSelectorMatchLabels(labelSelector *metav1.LabelSelector, resourceLabels map[string]string) (bool, error)
DoesLabelSelectorMatchLabels checks if the given label selector matches the given labels.
func FetchPVCWarningMessagesForStatefulSet ¶
func FetchPVCWarningMessagesForStatefulSet(ctx context.Context, cl client.Client, sts *appsv1.StatefulSet) (string, error)
FetchPVCWarningMessagesForStatefulSet fetches warning messages for PVCs for a statefulset, if found concatenates the first 2 warning messages and returns them as string warning message. In case it fails to fetch events, it collects the errors and returns the combined error.
func GetBackupStoreProvider ¶ added in v0.31.0
func GetBackupStoreProvider(etcd *druidv1alpha1.Etcd) (*string, error)
GetBackupStoreProvider returns the provider name for the backup store. If the provider is not known, an error is returned.
func GetEtcdContainerPeerTLSVolumeMounts ¶
func GetEtcdContainerPeerTLSVolumeMounts(sts *appsv1.StatefulSet) []corev1.VolumeMount
GetEtcdContainerPeerTLSVolumeMounts returns the volume mounts for the etcd container that are related to peer TLS. It will look at both older names (present in version <= v0.22) and new names (present in version >= v0.23) to create the slice.
func GetStatefulSet ¶
func GetStatefulSet(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd) (*appsv1.StatefulSet, error)
GetStatefulSet fetches StatefulSet created for the etcd. Nil will be returned if one of these conditions are met: - StatefulSet is not found - StatefulSet is not controlled by the etcd
func GetStatefulSetContainerTLSVolumeMounts ¶
func GetStatefulSetContainerTLSVolumeMounts(sts *appsv1.StatefulSet) map[string][]corev1.VolumeMount
GetStatefulSetContainerTLSVolumeMounts returns a map of container name to TLS volume mounts for the given StatefulSet.
func HasPodReadyConditionTrue ¶
HasPodReadyConditionTrue checks if the pod has a Ready condition with status True.
func IsPeerURLInSyncForAllMembers ¶
func IsPeerURLInSyncForAllMembers(ctx context.Context, cl client.Client, logger logr.Logger, etcd *druidv1alpha1.Etcd, replicas int32) (bool, error)
IsPeerURLInSyncForAllMembers checks if the peer URL is in sync for all existing members of an etcd cluster identified by etcdName and in the provided namespace.
func IsStatefulSetReady ¶
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 ListAllMemberLeaseObjectMeta ¶
func ListAllMemberLeaseObjectMeta(ctx context.Context, cl client.Client, etcd *druidv1alpha1.Etcd) ([]metav1.PartialObjectMetadata, error)
ListAllMemberLeaseObjectMeta returns the list of all member leases for the given etcd cluster.
func MatchPodConditions ¶
func MatchPodConditions(conditions []corev1.PodCondition, condType corev1.PodConditionType, condStatus corev1.ConditionStatus) bool
MatchPodConditions checks if the specified condition type and status are present in the given pod conditions.
func MountPathLocalStore ¶ added in v0.31.0
func MountPathLocalStore(etcd *druidv1alpha1.Etcd, provider *string) string
MountPathLocalStore returns the mount path for the local store if the provider matches.
func RemoveAllFinalizers ¶
RemoveAllFinalizers ensures that the given object has no finalizers with exponential backoff. If any finalizers are set, it removes them and issues a patch.
func RemoveFinalizers ¶
func RemoveFinalizers(ctx context.Context, writer client.Writer, obj client.Object, finalizers ...string) error
RemoveFinalizers ensures that the given finalizer is not present anymore in the given object and optimistic locking. If it is set, it removes it and issues a patch. Note that this is done with a regular merge-patch since strategic merge-patches do not work with custom resources, see https://github.com/kubernetes/kubernetes/issues/105146.
Types ¶
This section is empty.