crmutil

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRMHandler

type CRMHandler struct {
	AppCache                  edgeproto.AppCache
	AppInstCache              edgeproto.AppInstCache
	CloudletCache             *edgeproto.CloudletCache
	CloudletInternalCache     edgeproto.CloudletInternalCache
	VMPoolCache               edgeproto.VMPoolCache
	FlavorCache               edgeproto.FlavorCache
	ClusterInstCache          edgeproto.ClusterInstCache
	VMPoolInfoCache           edgeproto.VMPoolInfoCache
	TrustPolicyCache          edgeproto.TrustPolicyCache
	TrustPolicyExceptionCache edgeproto.TrustPolicyExceptionCache
	TPEInstanceStateCache     edgeproto.TPEInstanceStateCache
	AutoProvPolicyCache       edgeproto.AutoProvPolicyCache
	AutoScalePolicyCache      edgeproto.AutoScalePolicyCache
	AlertCache                edgeproto.AlertCache
	SettingsCache             edgeproto.SettingsCache
	ResTagTableCache          edgeproto.ResTagTableCache
	GPUDriverCache            edgeproto.GPUDriverCache
	AlertPolicyCache          edgeproto.AlertPolicyCache
	NetworkCache              edgeproto.NetworkCache
	Settings                  edgeproto.Settings
	NodeMgr                   *node.NodeMgr
	// contains filtered or unexported fields
}

CRMHandler handles converting received changes into platform API calls Handler functions should not spawn other threads unless they wait for for those threads to complete. The caller handles running the CRMHandler functions in separate threads if needed, and relies on knowing when the work has been completed.

func NewCRMHandler

func NewCRMHandler(getPlatform GetPlatformFunc, nodeMgr *node.NodeMgr) *CRMHandler

NewCRMHandler creates a new CRMHandler. If cache data comes from storage, set sync. If cache data comes from the notify framework, leave sync nil.

func (*CRMHandler) AppInstChanged

func (cd *CRMHandler) AppInstChanged(ctx context.Context, target *edgeproto.CloudletKey, new *edgeproto.AppInst, sender edgeproto.AppInstInfoSender) (nu NeedsUpdate, reterr error)

func (*CRMHandler) CaptureResourcesSnapshot

func (cd *CRMHandler) CaptureResourcesSnapshot(ctx context.Context, pf platform.Platform, cloudletKey *edgeproto.CloudletKey) (*edgeproto.InfraResourcesSnapshot, error)

func (*CRMHandler) CloudletChanged

func (cd *CRMHandler) CloudletChanged(ctx context.Context, target *edgeproto.CloudletKey, new *edgeproto.Cloudlet, sender edgeproto.CloudletInfoSender) (reterr error)

func (*CRMHandler) CloudletDNSChanged

func (cd *CRMHandler) CloudletDNSChanged(ctx context.Context, pf platform.Platform, oldDNS string, new *edgeproto.Cloudlet, sender edgeproto.CloudletInfoSender) (reterr error)

func (*CRMHandler) CloudletHasTrustPolicy

func (cd *CRMHandler) CloudletHasTrustPolicy(ctx context.Context, cloudletKey *edgeproto.CloudletKey) (bool, error)

func (*CRMHandler) ClusterInstChanged

func (cd *CRMHandler) ClusterInstChanged(ctx context.Context, target *edgeproto.CloudletKey, new *edgeproto.ClusterInst, sender edgeproto.ClusterInstInfoSender) (nu NeedsUpdate, reterr error)

func (*CRMHandler) GatherCloudletInfo

func (cd *CRMHandler) GatherCloudletInfo(ctx context.Context, pf platform.Platform, info *edgeproto.CloudletInfo) error

GatherCloudletInfo gathers all the information about the Cloudlet that the controller needs to be able to manage it.

func (*CRMHandler) GatherInitialCloudletInfo

func (s *CRMHandler) GatherInitialCloudletInfo(ctx context.Context, cloudlet *edgeproto.Cloudlet, pf platform.Platform, cloudletInfo *edgeproto.CloudletInfo, updateCallback edgeproto.CacheUpdateCallback) error

GatherInitialCloudletInfo gathers on the info when the cloudlet is first created that the controller needs to know about. New data is written to the passed in CloudletInfo.

func (*CRMHandler) GatherInsts

func (cd *CRMHandler) GatherInsts()

GetInsts queries Openstack/Kubernetes to get all the cluster insts and app insts that have been created on the Cloudlet. It is called once at startup, and is used to repopulate the cache after CRM restart/crash. When the CRM connects to the controller, it will send the insts in the cache and the controller will resolve any discrepancies between the CRM's current state versus the controller's intended state.

The controller does not know about all the steps that are used to create/delete a ClusterInst/AppInst, so if the CRM crashed in the middle of such a task, it is up to the CRM to clean up any unfinished state.

func (*CRMHandler) GetCaches

func (cd *CRMHandler) GetCaches() *platform.Caches

func (*CRMHandler) HandleTrustPolicyException

func (cd *CRMHandler) HandleTrustPolicyException(ctx context.Context, inst *edgeproto.TPEInstanceState) error

Common code to handle add and removal of trust policy exception rules

func (*CRMHandler) ProcessExecReq

func (cd *CRMHandler) ProcessExecReq(ctx context.Context, pf platform.Platform, req *edgeproto.ExecRequest, sendReply func(msg *edgeproto.ExecRequest)) (reterr error)

func (*CRMHandler) RefreshAppInstRuntime

func (cd *CRMHandler) RefreshAppInstRuntime(ctx context.Context, cloudletKey *edgeproto.CloudletKey, clusterInst *edgeproto.ClusterInst, appInst *edgeproto.AppInst, updateRuntimeCb UpdateRuntimeCb) error

RefreshAppInstRuntime refreshes AppInst runtimes. AppInst may be nil to update all AppInsts on a cluster. ClusterInst may be nil to refresh all AppInsts on the cloudlet.

func (*CRMHandler) SettingsChanged

func (cd *CRMHandler) SettingsChanged(ctx context.Context, old *edgeproto.Settings, new *edgeproto.Settings)

func (*CRMHandler) UpdateTrustPolicy

func (cd *CRMHandler) UpdateTrustPolicy(ctx context.Context, cloudlet *edgeproto.Cloudlet, pf platform.Platform, sender edgeproto.CloudletInfoSender) error

type GetPlatformFunc

type GetPlatformFunc func(ctx context.Context, key *edgeproto.CloudletKey) (platform.Platform, error)

type NeedsUpdate

type NeedsUpdate struct {
	Resources      bool
	AppInstRuntime bool
}

type RunExec

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

type UpdateRuntimeCb

type UpdateRuntimeCb = func(ctx context.Context, key *edgeproto.AppInstKey, rt *edgeproto.AppInstRuntime, getRuntimeErr error)

Jump to

Keyboard shortcuts

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