task

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GitlabWebhookIndexEventType = "headers.X-Gitlab-Event"
	GitlabWebhookIndexRef       = "event.body.ref"
)
View Source
const (
	ConfigMapNameClustersUsageCache = "clusters-usage-cache"
)

Variables

View Source
var (
	// NewFunctionMapDeployment stores the new method of the deployment component.
	NewFunctionMapDeployment = map[string]component.NewDeployment{}
	// NewFunctionMapMultiTenant stores the new method of the multi tenant component.
	NewFunctionMapMultiTenant = map[string]component.NewMultiTenant{}
	// NewFunctionMapSecretManagement stores the new method of the secret management component.
	NewFunctionMapSecretManagement = map[string]component.NewSecretManagement{}
	// NewFunctionMapSecretSync stores the new method of the secret sync component.
	NewFunctionMapSecretSync = map[string]component.NewSecretSync{}
	// NewFunctionMapGateway stores the new method of the gateway component.
	NewFunctionMapGateway = map[string]component.NewGateway{}
	// NewFunctionMapEventListener stores the new method of the event listener component.
	NewFunctionMapEventListener = map[string]component.NewEventListener{}
	// ComponentFactoryMapPipeline stores the object of pipeline factory.
	ComponentFactoryMapPipeline = map[string]component.PipelineFactory{}
)
View Source
var (

	// NewSnapshot is the method for generating a snapshot of the nautes resource.
	NewSnapshot = database.NewRuntimeSnapshot
	// NewSearchEngine is the method for generating a event source search engine.
	NewSearchEngine = requestvar.NewSearchEngine
)

Functions

func AccountIsRemovable

func AccountIsRemovable(usage cache.AccountUsage, accountName, runtimeName string) bool

func CreateProduct

func CreateProduct(ctx context.Context, productID, productName string, components component.ComponentList) error

func DeleteProduct

func DeleteProduct(ctx context.Context, productID, productName string, components component.ComponentList) error

func DeleteProductAccount

func DeleteProductAccount(ctx context.Context, account component.MachineAccount, components component.ComponentList) error

func GetEventSourceFromEventSourceSet

func GetEventSourceFromEventSourceSet(esSet component.EventSourceSet, name string) (*component.EventSource, error)

func GetRawStatus

func GetRawStatus(componentType component.ComponentType, statuses map[string]pkgruntime.RawExtension) []byte

Types

type ComponentsStatus

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

func NewComponentStatus

func NewComponentStatus() *ComponentsStatus

type DeploymentRuntimeDeployer

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

func (*DeploymentRuntimeDeployer) Delete

func (drd *DeploymentRuntimeDeployer) Delete(ctx context.Context) (interface{}, error)

func (*DeploymentRuntimeDeployer) Deploy

func (drd *DeploymentRuntimeDeployer) Deploy(ctx context.Context) (interface{}, error)

func (*DeploymentRuntimeDeployer) GetPermissionsFromRuntime

func (drd *DeploymentRuntimeDeployer) GetPermissionsFromRuntime() []component.SecretInfo

type DeploymentRuntimeSyncHistory

type DeploymentRuntimeSyncHistory struct {
	// Cluster is the name of the cluster where the runtime is deployed.
	Cluster string `json:"cluster,omitempty"`
	// Spaces is a list of spaces that have been used by the runtime.
	Spaces utils.StringSet `json:"spaces,omitempty"`
	// Account is the machine account name used by the runtime.
	Account *component.MachineAccount `json:"account,omitempty"`
	// Permissions records the access permissions of the Runtime machine account for how many key information items it possesses.
	Permissions []component.SecretInfo `json:"permissions,omitempty"`
}

DeploymentRuntimeSyncHistory records the deployment information of the deployment runtime.

type NewHandler

type NewHandler func(info *component.ComponentInitInfo) (ResourceRequestHandler, error)
var NewFunctionHandler NewHandler

NewFunctionHandler is a method that can generate a ResourceRequestHandler.

type NewTaskPerformer

type NewTaskPerformer func(initInfo performerInitInfos) (taskPerformer, error)

NewTaskPerformer will generate a taskPerformer instance.

type PipelineRuntimeDeployer

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

func (*PipelineRuntimeDeployer) Delete

func (prd *PipelineRuntimeDeployer) Delete(ctx context.Context) (interface{}, error)

func (*PipelineRuntimeDeployer) Deploy

func (prd *PipelineRuntimeDeployer) Deploy(ctx context.Context) (interface{}, error)

func (*PipelineRuntimeDeployer) GetPermissionsFromRuntime

func (prd *PipelineRuntimeDeployer) GetPermissionsFromRuntime() []component.SecretInfo

type PipelineRuntimeSyncHistory

type PipelineRuntimeSyncHistory struct {
	// Cluster is the name of the cluster where the runtime is located.
	Cluster string `json:"cluster,omitempty"`
	// Space is the name of the space deployed by the runtime.
	Space *component.Space `json:"space,omitempty"`
	// CodeRepo is the name of the CodeRepo where the pipeline file is located.
	CodeRepo string `json:"codeRepo,omitempty"`
	// UniqueID is the index of the event source collection.
	UniqueID string `json:"uniqueID,omitempty"`
	// Account is the information of the machine account used by the runtime.
	Account *component.MachineAccount `json:"account,omitempty"`
	// App is the information of the resources deployed by the runtime.
	App *component.Application `json:"app,omitempty"`
	// Permissions records the access permissions of the Runtime machine account for how many key information items it possesses.
	Permissions []component.SecretInfo `json:"permissions,omitempty"`
	// HookResources records the resources that need to be deployed in order for the hook to run in the space.
	HookResources []component.RequestResource `json:"HookResources,omitempty"`
}

PipelineRuntimeSyncHistory records the deployment information of pipeline runtime.

type ResourceRequestHandler

type ResourceRequestHandler interface {
	CreateResource(ctx context.Context, space component.Space, authInfo component.AuthInfo, req component.RequestResource) error
	DeleteResource(ctx context.Context, space component.Space, req component.RequestResource) error
}

ResourceRequestHandler can directly deploy specific resources in the environment based on the requested data type.

type Syncer

type Syncer struct {
	KubernetesClient client.Client
	PluginMgr        component.PipelinePluginManager
}

Syncer can create tasks based on environment information and runtime.

func (*Syncer) NewTask

func (s *Syncer) NewTask(ctx context.Context, runtime v1alpha1.Runtime, componentsStatus *pkgruntime.RawExtension) (*Task, error)

NewTask loads nautes resources from tenant cluster and initializes components. It will do the following things: 1.Get NautesConfig. 2.Get all the resources related to the product. 3.Get the cluster corresponding to the runtime. 4.Get the access method of the cluster. 5.Initialize all related components. 6.Create a taskPerformer based on the runtime type. 7.Return the task.

type Task

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

Task is the definition of runtime deployment tasks, which contains the objects required for deploying the runtime.

func (*Task) CleanUp

func (t *Task) CleanUp()

CleanUp will call the CleanUp method of all components to complete the task cleanup.

func (*Task) Delete

func (t *Task) Delete(ctx context.Context) (*pkgruntime.RawExtension, error)

func (*Task) Run

func (t *Task) Run(ctx context.Context) (*pkgruntime.RawExtension, error)

func (*Task) UpdateComponentCache

func (t *Task) UpdateComponentCache()

UpdateComponentCache will update the cache of the component to the cluster resource where the runtime is located.

type UsageController

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

func (*UsageController) GetProductUsage

func (cuc *UsageController) GetProductUsage(ctx context.Context, productID string) (*cache.ProductUsage, error)

func (*UsageController) GetUsage

func (cuc *UsageController) GetUsage(ctx context.Context) (*cache.ClusterUsage, error)

func (*UsageController) UpdateProductUsage

func (cuc *UsageController) UpdateProductUsage(ctx context.Context, productID string, usage cache.ProductUsage) error

Jump to

Keyboard shortcuts

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