Documentation
¶
Index ¶
- func ContextWithPackageRevisionCache(ctx context.Context, cache PackageRevisionCache) context.Context
- func NextRevisionNumber(revs []string) (string, error)
- func ToApiConditions(kf kptfile.KptFile) []api.Condition
- func ToApiReadinessGates(kf kptfile.KptFile) []api.ReadinessGate
- func ValidateWorkspaceName(workspace v1alpha1.WorkspaceName) error
- type CachedIdentifier
- type Credential
- type CredentialResolver
- type Function
- type FunctionRepository
- type ListPackageFilter
- type ListPackageRevisionFilter
- type Package
- type PackageDraft
- type PackageKey
- type PackageResources
- type PackageRevision
- type PackageRevisionCache
- type PackageRevisionCacheEntry
- type PackageRevisionKey
- type Repository
- type UserInfo
- type UserInfoProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithPackageRevisionCache ¶ added in v0.0.32
func ContextWithPackageRevisionCache(ctx context.Context, cache PackageRevisionCache) context.Context
func NextRevisionNumber ¶ added in v0.0.12
func ToApiReadinessGates ¶ added in v0.0.12
func ToApiReadinessGates(kf kptfile.KptFile) []api.ReadinessGate
func ValidateWorkspaceName ¶ added in v0.0.12
func ValidateWorkspaceName(workspace v1alpha1.WorkspaceName) error
ValidateWorkspaceName validates WorkspaceName. It must:
- be at least 1 and at most 63 characters long
- contain only lowercase alphanumeric characters or '-'
- start and end with an alphanumeric character.
'/ ' should never be allowed, because we use '/' to delimit branch names (e.g. the 'drafts/' prefix).
Types ¶
type CachedIdentifier ¶ added in v0.0.32
type CachedIdentifier struct {
// Key uniquely identifies the resource in the underlying storage
Key string
// Version uniquely identifies the version of the resource in the underlying storage
Version string
}
CachedIdentier is a used by a cache and underlying storage implementation to avoid unnecessary reloads
type Credential ¶
type Credential interface {
Valid() bool
ToAuthMethod() transport.AuthMethod
}
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)
GetCRD() (*configapi.Function, error)
}
Function is an abstract function.
type FunctionRepository ¶
type ListPackageFilter ¶ added in v0.0.10
type ListPackageFilter struct {
// KubeObjectName matches the generated kubernetes object name.
KubeObjectName string
// Package matches the name of the package (spec.package)
Package string
}
ListPackageFilter is a predicate for filtering Package objects; only matching Package objects will be returned.
func (*ListPackageFilter) Matches ¶ added in v0.0.10
func (f *ListPackageFilter) Matches(p Package) bool
Matches returns true if the provided Package satisfies the conditions in the filter.
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
// WorkspaceName matches the description of the package (spec.workspaceName)
WorkspaceName v1alpha1.WorkspaceName
// 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 ¶
func (f *ListPackageRevisionFilter) Matches(p PackageRevision) bool
Matches returns true if the provided PackageRevision satisfies the conditions in the filter.
type Package ¶ added in v0.0.10
type Package 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() PackageKey
// GetPackage returns the object representing this package
GetPackage() *v1alpha1.Package
// GetLatestRevision returns the name of the package revision that is the "latest" package
// revision belonging to this package
GetLatestRevision() string
}
Package is an abstract package.
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 PackageKey ¶ added in v0.0.10
type PackageKey struct {
Repository, Package string
}
func (PackageKey) String ¶ added in v0.0.10
func (n PackageKey) String() string
type PackageResources ¶
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
// KubeObjectNamespace returns the namespace in which the PackageRevision
// belongs.
KubeObjectNamespace() string
// UID returns a unique identifier for the PackageRevision.
UID() types.UID
// Key returns the "primary key" of the package.
Key() PackageRevisionKey
// CachedIdentier returns a unique identifer for this package revision and version
CachedIdentifier() CachedIdentifier
// Lifecycle returns the current lifecycle state of the package.
Lifecycle() v1alpha1.PackageRevisionLifecycle
// UpdateLifecycle updates the desired lifecycle of the package. This can only
// be used for Published package revisions to go from Published to DeletionProposed
// or vice versa. Draft revisions should use PackageDraft.UpdateLifecycle.
UpdateLifecycle(ctx context.Context, new v1alpha1.PackageRevisionLifecycle) error
// GetPackageRevision returns the PackageRevision ("DRY") API representation of this package-revision
GetPackageRevision(context.Context) (*v1alpha1.PackageRevision, error)
// GetResources returns the PackageRevisionResources ("WET") API representation of this package-revision
// TODO: return PackageResources or filesystem abstraction?
GetResources(context.Context) (*v1alpha1.PackageRevisionResources, error)
// GetUpstreamLock returns the kpt lock information.
GetUpstreamLock(context.Context) (kptfile.Upstream, kptfile.UpstreamLock, error)
// GetKptfile returns the Kptfile for hte package
GetKptfile(context.Context) (kptfile.KptFile, error)
// GetLock returns the current revision's lock information.
// This will be the upstream info for downstream revisions.
GetLock() (kptfile.Upstream, kptfile.UpstreamLock, error)
// ResourceVersion returns the Kube resource version of the package
ResourceVersion() string
}
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 PackageRevisionCache ¶ added in v0.0.32
type PackageRevisionCache map[string]PackageRevisionCacheEntry
func PackageRevisionCacheFromContext ¶ added in v0.0.32
func PackageRevisionCacheFromContext(ctx context.Context) PackageRevisionCache
type PackageRevisionCacheEntry ¶ added in v0.0.32
type PackageRevisionCacheEntry struct {
Version string
PackageRevision PackageRevision
}
type PackageRevisionKey ¶
type PackageRevisionKey struct {
Repository, Package, Revision string
WorkspaceName v1alpha1.WorkspaceName
}
func (PackageRevisionKey) String ¶
func (n PackageRevisionKey) String() string
type Repository ¶
type Repository interface {
// ListPackageRevisions lists the existing package revisions in the repository
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
// UpdatePackageRevision updates a package
UpdatePackageRevision(ctx context.Context, old PackageRevision) (PackageDraft, error)
// ListPackages lists all packages in the repository
ListPackages(ctx context.Context, filter ListPackageFilter) ([]Package, error)
// CreatePackage creates a new package
CreatePackage(ctx context.Context, obj *v1alpha1.Package) (Package, error)
// DeletePackage deletes a package
DeletePackage(ctx context.Context, old Package) error
// Version returns a string that is guaranteed to be different if any change has been made to the repo contents
Version(ctx context.Context) (string, error)
// Close cleans up any resources associated with the repository
Close() error
}
Repository is the interface for interacting with packages in repositories TODO: we may need interface to manage repositories too. Stay tuned.
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.