kubernetes

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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

func ContainsAllDesiredLabels(actual, desired map[string]string) bool

ContainsAllDesiredLabels checks if the actual map contains all the desired labels.

func ContainsLabel

func ContainsLabel(actual map[string]string, key, value string) bool

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

func HasPodReadyConditionTrue(pod *corev1.Pod) bool

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

func RemoveAllFinalizers(ctx context.Context, writer client.Writer, obj client.Object) error

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.

Jump to

Keyboard shortcuts

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