advertisementOperator

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const FinalizerString = "advertisement.sharing.liqo.io/virtual-kubelet"

Variables

This section is empty.

Functions

func ComputeAnnouncedResources

func ComputeAnnouncedResources(physicalNodes *corev1.NodeList, reqs corev1.ResourceList, sharingPercentage int64) (availability corev1.ResourceList, images []corev1.ContainerImage)

create announced resources for advertisement

func ComputePrices

func ComputePrices(images []corev1.ContainerImage) corev1.ResourceList

create prices resource for advertisement

func GetAllPodsResources

func GetAllPodsResources(nodeNonTerminatedPodsList *corev1.PodList) (requests corev1.ResourceList, limits corev1.ResourceList)

get resources used by pods on physical nodes

func GetClusterResources

func GetClusterResources(nodes []corev1.Node) (corev1.ResourceList, []corev1.ContainerImage)

get cluster resources (cpu, ram, pods, ...) and images

func GetLabels

func GetLabels(physicalNodes *corev1.NodeList, labelPolicies []configv1alpha1.LabelPolicy) (labels map[string]string)

get labels for advertisement

func GetNodeImages

func GetNodeImages(node corev1.Node) []corev1.ContainerImage

func StartBroadcaster

func StartBroadcaster(homeClusterId, localKubeconfigPath, peeringRequestName, saName string) error

start the broadcaster which sends Advertisement messages it reads the Secret to get the kubeconfig to the remote cluster and create a client for it parameters - homeClusterId: the cluster ID of your cluster (must be a UUID) - localKubeconfigPath: the path to the kubeconfig of the local cluster. Set it only when you are debugging and need to launch the program as a process and not inside Kubernetes - peeringRequestName: the name of the PeeringRequest containing the reference to the secret with the kubeconfig for creating Advertisements CR on foreign cluster - saName: The name of the ServiceAccount used to create the kubeconfig that will be sent to the foreign cluster with the permissions to create resources on local cluster

Types

type AdvResources

type AdvResources struct {
	PhysicalNodes *corev1.NodeList
	VirtualNodes  *corev1.NodeList
	Availability  corev1.ResourceList
	Limits        corev1.ResourceList
	Images        []corev1.ContainerImage
	Labels        map[string]string
}

convenience struct, to be returned in func

type AdvertisementBroadcaster

type AdvertisementBroadcaster struct {
	// local-related variables
	LocalClient     *crdClient.CRDClient
	DiscoveryClient *crdClient.CRDClient
	// remote-related variables
	KubeconfigSecretForForeign *corev1.Secret       // secret containing the kubeconfig that will be sent to the foreign cluster
	RemoteClient               *crdClient.CRDClient // client to create Advertisements and Secrets on the foreign cluster
	// configuration variables
	HomeClusterId      string
	ForeignClusterId   string
	PeeringRequestName string
	ClusterConfig      configv1alpha1.ClusterConfigSpec
	// contains filtered or unexported fields
}

func (*AdvertisementBroadcaster) CreateAdvertisement

func (b *AdvertisementBroadcaster) CreateAdvertisement(advRes *AdvResources) advtypes.Advertisement

create advertisement message

func (*AdvertisementBroadcaster) GenerateAdvertisement

func (b *AdvertisementBroadcaster) GenerateAdvertisement()

generate an Advertisement message every 10 minutes and post it to remote clusters

func (*AdvertisementBroadcaster) GetResourcesForAdv

func (b *AdvertisementBroadcaster) GetResourcesForAdv() (advRes *AdvResources, err error)

func (*AdvertisementBroadcaster) NotifyAdvertisementDeletion

func (b *AdvertisementBroadcaster) NotifyAdvertisementDeletion() error

func (*AdvertisementBroadcaster) SendAdvertisementToForeignCluster

func (b *AdvertisementBroadcaster) SendAdvertisementToForeignCluster(advToCreate advtypes.Advertisement) (*advtypes.Advertisement, error)

func (*AdvertisementBroadcaster) SendSecretToForeignCluster

func (b *AdvertisementBroadcaster) SendSecretToForeignCluster(secret *corev1.Secret) (*corev1.Secret, error)

func (*AdvertisementBroadcaster) WatchAdvertisement

func (b *AdvertisementBroadcaster) WatchAdvertisement(homeAdvName string)

func (*AdvertisementBroadcaster) WatchConfiguration

func (b *AdvertisementBroadcaster) WatchConfiguration(kubeconfigPath string, client *crdClient.CRDClient)

type AdvertisementReconciler

type AdvertisementReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	EventsRecorder   record.EventRecorder
	KubeletNamespace string
	VKImage          string
	InitVKImage      string
	HomeClusterId    string
	AcceptedAdvNum   int32
	ClusterConfig    configv1alpha1.AdvertisementConfig
	AdvClient        *crdClient.CRDClient
	DiscoveryClient  *crdClient.CRDClient
	RetryTimeout     time.Duration
	// contains filtered or unexported fields
}

AdvertisementReconciler reconciles a Advertisement object

func (*AdvertisementReconciler) CheckAdvertisement

func (r *AdvertisementReconciler) CheckAdvertisement(adv *advtypes.Advertisement)

check if the advertisement is interesting and set its status accordingly

func (*AdvertisementReconciler) CheckKubeconfigExistence

func (r *AdvertisementReconciler) CheckKubeconfigExistence(adv *advtypes.Advertisement) error

func (*AdvertisementReconciler) CleanOldAdvertisements

func (r *AdvertisementReconciler) CleanOldAdvertisements(quit chan struct{}, wg *sync.WaitGroup)

func (*AdvertisementReconciler) InitCRDClient

func (r *AdvertisementReconciler) InitCRDClient(kubeconfigPath string) (*crdClient.CRDClient, error)

func (*AdvertisementReconciler) ManageMaximumUpdate

func (*AdvertisementReconciler) Reconcile

func (r *AdvertisementReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)

func (*AdvertisementReconciler) SetupWithManager

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

func (*AdvertisementReconciler) UpdateAdvertisement

func (r *AdvertisementReconciler) UpdateAdvertisement(adv *advtypes.Advertisement)

func (*AdvertisementReconciler) UpdateForeignCluster

func (r *AdvertisementReconciler) UpdateForeignCluster(adv *advtypes.Advertisement) (error, bool)

set Advertisement reference in related ForeignCluster

func (*AdvertisementReconciler) WatchConfiguration

func (r *AdvertisementReconciler) WatchConfiguration(kubeconfigPath string, client *crdClient.CRDClient, wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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