internal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloudServiceTypeCompute = CloudServiceType("Compute")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudAccountInterface

type CloudAccountInterface interface {
	GetNamespacedName() *types.NamespacedName
	GetServiceConfigs() map[CloudServiceName]*CloudServiceCommon
	GetServiceConfigByName(name CloudServiceName) (CloudServiceInterface, error)
	GetStatus() *cloudv1alpha1.CloudProviderAccountStatus
	// 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-common-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

	GetCloudAccountComputeResourceCRDs(namespacedName *types.NamespacedName) ([]*cloudv1alpha1.VirtualMachine,
		error)
	GetAllCloudAccountsComputeResourceCRDs() ([]*cloudv1alpha1.VirtualMachine, error)

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

	AddSelector(namespacedName *types.NamespacedName, selector *cloudv1alpha1.CloudEntitySelector) error
	RemoveSelector(accNamespacedName *types.NamespacedName, selectorName string)

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

	DoInventoryPoll(accountNamespacedName *types.NamespacedName) error

	DeleteInventoryPollCache(accountNamespacedName *types.NamespacedName) error

	GetVpcInventory(accountNamespacedName *types.NamespacedName) (map[string]*runtimev1alpha1.Vpc, 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 CloudServiceCommon

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

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)
	// SetResourceFilters will be used by service to get resources from cloud for the service. Each will convert
	// CloudEntitySelector to service understandable filters.
	SetResourceFilters(selector *cloudv1alpha1.CloudEntitySelector)
	// RemoveResourceFilters will be used by service to remove configured filter.
	RemoveResourceFilters(selectorName string)
	// 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
	// GetResourceCRDs returns Service resource saved in CloudServiceResourcesCache in terms of CRD.
	GetResourceCRDs(namespace string, accountId string) *CloudServiceResourceCRDs
	// GetName returns cloud name of the service.
	GetName() CloudServiceName
	// GetType returns service type (compute, any other type etc.)
	GetType() CloudServiceType
	// ResetCachedState clears any internal state build by the service as part of cloud resource discovery.
	ResetCachedState()
	// GetVpcInventory copies VPCs stored in internal snapshot(in cloud specific format) to runtimev1alpha1.Vpc format.
	GetVpcInventory() map[string]*runtimev1alpha1.Vpc
}

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-common-framework using CloudCommonHelperInterface.

type CloudServiceName

type CloudServiceName string

type CloudServiceResourceCRDs

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

func (*CloudServiceResourceCRDs) SetComputeResourceCRDs

func (s *CloudServiceResourceCRDs) SetComputeResourceCRDs(vms []*cloudv1alpha1.VirtualMachine)

SetComputeResourceCRDs sets Service resource CRDs for accessing it from cloudCommon interface.

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 CloudServiceType

type CloudServiceType string

Jump to

Keyboard shortcuts

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