controllerhelpers

package
v1.9.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HandlerOperationTypeAdd    = "Add"
	HandlerOperationTypeUpdate = "Update"
	HandlerOperationTypeDelete = "Delete"
)

Variables

This section is empty.

Functions

func AddGenericProgressingStatusCondition added in v1.8.0

func AddGenericProgressingStatusCondition(conditions *[]metav1.Condition, conditionType string, obj runtime.Object, verb string, observedGeneration int64)

func AggregateStatusConditions added in v1.8.0

func AggregateStatusConditions(conditions []metav1.Condition, condition metav1.Condition) (metav1.Condition, error)

func FilterObjectMapByLabel added in v1.9.0

func FilterObjectMapByLabel[T metav1.Object](objects map[string]T, selector labels.Selector) map[string]T

func FindContainerStatus added in v1.8.0

func FindContainerStatus(pod *corev1.Pod, containerName string) *corev1.ContainerStatus

func FindNodeStatus

func FindNodeStatus(nodeStatuses []scyllav1alpha1.NodeConfigNodeStatus, nodeName string) *scyllav1alpha1.NodeConfigNodeStatus

func FindScyllaContainerStatus

func FindScyllaContainerStatus(pod *corev1.Pod) *corev1.ContainerStatus

func FindStatusConditionsWithSuffix added in v1.8.0

func FindStatusConditionsWithSuffix(conditions []metav1.Condition, suffix string) []metav1.Condition

FindStatusConditionsWithSuffix finds all conditions that end with the suffix, except the identity.

func GenerateMergePatch

func GenerateMergePatch(original runtime.Object, modified runtime.Object) ([]byte, error)

func GetNodePointerArrayFromArray

func GetNodePointerArrayFromArray(nodes []corev1.Node) []*corev1.Node

func GetObjects added in v1.9.0

func GetObjects[CT, T kubeinterfaces.ObjectInterface](
	ctx context.Context,
	controller metav1.Object,
	controllerGVK schema.GroupVersionKind,
	selector labels.Selector,
	control ControlleeManagerGetObjectsInterface[CT, T],
) (map[string]T, error)

func GetObjectsWithFilter added in v1.9.0

func GetObjectsWithFilter[CT, T kubeinterfaces.ObjectInterface](
	ctx context.Context,
	controller metav1.Object,
	controllerGVK schema.GroupVersionKind,
	selector labels.Selector,
	filterFunc func(T) bool,
	control ControlleeManagerGetObjectsInterface[CT, T],
) (map[string]T, error)

func GetPodCondition

func GetPodCondition(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) *corev1.PodCondition

func GetRequiredScyllaHosts

func GetRequiredScyllaHosts(sc *scyllav1.ScyllaCluster, services map[string]*corev1.Service) ([]string, error)

func GetScyllaContainerID

func GetScyllaContainerID(pod *corev1.Pod) (string, error)

func GetScyllaHost

func GetScyllaHost(statefulsetName string, ordinal int32, services map[string]*corev1.Service) (string, error)

func GetScyllaIPFromService

func GetScyllaIPFromService(svc *corev1.Service) (string, error)

func IsDaemonSetRolledOut

func IsDaemonSetRolledOut(ds *appsv1.DaemonSet) (bool, error)

func IsNodeConfigSelectingNode

func IsNodeConfigSelectingNode(nc *scyllav1alpha1.NodeConfig, node *corev1.Node) (bool, error)

func IsNodeTuned

func IsNodeTuned(ncnss []scyllav1alpha1.NodeConfigNodeStatus, nodeName string) bool

func IsNodeTunedForContainer

func IsNodeTunedForContainer(nc *scyllav1alpha1.NodeConfig, nodeName string, containerID string) bool

func IsOrphanedPV

func IsOrphanedPV(pv *corev1.PersistentVolume, nodes []*corev1.Node) (bool, error)

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

func IsPodReadyWithPositiveLiveCheck

func IsPodReadyWithPositiveLiveCheck(ctx context.Context, client corev1client.PodsGetter, pod *corev1.Pod) (bool, *corev1.Pod, error)

func IsScyllaContainerRunning

func IsScyllaContainerRunning(pod *corev1.Pod) bool

func IsScyllaPod added in v1.9.0

func IsScyllaPod(pod *corev1.Pod) bool

func IsStatefulSetRolledOut

func IsStatefulSetRolledOut(sts *appsv1.StatefulSet) (bool, error)

func NewScyllaClient added in v1.8.0

func NewScyllaClient(cfg *scyllaclient.Config) (*scyllaclient.Client, error)

func NewScyllaClientForLocalhost added in v1.8.0

func NewScyllaClientForLocalhost() (*scyllaclient.Client, error)

func NewScyllaClientFromToken

func NewScyllaClientFromToken(hosts []string, authToken string) (*scyllaclient.Client, error)

func Prune added in v1.9.0

func Prune[T kubeinterfaces.ObjectInterface](ctx context.Context, requiredObjects []T, existingObjects map[string]T, control PruneControlInterface, eventRecorder record.EventRecorder) error

func RunSync added in v1.9.0

func RunSync(conditions *[]metav1.Condition, progressingConditionType, degradedCondType string, observedGeneration int64, syncFn func() ([]metav1.Condition, error)) error

func SetAggregatedWorkloadConditions added in v1.9.0

func SetAggregatedWorkloadConditions(conditions *[]metav1.Condition, generation int64) error

func SetRackCondition

func SetRackCondition(rackStatus *scyllav1.RackStatus, newCondition scyllav1.RackConditionType)

func SetStatusConditionFromError added in v1.8.0

func SetStatusConditionFromError(conditions *[]metav1.Condition, err error, conditionType string, observedGeneration int64)

Types

type ControlleeManagerGetObjectsFuncs added in v1.9.0

type ControlleeManagerGetObjectsFuncs[CT, T kubeinterfaces.ObjectInterface] struct {
	GetControllerUncachedFunc func(ctx context.Context, name string, opts metav1.GetOptions) (CT, error)
	ListObjectsFunc           func(selector labels.Selector) ([]T, error)
	PatchObjectFunc           func(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (T, error)
}

func (ControlleeManagerGetObjectsFuncs[CT, T]) GetControllerUncached added in v1.9.0

func (f ControlleeManagerGetObjectsFuncs[CT, T]) GetControllerUncached(ctx context.Context, name string, opts metav1.GetOptions) (CT, error)

func (ControlleeManagerGetObjectsFuncs[CT, T]) ListObjects added in v1.9.0

func (f ControlleeManagerGetObjectsFuncs[CT, T]) ListObjects(selector labels.Selector) ([]T, error)

func (ControlleeManagerGetObjectsFuncs[CT, T]) PatchObject added in v1.9.0

func (f ControlleeManagerGetObjectsFuncs[CT, T]) PatchObject(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (T, error)

type ControlleeManagerGetObjectsInterface added in v1.9.0

type ControlleeManagerGetObjectsInterface[CT, T kubeinterfaces.ObjectInterface] interface {
	GetControllerUncached(ctx context.Context, name string, opts metav1.GetOptions) (CT, error)
	ListObjects(selector labels.Selector) ([]T, error)
	PatchObject(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (T, error)
}

type DeleteFuncType added in v1.9.0

type DeleteFuncType = func(any)

type EnqueueFuncType added in v1.9.0

type GetFuncType added in v1.9.0

type GetFuncType[T any] func(namespace, name string) (T, error)

type HandlerOperationType added in v1.9.0

type HandlerOperationType string

type Handlers added in v1.9.0

type Handlers[T kubeinterfaces.ObjectInterface] struct {
	// contains filtered or unexported fields
}

func NewHandlers added in v1.9.0

func (*Handlers[T]) Enqueue added in v1.9.0

func (h *Handlers[T]) Enqueue(depth int, untypedObj kubeinterfaces.ObjectInterface, op HandlerOperationType)

func (*Handlers[T]) EnqueueAll added in v1.9.0

func (h *Handlers[T]) EnqueueAll(depth int, untypedObj kubeinterfaces.ObjectInterface, op HandlerOperationType)

func (*Handlers[QT]) EnqueueOwner added in v1.9.0

func (h *Handlers[QT]) EnqueueOwner(depth int, obj kubeinterfaces.ObjectInterface, operation HandlerOperationType)

func (*Handlers[QT]) EnqueueOwnerFunc added in v1.9.0

func (h *Handlers[QT]) EnqueueOwnerFunc(enqueueFunc EnqueueFuncType) EnqueueFuncType

func (*Handlers[T]) EnqueueWithFilterFunc added in v1.9.0

func (h *Handlers[T]) EnqueueWithFilterFunc(filterFunc func(T) bool) EnqueueFuncType

func (*Handlers[T]) HandleAdd added in v1.9.0

func (h *Handlers[T]) HandleAdd(obj kubeinterfaces.ObjectInterface, enqueueFunc EnqueueFuncType)

func (*Handlers[T]) HandleAddWithDepth added in v1.9.0

func (h *Handlers[T]) HandleAddWithDepth(depth int, obj any, enqueueFunc EnqueueFuncType)

func (*Handlers[T]) HandleDelete added in v1.9.0

func (h *Handlers[T]) HandleDelete(obj any, enqueueFunc EnqueueFuncType)

func (*Handlers[T]) HandleDeleteWithDepth added in v1.9.0

func (h *Handlers[T]) HandleDeleteWithDepth(depth int, obj any, enqueueFunc EnqueueFuncType)

func (*Handlers[QT]) HandleUpdate added in v1.9.0

func (h *Handlers[QT]) HandleUpdate(old, cur any, enqueueFunc EnqueueFuncType, deleteFunc DeleteFuncType)

func (*Handlers[QT]) HandleUpdateWithDepth added in v1.9.0

func (h *Handlers[QT]) HandleUpdateWithDepth(depth int, oldUntyped, curUntyped any, enqueueFunc EnqueueFuncType, deleteFunc DeleteFuncType)

type InformerHandler added in v1.9.0

type InformerHandler struct {
	Informer cache.SharedIndexInformer
	Handler  cache.ResourceEventHandler
}

type KeyFuncType added in v1.9.0

type KeyFuncType func(obj interface{}) (string, error)

type PruneControlFuncs added in v1.9.0

type PruneControlFuncs struct {
	DeleteFunc func(ctx context.Context, name string, opts metav1.DeleteOptions) error
}

func (*PruneControlFuncs) Delete added in v1.9.0

func (pcf *PruneControlFuncs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error

type PruneControlInterface added in v1.9.0

type PruneControlInterface interface {
	Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
}

type RequeueError

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

func NewRequeueError

func NewRequeueError(reasons ...string) *RequeueError

func (*RequeueError) Error

func (e *RequeueError) Error() string

Jump to

Keyboard shortcuts

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