resourcerequestoperator

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 34 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

func GetResourceRequest added in v0.3.2

func GetResourceRequest(ctx context.Context, k8sClient client.Client, clusterID string) (
	*discoveryv1alpha1.ResourceRequest, error)

GetResourceRequest returns ResourceRequest for the given cluster.

func GetTenantName added in v0.4.0

func GetTenantName(cluster discoveryv1alpha1.ClusterIdentity) string

GetTenantName returns the name of the Tenant for the given cluster.

Types

type OfferQueue added in v0.3.2

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

OfferQueue is a component that periodically commands a broadcaster/broker to update its ResourceOffers. It also provides rate-limited retries for transient errors in the offering process.

func NewOfferQueue added in v0.3.2

func NewOfferQueue(offerUpdater *OfferUpdater) OfferQueue

NewOfferQueue constructs an OfferQueue.

func (*OfferQueue) Push added in v0.3.2

func (u *OfferQueue) Push(cluster discoveryv1alpha1.ClusterIdentity)

Push pushes a cluster ID into the queue.

func (*OfferQueue) Start added in v0.3.2

func (u *OfferQueue) Start(ctx context.Context) error

Start starts the update loop and blocks.

type OfferUpdater

type OfferUpdater struct {
	resourcemonitors.ResourceReader
	OfferQueue
	// contains filtered or unexported fields
}

OfferUpdater is a component that responds to ResourceRequests with the cluster's resources read from ResourceReader.

func NewOfferUpdater added in v0.3.2

func NewOfferUpdater(ctx context.Context, k8sClient client.Client, homeCluster discoveryv1alpha1.ClusterIdentity,
	clusterLabels map[string]string, reader resourcemonitors.ResourceReader, updateThresholdPercentage uint,
	localRealStorageClassName string, enableStorage bool,
	ingressClasses, loadBalancerClasses argutils.ClassNameList) *OfferUpdater

NewOfferUpdater constructs a new OfferUpdater.

func (*OfferUpdater) CreateOrUpdateOffer added in v0.3.2

func (u *OfferUpdater) CreateOrUpdateOffer(cluster discoveryv1alpha1.ClusterIdentity) (requeue bool, err error)

CreateOrUpdateOffer creates one or more offers for the given cluster, reading resources from the ResourceReader.

func (*OfferUpdater) NotifyChange added in v0.3.2

func (u *OfferUpdater) NotifyChange(clusterID string)

NotifyChange is used by the ResourceReader to notify that resources were changed for a single cluster identified by clusterID or for all clusters by passing resourcemonitors.AllClusterIDs.

func (*OfferUpdater) SetThreshold added in v0.3.2

func (u *OfferUpdater) SetThreshold(updateThresholdPercentage uint)

SetThreshold sets the threshold for resource updates to trigger an update of the ResourceOffers.

func (*OfferUpdater) Start

func (u *OfferUpdater) Start(ctx context.Context) error

Start starts the OfferUpdater and blocks.

type ResourceRequestReconciler

type ResourceRequestReconciler struct {
	client.Client
	Scheme      *runtime.Scheme
	HomeCluster discoveryv1alpha1.ClusterIdentity
	*OfferUpdater
	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 resourcemonitors contains the ResourceReader API that is used to create ResourceOffers, as well as resource monitors implementing this API.
Package resourcemonitors contains the ResourceReader API that is used to create ResourceOffers, as well as resource monitors implementing this API.

Jump to

Keyboard shortcuts

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