service

package
v2.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InfoName      = "n"
	InfoNamespace = "ns"
	InfoExpiry    = "e"
)
View Source
const (
	TemplateCoreConfYaml       = "baetyl-core-conf.yml"
	TemplateInitConfYaml       = "baetyl-init-conf.yml"
	TemplateAgentConfYaml      = "baetyl-agent-conf.yml"
	TemplateBaetylInitCommand  = "baetyl-init-command"
	TemplateInitCommandWget    = "baetyl-init-command-wget"
	TemplateInitCommandWindows = "baetyl-init-command-windows"

	NamePopulateExtParams = "populateExtParams"

	PropInitCommandAndroid         = "baetyl-init-command-android"
	PropInitCommandAndroidSys      = "baetyl-init-command-android-sys"
	PropInitCommandAndroidBatch    = "baetyl-init-command-android-batch"
	PropInitCommandAndroidBatchSys = "baetyl-init-command-android-batch-sys"
)
View Source
const (
	KeyCheckResourceDependency = "checkResourceDependency"
	KeyDeleteCoreExtResource   = "deleteCoreExtResource"
)
View Source
const (
	Certificate = "certificate"
	CertRoot    = "baetyl.ca"
)
View Source
const (
	HookNamePopulateConfig = "populateConfig"
)
View Source
const KeyCreateExtraNamespaceResources = "createExtraNamespaceResources"
View Source
const KeyDeleteExtraNamespaceResources = "deleteExtraNamespaceResources"
View Source
const ReportTimeKey = "time"

Variables

View Source
var (
	HookNamePopulateParams        = "populateParams"
	HookNamePopulateOptAppsParams = "populateOptAppsParams"
	HookNameGenAppsByOption       = "genAppsByOption"
	HookNameGenSyncExtResource    = "genSyncExtResource"
)
View Source
var (
	CmdExpirationInSeconds = int64(60 * 60)
)

Functions

func DeleteNodeDesireByApp added in v2.2.0

func DeleteNodeDesireByApp(shadow *models.Shadow, app *specV1.Application)

func RefreshNodeDesireByApp added in v2.2.0

func RefreshNodeDesireByApp(shadow *models.Shadow, app *specV1.Application)

func Reverse added in v2.6.1

func Reverse(s []interface{})

Types

type AppCombinedService

type AppCombinedService struct {
	App    ApplicationService
	Config ConfigService
	Secret SecretService
}

AppCombinedService is a combined service contains application, configuration and secret services.

func NewAppCombinedService

func NewAppCombinedService(cfg *config.CloudConfig) (*AppCombinedService, error)

type AppServiceImpl added in v2.3.0

type AppServiceImpl struct {
	Config       plugin.Configuration
	Secret       plugin.Secret
	App          plugin.Application
	IndexService IndexService
}

func (*AppServiceImpl) Create added in v2.3.0

func (a *AppServiceImpl) Create(tx interface{}, namespace string, app *specV1.Application) (*specV1.Application, error)

Create create application

func (*AppServiceImpl) CreateWithBase added in v2.3.0

func (a *AppServiceImpl) CreateWithBase(tx interface{}, namespace string, app, base *specV1.Application) (*specV1.Application, error)

CreateWithBase create application with base

func (*AppServiceImpl) Delete added in v2.3.0

func (a *AppServiceImpl) Delete(tx interface{}, namespace, name, version string) error

Delete delete application

func (*AppServiceImpl) Get added in v2.3.0

func (a *AppServiceImpl) Get(namespace, name, version string) (*specV1.Application, error)

Get get application

func (*AppServiceImpl) List added in v2.3.0

func (a *AppServiceImpl) List(namespace string,
	listOptions *models.ListOptions) (*models.ApplicationList, error)

List get list config

func (*AppServiceImpl) ListByNames added in v2.3.0

func (a *AppServiceImpl) ListByNames(ns string, names []string) ([]models.AppItem, error)

func (*AppServiceImpl) Update added in v2.3.0

func (a *AppServiceImpl) Update(tx interface{}, namespace string, app *specV1.Application) (*specV1.Application, error)

Update update application

type ApplicationService

type ApplicationService interface {
	Get(namespace, name, version string) (*specV1.Application, error)
	Create(tx interface{}, namespace string, app *specV1.Application) (*specV1.Application, error)
	Update(tx interface{}, namespace string, app *specV1.Application) (*specV1.Application, error)
	Delete(tx interface{}, namespace, name, version string) error
	List(namespace string, listOptions *models.ListOptions) (*models.ApplicationList, error)
	ListByNames(ns string, names []string) ([]models.AppItem, error)
	CreateWithBase(tx interface{}, namespace string, app, base *specV1.Application) (*specV1.Application, error)
}

ApplicationService Application Service

func NewApplicationService

func NewApplicationService(config *config.CloudConfig) (ApplicationService, error)

NewApplicationService New Application Service

type AuthService

type AuthService interface {
	plugin.Auth
}

func NewAuthService

func NewAuthService(config *config.CloudConfig) (AuthService, error)

type CacheService

type CacheService interface {
	Get(key string, load func(string) (string, error)) (string, error)
	GetProperty(key string) (string, error)
	GetFileData(file string) (string, error)
}

func NewCacheService

func NewCacheService(cfg *config.CloudConfig) (CacheService, error)

type CacheServiceImpl

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

func (*CacheServiceImpl) Get

func (s *CacheServiceImpl) Get(key string, load func(string) (string, error)) (string, error)

func (*CacheServiceImpl) GetFileData

func (s *CacheServiceImpl) GetFileData(file string) (string, error)

func (*CacheServiceImpl) GetProperty

func (s *CacheServiceImpl) GetProperty(key string) (string, error)

type CheckResourceDependencyFunc added in v2.2.0

type CheckResourceDependencyFunc func(tx any, ns, nodeName string) error

type ConfigService

type ConfigService interface {
	Get(tx interface{}, namespace, name, version string) (*specV1.Configuration, error)
	List(namespace string, listOptions *models.ListOptions) (*models.ConfigurationList, error)
	Create(tx interface{}, namespace string, config *specV1.Configuration) (*specV1.Configuration, error)
	Update(tx interface{}, namespace string, config *specV1.Configuration) (*specV1.Configuration, error)
	Upsert(tx interface{}, namespace string, config *specV1.Configuration) (*specV1.Configuration, error)
	Delete(tx interface{}, namespace, name string) error
}

ConfigService ConfigService

func NewConfigService

func NewConfigService(config *config.CloudConfig) (ConfigService, error)

NewConfigService NewConfigService

type CreateExtraNamespaceResourcesFunc added in v2.2.0

type CreateExtraNamespaceResourcesFunc func(namespace string) error

type CreateNodeFunc added in v2.2.0

type CreateNodeFunc func(tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error)

type CronService added in v2.3.0

type CronService interface {
	GetCron(name, namespace string) (*models.Cron, error)
	CreateCron(*models.Cron) error
	UpdateCron(*models.Cron) error
	DeleteCron(name, namespace string) error
	ListExpiredApps() ([]models.Cron, error)
	DeleteExpiredApps([]uint64) error
}

func NewCronService added in v2.3.0

func NewCronService(config *config.CloudConfig) (CronService, error)

type DeleteCoreExtResource added in v2.3.0

type DeleteCoreExtResource func(tx any, ns string, node *specV1.Node) error

type DeleteExtraNamespaceResourcesFunc added in v2.2.0

type DeleteExtraNamespaceResourcesFunc func(namespace string) error

type FunctionService

type FunctionService interface {
	List(userID, source string) ([]models.Function, error)
	ListFunctionVersions(userID, name, source string) ([]models.Function, error)
	ListSources() []models.FunctionSource
	ListRuntimes() (map[string]string, error)
	GetFunction(userID, name, version, source string) (*models.Function, error)
}

func NewFunctionService

func NewFunctionService(cfg *config.CloudConfig) (FunctionService, error)

NewFunctionService NewFunctionService

type GenAppFunc added in v2.2.0

type GenAppFunc func(tx interface{}, ns string, node *specV1.Node, params map[string]interface{}) (*specV1.Application, error)

type GenAppsByOption added in v2.2.0

type GenAppsByOption func(tx interface{}, ns string, node *specV1.Node, params map[string]interface{}) ([]*specV1.Application, error)

type GenSyncExtResource added in v2.3.0

type GenSyncExtResource func(tx interface{}, ns string, node *specV1.Node, params map[string]interface{}) error

type GetInitResource

type GetInitResource func(ns, nodeName string, params map[string]interface{}) ([]byte, error)

type HandlerPopulateConfig

type HandlerPopulateConfig func(cfg *specV1.Configuration, metadata map[string]string) error

type HandlerPopulateOptAppsParams added in v2.2.0

type HandlerPopulateOptAppsParams func(tx interface{}, ns string, params map[string]interface{}, appAlias []string) error

type HandlerPopulateParams

type HandlerPopulateParams func(tx interface{}, ns string, params map[string]interface{}) error

type IndexService

type IndexService interface {
	// comment
	RefreshIndex(tx interface{}, namespace string, keyA, keyB common.Resource, valueA string, valueBs []string) error
	ListIndex(namespace string, keyA, byKeyB common.Resource, valueB string) ([]string, error)
	// app and config
	RefreshAppIndexByConfig(tx interface{}, namespace, config string, apps []string) error
	RefreshConfigIndexByApp(tx interface{}, namespace, app string, configs []string) error
	ListAppIndexByConfig(namespace, config string) ([]string, error)
	ListConfigIndexByApp(namespace, app string) ([]string, error)

	ListNodesByApp(namespace, app string) ([]string, error)
	ListAppsByNode(namespace, node string) ([]string, error)
	ListAppIndexBySecret(namespace, secret string) ([]string, error)
	ListSecretIndexByApp(namespace, app string) ([]string, error)

	// app and secret
	RefreshSecretIndexByApp(tx interface{}, namespace, app string, secrets []string) error
	RefreshNodesIndexByApp(tx interface{}, namespace, appName string, nodes []string) error
	RefreshAppsIndexByNode(tx interface{}, namespace, node string, apps []string) error
}

func NewIndexService

func NewIndexService(config *config.CloudConfig) (IndexService, error)

NewIndexService New Index Service

type InitService

type InitService interface {
	GetResource(ns, nodeName, resourceName string, params map[string]interface{}) (interface{}, error)
}

InitService

func NewInitService

func NewInitService(config *config.CloudConfig) (InitService, error)

NewSyncService new SyncService

type InitServiceImpl

type InitServiceImpl struct {
	SignService     SignService
	NodeService     NodeService
	Property        PropertyService
	TemplateService TemplateService
	*AppCombinedService
	PKI             PKIService
	ResourceMapFunc map[string]GetInitResource
	Hooks           map[string]interface{}
	// contains filtered or unexported fields
}

func (*InitServiceImpl) GetAppFromDesire added in v2.2.0

func (s *InitServiceImpl) GetAppFromDesire(ns, nodeName, moduleName string, isSys bool) (*specV1.Application, error)

func (*InitServiceImpl) GetInitCommand

func (s *InitServiceImpl) GetInitCommand(ns, nodeName string, params map[string]interface{}) ([]byte, error)

func (*InitServiceImpl) GetNodeCert

func (s *InitServiceImpl) GetNodeCert(app *specV1.Application) (*specV1.Secret, error)

func (*InitServiceImpl) GetRegistryAuth added in v2.3.0

func (s *InitServiceImpl) GetRegistryAuth() (string, error)

GetRegistryAuth add system registry auth if property exist

func (*InitServiceImpl) GetResource

func (s *InitServiceImpl) GetResource(ns, nodeName, resourceName string, params map[string]interface{}) (interface{}, error)

type LicenseService

type LicenseService interface {
	plugin.License
}

func NewLicenseService

func NewLicenseService(config *config.CloudConfig) (LicenseService, error)

type LicenseServiceImpl added in v2.3.0

type LicenseServiceImpl struct {
	plugin.License
}

type LockerService added in v2.2.0

type LockerService interface {
	Lock(ctx context.Context, name string, ttl int64) (string, error)
	Unlock(ctx context.Context, name, value string)
}

func NewLockerService added in v2.2.0

func NewLockerService(config *config.CloudConfig) (LockerService, error)

NewModuleService

type ModuleService added in v2.2.0

type ModuleService interface {
	GetModules(name string) ([]models.Module, error)
	GetModuleByVersion(name, version string) (*models.Module, error)
	GetModuleByImage(name, image string) (*models.Module, error)
	GetLatestModule(name string) (*models.Module, error)
	CreateModule(module *models.Module) (*models.Module, error)
	UpdateModuleByVersion(module *models.Module) (*models.Module, error)
	DeleteModules(name string) error
	DeleteModuleByVersion(name, version string) error
	ListModules(filter *models.Filter, tp common.ModuleType) ([]models.Module, error)

	GetLatestModuleImage(name string) (string, error)
	GetLatestModuleProgram(name, platform string) (string, error)
}

func NewModuleService added in v2.2.0

func NewModuleService(config *config.CloudConfig) (ModuleService, error)

NewModuleService

type NamespaceService

type NamespaceService interface {
	Get(namespace string) (*models.Namespace, error)
	Create(namespace *models.Namespace) (*models.Namespace, error)
	List(listOptions *models.ListOptions) (*models.NamespaceList, error)
	Delete(namespace *models.Namespace) error
}

NamespaceService NamespaceService

func NewNamespaceService

func NewNamespaceService(config *config.CloudConfig) (NamespaceService, error)

NewNamespaceService NewNamespaceService

type NamespaceServiceImpl added in v2.2.0

type NamespaceServiceImpl struct {
	Hooks map[string]interface{}
	// contains filtered or unexported fields
}

func (*NamespaceServiceImpl) Create added in v2.2.0

func (s *NamespaceServiceImpl) Create(namespace *models.Namespace) (*models.Namespace, error)

Create Create a namespace

func (*NamespaceServiceImpl) Delete added in v2.2.0

func (s *NamespaceServiceImpl) Delete(namespace *models.Namespace) error

Delete Delete the namespace

func (*NamespaceServiceImpl) Get added in v2.2.0

func (s *NamespaceServiceImpl) Get(namespace string) (*models.Namespace, error)

Get get a namespace

func (*NamespaceServiceImpl) List added in v2.2.0

List get list namespace

type NodeService

type NodeService interface {
	Get(tx interface{}, namespace, name string) (*specV1.Node, error)
	List(namespace string, listOptions *models.ListOptions) (*models.NodeList, error)
	Count(namespace string) (map[string]int, error)
	CountAll() (map[string]int, error)

	Create(tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error)
	Update(namespace string, node *specV1.Node) (*specV1.Node, error)
	Delete(tx interface{}, namespace string, node *specV1.Node) error

	UpdateReport(namespace, name string, report specV1.Report) (*models.Shadow, error)
	UpdateDesire(tx interface{}, namespace string, names []string, app *specV1.Application, f func(*models.Shadow, *specV1.Application)) error

	GetDesire(namespace, name string) (*specV1.Desire, error)

	UpdateNodeAppVersion(tx interface{}, namespace string, app *specV1.Application) ([]string, error)
	DeleteNodeAppVersion(tx interface{}, namespace string, app *specV1.Application) ([]string, error)

	GetNodeProperties(ns, name string) (*models.NodeProperties, error)
	UpdateNodeProperties(ns, name string, props *models.NodeProperties) (*models.NodeProperties, error)
	UpdateNodeMode(ns, name, mode string) error
}

NodeService NodeService

func NewNodeService

func NewNodeService(config *config.CloudConfig) (NodeService, error)

NewNodeService NewNodeService

type NodeServiceImpl added in v2.2.0

type NodeServiceImpl struct {
	IndexService  IndexService
	App           plugin.Application
	Node          plugin.Node
	Shadow        plugin.Shadow
	Cache         plugin.DataCache
	SysAppService SystemAppService
	Hooks         map[string]interface{}
	// contains filtered or unexported fields
}

func (*NodeServiceImpl) Count added in v2.2.0

func (n *NodeServiceImpl) Count(namespace string) (map[string]int, error)

Count get current node number

func (*NodeServiceImpl) CountAll added in v2.3.0

func (n *NodeServiceImpl) CountAll() (map[string]int, error)

Count get current node number

func (*NodeServiceImpl) Create added in v2.2.0

func (n *NodeServiceImpl) Create(tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error)

Create create a node

func (*NodeServiceImpl) Delete added in v2.2.0

func (n *NodeServiceImpl) Delete(tx interface{}, namespace string, node *specV1.Node) error

Delete delete node

func (*NodeServiceImpl) DeleteNodeAppVersion added in v2.2.0

func (n *NodeServiceImpl) DeleteNodeAppVersion(tx interface{}, namespace string, app *specV1.Application) ([]string, error)

DeleteNodeAppVersion delete the node desire's appVersion for app deleted

func (*NodeServiceImpl) Get added in v2.2.0

func (n *NodeServiceImpl) Get(tx interface{}, namespace, name string) (*specV1.Node, error)

Get get the node

func (*NodeServiceImpl) GetAllShadowReportTime added in v2.6.1

func (n *NodeServiceImpl) GetAllShadowReportTime(namespace string, nodes []specV1.Node) (reportTimeMap map[string]string, err error)

GetAllShadowReportTime get node report time from cache

func (*NodeServiceImpl) GetDesire added in v2.2.0

func (n *NodeServiceImpl) GetDesire(namespace, name string) (*specV1.Desire, error)

func (*NodeServiceImpl) GetNodeAfterTime added in v2.6.1

func (n *NodeServiceImpl) GetNodeAfterTime(node specV1.Node, namespace string) (time.Duration, error)

func (*NodeServiceImpl) GetNodeProperties added in v2.2.0

func (n *NodeServiceImpl) GetNodeProperties(namespace, name string) (*models.NodeProperties, error)

func (*NodeServiceImpl) GetShadowReportCacheByNames added in v2.6.1

func (n *NodeServiceImpl) GetShadowReportCacheByNames(namespace string, names []string) (reportMap map[string][]byte, err error)

func (*NodeServiceImpl) InsertOrUpdateNodeAndAppIndex added in v2.3.0

func (n *NodeServiceImpl) InsertOrUpdateNodeAndAppIndex(tx interface{}, namespace string, node *specV1.Node, shadow *models.Shadow, flag bool) error

func (*NodeServiceImpl) List added in v2.2.0

func (n *NodeServiceImpl) List(namespace string, listOptions *models.ListOptions) (*models.NodeList, error)

List get list node

func (*NodeServiceImpl) SetNodeShadowCache added in v2.6.1

func (n *NodeServiceImpl) SetNodeShadowCache(namespace string, nodes []specV1.Node) (reportTimeMap map[string]string, err error)

SetNodeShadowCache set node shadow report cache time

func (*NodeServiceImpl) Update added in v2.2.0

func (n *NodeServiceImpl) Update(namespace string, node *specV1.Node) (*specV1.Node, error)

Update update node

func (*NodeServiceImpl) UpdateDesire added in v2.2.0

func (n *NodeServiceImpl) UpdateDesire(tx interface{}, namespace string, names []string, app *specV1.Application, f func(*models.Shadow, *specV1.Application)) error

UpdateDesire Update Desire Parameter f can be RefreshNodeDesireByApp or DeleteNodeDesireByApp

func (*NodeServiceImpl) UpdateNodeAppVersion added in v2.2.0

func (n *NodeServiceImpl) UpdateNodeAppVersion(tx interface{}, namespace string, app *specV1.Application) ([]string, error)

UpdateNodeAppVersion update the node desire's appVersion for app changed

func (*NodeServiceImpl) UpdateNodeMode added in v2.2.0

func (n *NodeServiceImpl) UpdateNodeMode(ns, name, mode string) error

func (*NodeServiceImpl) UpdateNodeProperties added in v2.2.0

func (n *NodeServiceImpl) UpdateNodeProperties(namespace, name string, props *models.NodeProperties) (*models.NodeProperties, error)

UpdateNodeProperties update desire of node properties and can not update report of node properties

func (*NodeServiceImpl) UpdateReport added in v2.2.0

func (n *NodeServiceImpl) UpdateReport(namespace, name string, report specV1.Report) (*models.Shadow, error)

UpdateReport Update Report

type ObjectService

type ObjectService interface {
	ListSources() map[string]models.ObjectStorageSourceV2

	ListInternalBuckets(userID, source string) ([]models.Bucket, error)
	ListInternalBucketObjects(userID, bucket, source string) (*models.ListObjectsResult, error)
	CreateInternalBucketIfNotExist(userID, bucket, permission, source string) (*models.Bucket, error)
	PutInternalObjectFromURLIfNotExist(userID, bucket, object, url, source string) error
	GenInternalObjectURL(userID string, bucket, object, source string) (*models.ObjectURL, error)
	GenInternalObjectPutURL(userID string, bucket, object, source string) (*models.ObjectURL, error)
	PutInternalObject(userID, bucket, name, source string, b []byte) error
	HeadInternalObject(userID, bucket, name, source string) (*models.ObjectMeta, error)

	ListExternalBuckets(info models.ExternalObjectInfo, source string) ([]models.Bucket, error)
	ListExternalBucketObjects(info models.ExternalObjectInfo, bucket, source string) (*models.ListObjectsResult, error)
	GenExternalObjectURL(info models.ExternalObjectInfo, bucket, object, source string) (*models.ObjectURL, error)
	CreateExternalBucket(info models.ExternalObjectInfo, bucket, permission, source string) error
	PutExternalObject(info models.ExternalObjectInfo, bucket, name, source string, b []byte) error
	PutExternalObjectFromURL(info models.ExternalObjectInfo, bucket, name, url, source string) error
	GetExternalObject(info models.ExternalObjectInfo, bucket, name, source string) (*models.Object, error)
	HeadExternalObject(info models.ExternalObjectInfo, bucket, name, source string) (*models.ObjectMeta, error)
	DeleteExternalObject(info models.ExternalObjectInfo, bucket, name, source string) error
}

func NewObjectService

func NewObjectService(config *config.CloudConfig) (ObjectService, error)

NewObjectService NewObjectService

type PKIService

type PKIService interface {
	// GetCA get ca
	GetCA() ([]byte, error)
	// SignServerCertificate sign a certificate which can be used to connect to cloud
	SignServerCertificate(cn string, altNames models.AltNames) (*models.PEMCredential, error)
	// SignNodeCertificate sign a certificate which can be used to connect to cloud
	SignClientCertificate(cn string, altNames models.AltNames) (*models.PEMCredential, error)
	// DeleteServerCertificate delete a server certificate by certId
	DeleteServerCertificate(certId string) error
	// DeleteClientCertificate delete a server certificate by certId
	DeleteClientCertificate(certId string) error
}

func NewPKIService

func NewPKIService(config *config.CloudConfig) (PKIService, error)

NewPKIService create a certificate service

type PopulateExtParams added in v2.3.0

type PopulateExtParams func(ns string, node *specV1.Node, app *specV1.Application, params map[string]interface{}) error

type PropertyService

type PropertyService interface {
	GetProperty(name string) (*models.Property, error)
	CreateProperty(property *models.Property) error
	DeleteProperty(name string) error
	ListProperty(page *models.Filter) ([]models.Property, error) //Pagination
	CountProperty(name string) (int, error)
	UpdateProperty(property *models.Property) error

	GetPropertyValue(name string) (string, error)
}

func NewPropertyService

func NewPropertyService(config *config.CloudConfig) (PropertyService, error)

NewPropertyService

type QuotaService added in v2.4.3

type QuotaService interface {
	plugin.Quota
	CheckQuota(namespace string, collector plugin.QuotaCollector) error
}

func NewQuotaService added in v2.4.3

func NewQuotaService(config *config.CloudConfig) (QuotaService, error)

type QuotaServiceImpl added in v2.4.3

type QuotaServiceImpl struct {
	plugin.Quota
}

func (*QuotaServiceImpl) CheckQuota added in v2.4.3

func (l *QuotaServiceImpl) CheckQuota(namespace string, collector plugin.QuotaCollector) error

type SecretService

type SecretService interface {
	Get(namespace, name, version string) (*specV1.Secret, error)
	GetTx(tx interface{}, namespace, name, version string) (*specV1.Secret, error)
	List(namespace string, listOptions *models.ListOptions) (*models.SecretList, error)
	Create(tx interface{}, namespace string, secret *specV1.Secret) (*specV1.Secret, error)
	Update(namespace string, secret *specV1.Secret) (*specV1.Secret, error)
	Delete(tx interface{}, namespace, name string) error
}

SecretService SecretService

func NewSecretService

func NewSecretService(config *config.CloudConfig) (SecretService, error)

NewSecretService NewSecretService

type SignService added in v2.2.0

type SignService interface {
	plugin.Sign
	GenToken(map[string]interface{}) (string, error)
}

func NewSignService added in v2.2.0

func NewSignService(config *config.CloudConfig) (SignService, error)

type SyncService

type SyncService interface {
	Report(namespace, name string, report specV1.Report) (specV1.Delta, error)
	Desire(namespace string, infos []specV1.ResourceInfo, metadata map[string]string) ([]specV1.ResourceValue, error)
}

SyncService sync service

func NewSyncService

func NewSyncService(config *config.CloudConfig) (SyncService, error)

NewSyncService new SyncService

type SyncServiceImpl

type SyncServiceImpl struct {
	ConfigService ConfigService
	NodeService   NodeService
	AppService    ApplicationService
	SecretService SecretService
	ObjectService ObjectService
	Hooks         map[string]interface{}
}

func (*SyncServiceImpl) Desire

func (t *SyncServiceImpl) Desire(namespace string, crdInfos []specV1.ResourceInfo, metadata map[string]string) ([]specV1.ResourceValue, error)

func (*SyncServiceImpl) PopulateConfig

func (t *SyncServiceImpl) PopulateConfig(cfg *specV1.Configuration, metadata map[string]string) error

func (*SyncServiceImpl) PopulateConfigObject

func (t *SyncServiceImpl) PopulateConfigObject(k, v string, cfg *specV1.Configuration) error

func (*SyncServiceImpl) Report

func (t *SyncServiceImpl) Report(namespace, name string, report specV1.Report) (specV1.Delta, error)

type SystemAppService added in v2.2.0

type SystemAppService interface {
	GenApps(tx interface{}, ns string, nodeName *specV1.Node) ([]*specV1.Application, error)
	GetOptionalApps() []string
	GenOptionalApps(tx interface{}, ns string, node *specV1.Node, apps []string) ([]*specV1.Application, error)
}

func NewSystemAppService added in v2.2.0

func NewSystemAppService(config *config.CloudConfig) (SystemAppService, error)

type SystemAppServiceImpl added in v2.2.0

type SystemAppServiceImpl struct {
	Property        PropertyService
	TemplateService TemplateService
	PKI             PKIService
	*AppCombinedService
	Hooks            map[string]interface{}
	OptionalAppFuncs map[string]GenAppFunc
	// contains filtered or unexported fields
}

func (*SystemAppServiceImpl) GenApp added in v2.2.0

func (s *SystemAppServiceImpl) GenApp(tx interface{}, ns, template string, params map[string]interface{}) (*specV1.Application, error)

func (*SystemAppServiceImpl) GenApps added in v2.2.0

func (s *SystemAppServiceImpl) GenApps(tx interface{}, ns string, node *specV1.Node) ([]*specV1.Application, error)

func (*SystemAppServiceImpl) GenConfig added in v2.2.0

func (s *SystemAppServiceImpl) GenConfig(tx interface{}, ns, template string, params map[string]interface{}) (*specV1.Configuration, error)

func (*SystemAppServiceImpl) GenOptionalApps added in v2.2.0

func (s *SystemAppServiceImpl) GenOptionalApps(tx interface{}, ns string, node *specV1.Node, appAlias []string) ([]*specV1.Application, error)

func (*SystemAppServiceImpl) GenSystemRegistry added in v2.3.0

func (s *SystemAppServiceImpl) GenSystemRegistry(tx interface{}, ns, registryAuth string) (string, error)

func (*SystemAppServiceImpl) GetOptionalApps added in v2.2.0

func (s *SystemAppServiceImpl) GetOptionalApps() []string

type TaskService added in v2.2.0

type TaskService interface {
	task.TaskProducer
	task.TaskWorker
}

func NewTaskService added in v2.2.0

func NewTaskService(config *config.CloudConfig) (TaskService, error)

NewTaskService NewTaskService

type TemplateService

type TemplateService interface {
	Execute(name, text string, params map[string]interface{}) ([]byte, error)
	GetTemplate(filename string) (string, error)
	ParseTemplate(filename string, params map[string]interface{}) ([]byte, error)
	UnmarshalTemplate(filename string, params map[string]interface{}, out interface{}) error
}

func NewTemplateService

func NewTemplateService(cfg *config.CloudConfig, funcs map[string]interface{}) (TemplateService, error)

type TemplateServiceImpl

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

TemplateServiceImpl is a service to read and parse template files.

func (*TemplateServiceImpl) Execute

func (s *TemplateServiceImpl) Execute(name, text string, params map[string]interface{}) ([]byte, error)

func (*TemplateServiceImpl) GetTemplate

func (s *TemplateServiceImpl) GetTemplate(filename string) (string, error)

func (*TemplateServiceImpl) ParseTemplate

func (s *TemplateServiceImpl) ParseTemplate(filename string, params map[string]interface{}) ([]byte, error)

func (*TemplateServiceImpl) UnmarshalTemplate

func (s *TemplateServiceImpl) UnmarshalTemplate(filename string, params map[string]interface{}, out interface{}) error

type WrapperService added in v2.2.0

type WrapperService interface {
	CreateNodeTx(CreateNodeFunc) CreateNodeFunc
}

func NewWrapperService added in v2.2.0

func NewWrapperService(config *config.CloudConfig) (WrapperService, error)

type WrapperServiceImpl added in v2.2.0

type WrapperServiceImpl struct {
	plugin.TransactionFactory
}

func (*WrapperServiceImpl) Close added in v2.2.0

func (w *WrapperServiceImpl) Close(tx interface{})

func (*WrapperServiceImpl) CreateNodeTx added in v2.2.0

func (w *WrapperServiceImpl) CreateNodeTx(function CreateNodeFunc) CreateNodeFunc

func (*WrapperServiceImpl) FinishTx added in v2.2.0

func (w *WrapperServiceImpl) FinishTx(err error, tx interface{})

Jump to

Keyboard shortcuts

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