engine

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 61 Imported by: 0

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

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

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.PorchPackage) (*Package, error)
	UpdatePackage(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *Package, old, new *api.PorchPackage) (*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

func WithMetadataStore(metadataStore meta.MetadataStore) EngineOption

func WithReferenceResolver

func WithReferenceResolver(resolver ReferenceResolver) EngineOption

func WithRunnerOptions

func WithRunnerOptions(options fnruntime.RunnerOptions) EngineOption

func WithRunnerOptionsResolver

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

func WithSimpleFunctionRuntime

func WithSimpleFunctionRuntime() EngineOption

func WithUserInfoProvider

func WithUserInfoProvider(provider repository.UserInfoProvider) EngineOption

func WithWatcherManager

func WithWatcherManager(watcherManager *watcherManager) EngineOption

type EngineOptionFunc

type EngineOptionFunc func(engine *cadEngine) error

type Function

type Function struct {
	RepoFunction repository.Function
}

func (*Function) GetFunction

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

func (*Function) Name

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

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

PackageRevisionWatcher is the callback interface for watchers.

type Package

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

func (*Package) GetPackage

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

func (*Package) KubeObjectName

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

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

func ToPackageRevision

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

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

func (*PackageRevision) GetResources

func (*PackageRevision) KubeObjectName

func (p *PackageRevision) KubeObjectName() string

type ReferenceResolver

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

type RepositoryOpener

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

type WatcherManager

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