resourcerequestoperator

package
v0.3.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

Package resourcerequestoperator contains the ResourceRequest controller which reconciles the resource and creates new ResourceOffer and related tests. utils.go contains all utility function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

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

Broadcaster is an object which is used to get resources of the cluster.

func (*Broadcaster) ReadResources

func (b *Broadcaster) ReadResources(clusterID string) corev1.ResourceList

ReadResources return in thread safe mode a scaled value of the resources.

func (*Broadcaster) RemoveClusterID

func (b *Broadcaster) RemoveClusterID(clusterID string)

RemoveClusterID removes a clusterID from all broadcaster internal structures it is useful when a particular foreign cluster has no more peering and its ResourceRequest has been deleted.

func (*Broadcaster) SetupBroadcaster

func (b *Broadcaster) SetupBroadcaster(clientset kubernetes.Interface, updater interfaces.UpdaterInterface,
	resyncPeriod time.Duration, resourceSharingPercentage, offerUpdateThreshold uint64) error

SetupBroadcaster initializes all Broadcaster parameters.

func (*Broadcaster) StartBroadcaster

func (b *Broadcaster) StartBroadcaster(ctx context.Context, group *sync.WaitGroup)

StartBroadcaster starts two shared Informers, one for nodes and one for pods launching two separated goroutines.

type OfferUpdater

type OfferUpdater struct {
	client.Client
	// contains filtered or unexported fields
}

OfferUpdater is a component which wraps all ResourceOffer update logic.

func (*OfferUpdater) Push

func (u *OfferUpdater) Push(clusterID string)

Push add new clusterID to update queue which will be processes as soon as possible.

func (*OfferUpdater) Remove

func (u *OfferUpdater) Remove(clusterID string)

Remove removes a specified clusterID from the update queue and it will be no more processed.

func (*OfferUpdater) Setup

func (u *OfferUpdater) Setup(clusterID string, scheme *runtime.Scheme, broadcaster interfaces.ClusterResourceInterface,
	k8Client client.Client, clusterLabels map[string]string)

Setup initializes all parameters of the OfferUpdater component.

func (*OfferUpdater) Start

func (u *OfferUpdater) Start(ctx context.Context, group *sync.WaitGroup)

Start runs the OfferUpdate worker.

type PodTransition

type PodTransition uint8

PodTransition represents a podReady condition possible transitions.

const (
	// PendingToReady represents a transition from PodReady status = false to PodReady status = true.
	PendingToReady PodTransition = iota
	// ReadyToReady represents no change in PodReady status when status = true.
	ReadyToReady
	// ReadyToPending represents a transition from PodReady status = true to PodReady status = false.
	ReadyToPending
	// PendingToPending represents no change in PodReady status when status = false.
	PendingToPending
)

type ResourceRequestReconciler

type ResourceRequestReconciler struct {
	client.Client
	Scheme                *runtime.Scheme
	ClusterID             string
	Broadcaster           *Broadcaster
	EnableIncomingPeering bool
}

ResourceRequestReconciler reconciles a ResourceRequest object.

func (*ResourceRequestReconciler) Reconcile

func (r *ResourceRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error)

Reconcile is the main function of the controller which reconciles ResourceRequest resources.

func (*ResourceRequestReconciler) SetupWithManager

func (r *ResourceRequestReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager is the setup function of the controller.

Directories

Path Synopsis
Package interfaces contains all the ResourceRequestOperator interfaces representing some of its components.
Package interfaces contains all the ResourceRequestOperator interfaces representing some of its components.
Package testutils contains utility functions used by the unit tests of the resource-request-controller
Package testutils contains utility functions used by the unit tests of the resource-request-controller

Jump to

Keyboard shortcuts

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