engine

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 61 Imported by: 2

Documentation

Overview

Implementation of package orchestration engine The engine is independent of k8s runtime (k8s apiserver integration is in apiserver module)

Index

Constants

View Source
const (
	OptimisticLockErrorMsg = "the object has been modified; please apply your changes to the latest version and try again"
)

Variables

This section is empty.

Functions

func ExtractContextConfigMap added in v0.0.12

func ExtractContextConfigMap(resources map[string]string) (*unstructured.Unstructured, error)

ExtractContextConfigMap returns the package-context configmap, if found

func GeneratePatch

func GeneratePatch(fileName string, oldV, newV string) (api.PatchSpec, error)

GeneratePatch returns patch operations for transforming from oldV to newV.

func NewWatcherManager added in v0.0.12

func NewWatcherManager() *watcherManager

Types

type CaDEngine

type CaDEngine interface {
	// ObjectCache() is a cache of all our objects.
	ObjectCache() WatcherManager

	UpdatePackageResources(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision, old, new *api.PackageRevisionResources) (*PackageRevision, *api.RenderStatus, error)
	ListFunctions(ctx context.Context, repositoryObj *configapi.Repository) ([]*Function, error)

	ListPackageRevisions(ctx context.Context, repositorySpec *configapi.Repository, filter repository.ListPackageRevisionFilter) ([]*PackageRevision, error)
	CreatePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, obj *api.PackageRevision, parent *PackageRevision) (*PackageRevision, error)
	UpdatePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision, old, new *api.PackageRevision, parent *PackageRevision) (*PackageRevision, error)
	DeletePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, obj *PackageRevision) error

	ListPackages(ctx context.Context, repositorySpec *configapi.Repository, filter repository.ListPackageFilter) ([]*Package, error)
	CreatePackage(ctx context.Context, repositoryObj *configapi.Repository, obj *api.Package) (*Package, error)
	UpdatePackage(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *Package, old, new *api.Package) (*Package, error)
	DeletePackage(ctx context.Context, repositoryObj *configapi.Repository, obj *Package) error
}

func NewCaDEngine

func NewCaDEngine(opts ...EngineOption) (CaDEngine, error)

type EngineOption

type EngineOption interface {
	// contains filtered or unexported methods
}

func WithBuiltinFunctionRuntime

func WithBuiltinFunctionRuntime() EngineOption

func WithCache

func WithCache(cache *cache.Cache) EngineOption

func WithCredentialResolver

func WithCredentialResolver(resolver repository.CredentialResolver) EngineOption

func WithFunctionRuntime

func WithFunctionRuntime(runtime fn.FunctionRuntime) EngineOption

func WithGRPCFunctionRuntime

func WithGRPCFunctionRuntime(address string) EngineOption

func WithMetadataStore added in v0.0.12

func WithMetadataStore(metadataStore meta.MetadataStore) EngineOption

func WithReferenceResolver

func WithReferenceResolver(resolver ReferenceResolver) EngineOption

func WithRunnerOptions added in v0.0.12

func WithRunnerOptions(options fnruntime.RunnerOptions) EngineOption

func WithRunnerOptionsResolver added in v0.0.12

func WithRunnerOptionsResolver(fn func(namespace string) fnruntime.RunnerOptions) EngineOption

func WithSimpleFunctionRuntime

func WithSimpleFunctionRuntime() EngineOption

func WithUserInfoProvider

func WithUserInfoProvider(provider repository.UserInfoProvider) EngineOption

func WithWatcherManager added in v0.0.12

func WithWatcherManager(watcherManager *watcherManager) EngineOption

type EngineOptionFunc

type EngineOptionFunc func(engine *cadEngine) error

type Function added in v0.0.12

type Function struct {
	RepoFunction repository.Function
}

func (*Function) GetFunction added in v0.0.12

func (f *Function) GetFunction() (*api.Function, error)

func (*Function) Name added in v0.0.12

func (f *Function) Name() string

type NodeToMapWriter

type NodeToMapWriter struct {
	Resources map[string]string
}

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

type ObjectWatcher added in v0.0.12

type ObjectWatcher interface {
	OnPackageRevisionChange(eventType watch.EventType, obj repository.PackageRevision, objMeta meta.PackageRevisionMeta) bool
}

PackageRevisionWatcher is the callback interface for watchers.

type Package added in v0.0.12

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

func (*Package) GetPackage added in v0.0.12

func (p *Package) GetPackage() *api.Package

func (*Package) KubeObjectName added in v0.0.12

func (p *Package) KubeObjectName() string

type PackageFetcher

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

func (*PackageFetcher) FetchResources

func (p *PackageFetcher) FetchResources(ctx context.Context, packageRef *api.PackageRevisionRef, namespace string) (*api.PackageRevisionResources, error)

func (*PackageFetcher) FetchRevision

func (p *PackageFetcher) FetchRevision(ctx context.Context, packageRef *api.PackageRevisionRef, namespace string) (repository.PackageRevision, error)

type PackageRevision added in v0.0.12

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

func ToPackageRevision added in v0.0.12

func ToPackageRevision(pkgRev repository.PackageRevision, pkgRevMeta meta.PackageRevisionMeta) *PackageRevision

TODO: This is a bit awkward, and we should see if there is a way to avoid having to expose this function. Any functionality that requires creating new engine.PackageRevision resources should be in the engine package.

func (*PackageRevision) GetPackageRevision added in v0.0.12

func (p *PackageRevision) GetPackageRevision(ctx context.Context) (*api.PackageRevision, error)

func (*PackageRevision) GetResources added in v0.0.12

func (*PackageRevision) KubeObjectName added in v0.0.12

func (p *PackageRevision) KubeObjectName() string

type ReferenceResolver

type ReferenceResolver interface {
	ResolveReference(ctx context.Context, namespace, name string, result Object) error
}

type RepositoryOpener added in v0.0.12

type RepositoryOpener interface {
	OpenRepository(ctx context.Context, repositorySpec *configapi.Repository) (repository.Repository, error)
}

type WatcherManager added in v0.0.12

type WatcherManager interface {
	WatchPackageRevisions(ctx context.Context, filter repository.ListPackageRevisionFilter, callback ObjectWatcher) error
}

ObjectCache caches objects across repositories, and allows for watching.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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