internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RuntimeAPIVersion               = "runtime.cloud.antrea.io/v1alpha1"
	VirtualMachineRuntimeObjectKind = reflect.TypeOf(runtimev1alpha1.VirtualMachine{}).Name()

	MaxCloudResourceResponse  int64 = 100
	InventoryInitWaitDuration       = time.Second * 30
	AccountCredentialsDefault       = "default"
)

Functions

This section is empty.

Types

type CloudAccountInterface

type CloudAccountInterface interface {
	GetNamespacedName() *types.NamespacedName
	GetServiceConfig() CloudServiceInterface
	GetStatus() *crdv1alpha1.CloudProviderAccountStatus
	LockMutex()
	UnlockMutex()
	// contains filtered or unexported methods
}

type CloudCommonHelperInterface

type CloudCommonHelperInterface interface {
	GetCloudServicesCreateFunc() CloudServiceConfigCreatorFunc
	SetAccountCredentialsFunc() CloudCredentialValidatorFunc
	GetCloudCredentialsComparatorFunc() CloudCredentialComparatorFunc
}

CloudCommonHelperInterface interface needs to be implemented by each cloud-plugin. It provides a way to inject cloud dependent functionality into plugin-cloud-framework. Cloud dependent functionality can include cloud service operations, credentials management etc.

type CloudCommonInterface

type CloudCommonInterface interface {
	GetCloudAccountByName(namespacedName *types.NamespacedName) (CloudAccountInterface, bool)
	GetCloudAccountByAccountId(accountID *string) (CloudAccountInterface, bool)
	GetCloudAccounts() map[types.NamespacedName]CloudAccountInterface

	AddCloudAccount(client client.Client, account *crdv1alpha1.CloudProviderAccount, credentials interface{}) error
	RemoveCloudAccount(namespacedName *types.NamespacedName)

	AddResourceFilters(namespacedName *types.NamespacedName, selector *crdv1alpha1.CloudEntitySelector) error
	RemoveResourceFilters(accNamespacedName, selectorNamespacedName *types.NamespacedName)

	GetStatus(accNamespacedName *types.NamespacedName) (*crdv1alpha1.CloudProviderAccountStatus, error)

	DoInventoryPoll(accountNamespacedName *types.NamespacedName) error

	ResetInventoryCache(accountNamespacedName *types.NamespacedName) error

	GetCloudInventory(accountNamespacedName *types.NamespacedName) (*nephetypes.CloudInventory, error)
}

CloudCommonInterface implements functionality common across all supported cloud-plugins. Each cloud plugin uses this interface by composition.

func NewCloudCommon

func NewCloudCommon(logger func() logging.Logger, commonHelper CloudCommonHelperInterface,
	cloudSpecificHelper interface{}) CloudCommonInterface

type CloudCredentialComparatorFunc

type CloudCredentialComparatorFunc func(accountName string, existing interface{}, new interface{}) bool

type CloudCredentialValidatorFunc

type CloudCredentialValidatorFunc func(client client.Client, credentials interface{}) (interface{}, error)

type CloudServiceConfigCreatorFunc

type CloudServiceConfigCreatorFunc func(namespacedName *types.NamespacedName, cloudConvertedCredentials interface{},
	helper interface{}) (CloudServiceInterface, error)

type CloudServiceInterface

type CloudServiceInterface interface {
	// UpdateServiceConfig updates existing service config with new values. Each service can decide to update one or
	// more fields of the service.
	UpdateServiceConfig(newServiceConfig CloudServiceInterface) error
	// AddResourceFilters will be used by service to get resources from cloud for the service. Each will convert
	// CloudEntitySelector to service understandable filters.
	AddResourceFilters(selector *crdv1alpha1.CloudEntitySelector) error
	// RemoveResourceFilters will be used by service to remove configured filter.
	RemoveResourceFilters(selectorNamespacedName *types.NamespacedName)
	// DoResourceInventory performs resource inventory for the cloud service based on configured filters. As part
	// inventory, it is expected to save resources in service cache CloudServiceResourcesCache.
	DoResourceInventory() error
	// GetInventoryStats returns Inventory statistics for the service.
	GetInventoryStats() *CloudServiceStats
	// ResetInventoryCache clears any internal state built by the service as part of cloud resource discovery.
	ResetInventoryCache()
	// GetCloudInventory copies VPCs and VMs stored in internal snapshot(in cloud specific format) to internal format.
	GetCloudInventory() *nephetypes.CloudInventory
}

CloudServiceInterface needs to be implemented by every cloud-service to be added for a cloud-plugin. Once implemented, cloud-service implementation of CloudServiceInterface will get injected into plugin-cloud-framework using CloudCommonHelperInterface.

type CloudServiceResourcesCache

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

CloudServiceResourcesCache is cache used by all services. Each service can maintain its resources specific cache by updating the snapshot.

func (*CloudServiceResourcesCache) ClearSnapshot

func (cache *CloudServiceResourcesCache) ClearSnapshot()

func (*CloudServiceResourcesCache) GetSnapshot

func (cache *CloudServiceResourcesCache) GetSnapshot() interface{}

func (*CloudServiceResourcesCache) UpdateSnapshot

func (cache *CloudServiceResourcesCache) UpdateSnapshot(newSnapshot interface{})

type CloudServiceStats

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

func (*CloudServiceStats) IsInventoryInitialized

func (s *CloudServiceStats) IsInventoryInitialized() bool

func (*CloudServiceStats) ResetInventoryPollStats

func (s *CloudServiceStats) ResetInventoryPollStats()

func (*CloudServiceStats) UpdateInventoryPollStats

func (s *CloudServiceStats) UpdateInventoryPollStats(err error)

type InstanceID

type InstanceID string

Jump to

Keyboard shortcuts

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