repository

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 4 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	// TODO: support different credential types
	Data map[string][]byte
}

type CredentialResolver

type CredentialResolver interface {
	ResolveCredential(ctx context.Context, namespace, name string) (Credential, error)
}

type Function

type Function interface {
	Name() string
	GetFunction() (*v1alpha1.Function, error)
}

Function is an abstract function.

type FunctionRepository

type FunctionRepository interface {
	// TODO: Should repository understand functions, or just packages (and function is just a package in an OCI repo?)
	ListFunctions(ctx context.Context) ([]Function, error)
}

type ListPackageRevisionFilter

type ListPackageRevisionFilter struct {
	// KubeObjectName matches the generated kubernetes object name.
	KubeObjectName string

	// Package matches the name of the package (spec.package)
	Package string

	// Revision matches the revision of the package (spec.revision)
	Revision string
}

ListPackageRevisionFilter is a predicate for filtering PackageRevision objects; only matching PackageRevision objects will be returned.

func (*ListPackageRevisionFilter) Matches

Matches returns true if the provided PackageRevision satisifies the conditions in the filter.

type PackageDraft

type PackageDraft interface {
	UpdateResources(ctx context.Context, new *v1alpha1.PackageRevisionResources, task *v1alpha1.Task) error
	// Updates desired lifecycle of the package. The lifecycle is applied on Close.
	UpdateLifecycle(ctx context.Context, new v1alpha1.PackageRevisionLifecycle) error
	// Finish round of updates.
	Close(ctx context.Context) (PackageRevision, error)
}

type PackageResources

type PackageResources struct {
	Contents map[string]string
}

TODO: "sigs.k8s.io/kustomize/kyaml/filesys" FileSystem?

type PackageRevision

type PackageRevision interface {
	// KubeObjectName returns an encoded name for the object that should be unique.
	// More "readable" values are returned by Key()
	KubeObjectName() string

	// Key returns the "primary key" of the package.
	Key() PackageRevisionKey

	// Lifecycle returns the current lifecycle state of the package.
	Lifecycle() v1alpha1.PackageRevisionLifecycle

	// GetPackageRevision returns the PackageRevision ("DRY") API representation of this package-revision
	GetPackageRevision() *v1alpha1.PackageRevision

	// GetResources returns the PackageRevisionResources ("WET") API representation of this package-revision
	// TODO: return PackageResources or filesystem abstraction?
	GetResources(ctx context.Context) (*v1alpha1.PackageRevisionResources, error)

	// GetUpstreamLock returns the kpt lock information.
	GetUpstreamLock() (kptfile.Upstream, kptfile.UpstreamLock, error)
}

PackageRevision is an abstract package version. We have a single object for both Revision and Resources, because conceptually they are one object. The best way we've found (so far) to represent them in k8s is as two resources, but they map to the same object. Interesting reading: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#differing-representations

type PackageRevisionKey

type PackageRevisionKey struct {
	Repository, Package, Revision string
}

func (PackageRevisionKey) String

func (n PackageRevisionKey) String() string

type Repository

type Repository interface {
	ListPackageRevisions(ctx context.Context, filter ListPackageRevisionFilter) ([]PackageRevision, error)

	// CreatePackageRevision creates a new package revision
	CreatePackageRevision(ctx context.Context, obj *v1alpha1.PackageRevision) (PackageDraft, error)

	// DeletePackageRevision deletes a package revision
	DeletePackageRevision(ctx context.Context, old PackageRevision) error

	// UpdatePackage updates a package
	UpdatePackage(ctx context.Context, old PackageRevision) (PackageDraft, error)
}

Repository is the interface for interacting with packages in repositories TODO: we may need interface to manage repositories too. Stay tuned.

type UserInfo

type UserInfo struct {
	Name  string
	Email string
}

type UserInfoProvider

type UserInfoProvider interface {
	// GetUserInfo returns the information about the user on whose behalf the request is being
	// processed, if any. If user cannot be determnined, returns nil.
	GetUserInfo(ctx context.Context) *UserInfo
}

UserInfoProvider providers name of the authenticated user on whose behalf the request is being processed.

Jump to

Keyboard shortcuts

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