registry

package
v2.0.0-...-f0a61fb Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplacesMode = iota
	SemVerMode
	SkipPatchMode
)
View Source
const (
	GVKType        = "olm.gvk"
	PackageType    = "olm.package"
	DeprecatedType = "olm.deprecated"
	LabelType      = "olm.label"
	PropertyKey    = "olm.properties"
	ConstraintType = "olm.constraint"
)
View Source
const (
	CRDKind = "CustomResourceDefinition"
)

Variables

View Source
var (
	// ErrPackageNotInDatabase is an error that describes a package not found error when querying the registry
	ErrPackageNotInDatabase = errors.New("Package not in database")

	// ErrBundleImageNotInDatabase is an error that describes a bundle image not found when querying the registry
	ErrBundleImageNotInDatabase = errors.New("Bundle Image not in database")

	// ErrRemovingDefaultChannelDuringDeprecation is an error that describes a bundle deprecation causing the deletion
	// of the default channel
	ErrRemovingDefaultChannelDuringDeprecation = errors.New("Bundle deprecation causing default channel removal")
)

Codecs provides access to encoding and decoding for the scheme

View Source
var Scheme = runtime.NewScheme()

Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered.

Functions

func BundleStringToAPIBundle

func BundleStringToAPIBundle(bundleString string) (*api.Bundle, error)

func BundleStringToObjectStrings

func BundleStringToObjectStrings(bundleString string) ([]string, error)

Bundle strings are appended json objects, we need to split them apart e.g. {"my":"obj"}{"csv":"data"}{"crd":"too"}

func ChannelEntryToAPIChannelEntry

func ChannelEntryToAPIChannelEntry(entry *ChannelEntry) *api.ChannelEntry

func ContextWithPackage

func ContextWithPackage(ctx context.Context, pkg string) context.Context

ContextWithPackage adds a package value to a context.

func DecodeFile

func DecodeFile(path string, into interface{}) error

DecodeFile decodes the file at a path into the given interface.

func DecodeUnstructured

func DecodeUnstructured(reader io.Reader) (obj *unstructured.Unstructured, err error)

DecodeUnstructured decodes a raw stream into a an unstructured.Unstructured instance.

func DefaultYAMLDecoder

func DefaultYAMLDecoder() runtime.Decoder

func ObjectsAndPropertiesFromBundle

func ObjectsAndPropertiesFromBundle(b *Bundle) ([]string, []property.Property, error)

func PackageChannelToAPIChannel

func PackageChannelToAPIChannel(channel *PackageChannel) *api.Channel

func PackageFromContext

func PackageFromContext(ctx context.Context) (string, bool)

PackageFromContext returns the package value of the context if set, returns false if unset.

func PackageManifestToAPIPackage

func PackageManifestToAPIPackage(manifest *PackageManifest) *api.Package

Types

type APIKey

type APIKey struct {
	Group   string
	Version string
	Kind    string
	Plural  string
}

APIKey stores GroupVersionKind for use as map keys

func (APIKey) String

func (k APIKey) String() string

type Annotations

type Annotations struct {
	// PackageName is the name of the overall package, ala `etcd`.
	PackageName string `json:"operators.operatorframework.io.bundle.package.v1" yaml:"operators.operatorframework.io.bundle.package.v1"`

	// Channels are a comma separated list of the declared channels for the bundle, ala `stable` or `alpha`.
	Channels string `json:"operators.operatorframework.io.bundle.channels.v1" yaml:"operators.operatorframework.io.bundle.channels.v1"`

	// DefaultChannelName is, if specified, the name of the default channel for the package. The
	// default channel will be installed if no other channel is explicitly given. If the package
	// has a single channel, then that channel is implicitly the default.
	DefaultChannelName string `` /* 127-byte string literal not displayed */
}

Annotations is a list of annotations for a given bundle

func (Annotations) SelectDefaultChannel

func (a Annotations) SelectDefaultChannel() string

type AnnotationsFile

type AnnotationsFile struct {
	// annotations is a list of annotations for a given bundle
	Annotations Annotations `json:"annotations" yaml:"annotations"`
}

AnnotationsFile holds annotation information about a bundle

func (*AnnotationsFile) GetChannels

func (a *AnnotationsFile) GetChannels() []string

GetChannels returns the channels that this bundle should be added to

func (*AnnotationsFile) GetDefaultChannelName

func (a *AnnotationsFile) GetDefaultChannelName() string

GetDefaultChannelName returns the name of the default channel

func (*AnnotationsFile) GetName

func (a *AnnotationsFile) GetName() string

GetName returns the package name of the bundle

func (*AnnotationsFile) SelectDefaultChannel

func (a *AnnotationsFile) SelectDefaultChannel() string

SelectDefaultChannel returns the first item in channel list that is sorted in lexicographic order.

type Bundle

type Bundle struct {
	Name        string
	Objects     []*unstructured.Unstructured
	Package     string
	Channels    []string
	BundleImage string

	Dependencies []*Dependency
	Properties   []Property
	Annotations  *Annotations
	// contains filtered or unexported fields
}

func NewBundle

func NewBundle(name string, annotations *Annotations, objs ...*unstructured.Unstructured) *Bundle

func NewBundleFromStrings

func NewBundleFromStrings(name, version, pkg, defaultChannel, channels, objs string) (*Bundle, error)

func (*Bundle) Add

func (b *Bundle) Add(obj *unstructured.Unstructured)

func (*Bundle) AllProvidedAPIsInBundle

func (b *Bundle) AllProvidedAPIsInBundle() error

func (*Bundle) ClusterServiceVersion

func (b *Bundle) ClusterServiceVersion() (*ClusterServiceVersion, error)

func (*Bundle) CustomResourceDefinitions

func (b *Bundle) CustomResourceDefinitions() ([]runtime.Object, error)

func (*Bundle) Description

func (b *Bundle) Description() (string, error)

func (*Bundle) Icons

func (b *Bundle) Icons() ([]Icon, error)

func (*Bundle) Images

func (b *Bundle) Images() (map[string]struct{}, error)

func (*Bundle) ProvidedAPIs

func (b *Bundle) ProvidedAPIs() (map[APIKey]struct{}, error)

func (*Bundle) Replaces

func (b *Bundle) Replaces() (string, error)

func (*Bundle) RequiredAPIs

func (b *Bundle) RequiredAPIs() (map[APIKey]struct{}, error)

func (*Bundle) Serialize

func (b *Bundle) Serialize() (csvName, bundleImage string, csvBytes []byte, bundleBytes []byte, annotationBytes []byte, err error)

func (*Bundle) Size

func (b *Bundle) Size() int

func (*Bundle) SkipRange

func (b *Bundle) SkipRange() (string, error)

func (*Bundle) Skips

func (b *Bundle) Skips() ([]string, error)

func (*Bundle) SubstitutesFor

func (b *Bundle) SubstitutesFor() (string, error)

func (*Bundle) Version

func (b *Bundle) Version() (string, error)

type BundleGraphLoader

type BundleGraphLoader struct {
}

BundleGraphLoader generates updated graphs by adding bundles to them, updating the graph implicitly via semantic version of each bundle

func (*BundleGraphLoader) AddBundleToGraph

func (g *BundleGraphLoader) AddBundleToGraph(bundle *Bundle, graph *Package, annotations *AnnotationsFile, skippatch bool) (*Package, error)

AddBundleToGraph takes a bundle and an existing graph and updates the graph to insert the new bundle into each channel it is included in

type BundleImageAlreadyAddedErr

type BundleImageAlreadyAddedErr struct {
	ErrorString string
}

BundleImageAlreadyAddedErr is an error that describes a bundle is already added

func (BundleImageAlreadyAddedErr) Error

type BundleKey

type BundleKey struct {
	BundlePath string
	Version    string //semver string
	CsvName    string
}

func (*BundleKey) IsEmpty

func (b *BundleKey) IsEmpty() bool

func (*BundleKey) String

func (b *BundleKey) String() string

type BundleSender

type BundleSender interface {
	Send(*api.Bundle) error
}

type CelConstraint

type CelConstraint struct {
	// Constraint failure message that surfaces in resolution
	// This field is optional
	FailureMessage string `json:"failureMessage" yaml:"failureMessage"`

	// The cel struct that contraints CEL expression
	// This field is required
	Cel *constraints.Cel `json:"cel" yaml:"cel"`
}

func (*CelConstraint) Validate

func (cc *CelConstraint) Validate() []error

Validate will validate constraint type and return error(s)

type Channel

type Channel struct {
	Head  BundleKey
	Nodes map[BundleKey]map[BundleKey]struct{}
}

func (*Channel) String

func (c *Channel) String() string

type ChannelEntry

type ChannelEntry struct {
	PackageName string
	ChannelName string
	BundleName  string
	Replaces    string
}

ChannelEntry is a denormalized node in a channel graph

type ChannelEntryAnnotated

type ChannelEntryAnnotated struct {
	PackageName        string
	ChannelName        string
	BundleName         string
	BundlePath         string
	Version            string
	Replaces           string
	ReplacesVersion    string
	ReplacesBundlePath string
}

ChannelEntryAnnotated is a denormalized node in a channel graph annotated with additional entry level info

type ClusterServiceVersion

type ClusterServiceVersion struct {
	// Type metadata.
	metav1.TypeMeta `json:",inline"`

	// Object metadata.
	metav1.ObjectMeta `json:"metadata"`

	// Spec is the raw representation of the 'spec' element of
	// ClusterServiceVersion object. Since we are
	// not interested in the content of spec we are not parsing it.
	Spec json.RawMessage `json:"spec"`
}

ClusterServiceVersion is a structured representation of cluster service version object(s) specified inside the 'clusterServiceVersions' section of an operator manifest.

func ReadCSVFromBundleDirectory

func ReadCSVFromBundleDirectory(bundleDir string) (*ClusterServiceVersion, error)

ReadCSVFromBundleDirectory tries to parse every YAML file in the directory without inspecting sub-directories and returns a CSV. According to the strict one CSV per bundle rule, func returns an error if more than one CSV is found.

func (*ClusterServiceVersion) GetApiServiceDefinitions

func (csv *ClusterServiceVersion) GetApiServiceDefinitions() (owned []*DefinitionKey, required []*DefinitionKey, err error)

GetApiServiceDefinitions returns a list of owned and required APISerivces specified inside the 'apiservicedefinitions' section of a ClusterServiceVersion 'spec'.

owned represents the list of apiservices managed by this ClusterServiceVersion object. required represents the list of apiservices that this ClusterServiceVersion object depends on.

If owned or required is not defined in the spec then an empty list is returned respectively.

func (*ClusterServiceVersion) GetCustomResourceDefintions

func (csv *ClusterServiceVersion) GetCustomResourceDefintions() (owned []*DefinitionKey, required []*DefinitionKey, err error)

GetCustomResourceDefintions returns a list of owned and required CustomResourceDefinition object(s) specified inside the 'customresourcedefinitions' section of a ClusterServiceVersion 'spec'.

owned represents the list of CRD(s) managed by this ClusterServiceVersion object. required represents the list of CRD(s) that this ClusterServiceVersion object depends on.

If owned or required is not defined in the spec then an empty list is returned respectively.

func (*ClusterServiceVersion) GetDescription

func (csv *ClusterServiceVersion) GetDescription() (string, error)

GetDescription returns the description from the ClusterServiceVersion If not defined, the function returns an empty string.

func (*ClusterServiceVersion) GetIcons

func (csv *ClusterServiceVersion) GetIcons() ([]Icon, error)

GetIcons returns the icons from the ClusterServiceVersion

func (*ClusterServiceVersion) GetOperatorImages

func (csv *ClusterServiceVersion) GetOperatorImages() (map[string]struct{}, error)

GetOperatorImages returns a list of any images used to run the operator. Currently this pulls any images in the pod specs of operator deployments.

func (*ClusterServiceVersion) GetRelatedImages

func (csv *ClusterServiceVersion) GetRelatedImages() (imageSet map[string]struct{}, err error)

GetRelatedImage returns the list of associated images for the operator

func (*ClusterServiceVersion) GetReplaces

func (csv *ClusterServiceVersion) GetReplaces() (string, error)

GetReplaces returns the name of the older ClusterServiceVersion object that is replaced by this ClusterServiceVersion object.

If not defined, the function returns an empty string.

func (*ClusterServiceVersion) GetSkipRange

func (csv *ClusterServiceVersion) GetSkipRange() string

GetSkipRange returns the skiprange of the CSV

If not defined, the function returns an empty string.

func (*ClusterServiceVersion) GetSkips

func (csv *ClusterServiceVersion) GetSkips() ([]string, error)

GetSkips returns the name of the older ClusterServiceVersion objects that are skipped by this ClusterServiceVersion object.

If not defined, the function returns an empty string.

func (*ClusterServiceVersion) GetSubstitutesFor

func (csv *ClusterServiceVersion) GetSubstitutesFor() string

GetSubstitutesFor returns the name of the ClusterServiceVersion object that is substituted by this ClusterServiceVersion object.

If not defined, the function returns an empty string.

func (*ClusterServiceVersion) GetVersion

func (csv *ClusterServiceVersion) GetVersion() (string, error)

GetVersion returns the version of the CSV

If not defined, the function returns an empty string.

type DefinitionKey

type DefinitionKey struct {
	Group   string `json:"group"`
	Kind    string `json:"kind"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

DefinitionKey represents the metadata for either an APIservice or a CRD from a CSV spec

type Dependencies

type Dependencies struct {
	RawMessage []map[string]interface{} `json:"dependencies" yaml:"dependencies"`
}

type DependenciesFile

type DependenciesFile struct {
	// Dependencies is a list of dependencies for a given bundle
	Dependencies []Dependency `json:"dependencies" yaml:"dependencies"`
}

DependenciesFile holds dependency information about a bundle.

func (*DependenciesFile) GetDependencies

func (d *DependenciesFile) GetDependencies() []*Dependency

GetDependencies returns the list of dependency

type Dependency

type Dependency struct {
	// The type of dependency. This field is required.
	Type string `json:"type" yaml:"type"`

	// The serialized value of the dependency
	Value json.RawMessage `json:"value" yaml:"value"`
}

Dependency specifies a single constraint that can be satisfied by a property on another bundle.

func (*Dependency) GetType

func (e *Dependency) GetType() string

GetType returns the type of dependency

func (*Dependency) GetTypeValue

func (e *Dependency) GetTypeValue() interface{}

GetTypeValue returns the dependency object that is converted from value string

func (*Dependency) GetValue

func (e *Dependency) GetValue() string

GetValue returns the value content of dependency

type DeprecatedProperty

type DeprecatedProperty struct {
}

type DirGraphLoader

type DirGraphLoader struct {
	PackageDir           string
	CsvNameAndReplaceMap map[string]csvReplaces
	SortedCSVs           csvs // only contains bundles with version field which will be considered for skip range.
}

func NewPackageGraphLoaderFromDir

func NewPackageGraphLoaderFromDir(packageDir string) (*DirGraphLoader, error)

NewPackageGraphLoaderFromDir takes the root directory of the package in the file system.

func (*DirGraphLoader) Generate

func (g *DirGraphLoader) Generate() (*Package, error)

Generate returns Package graph by parsing through package directory assuming all bundles in the package exist.

type DirectoryPopulator

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

DirectoryPopulator loads an unpacked operator bundle from a directory into the database.

func NewDirectoryPopulator

func NewDirectoryPopulator(loader Load, graphLoader GraphLoader, querier Query, imageDirMap map[image.Reference]string, overwrittenImages map[string][]string) *DirectoryPopulator

func (*DirectoryPopulator) Populate

func (i *DirectoryPopulator) Populate(mode Mode) error

func (*DirectoryPopulator) ValidateEdgeBundlePackage

func (i *DirectoryPopulator) ValidateEdgeBundlePackage(images []*ImageInput) error

ValidateEdgeBundlePackage ensures that all bundles in the input will only skip or replace bundles in the same package.

type EmptyQuery

type EmptyQuery struct{}

EmptyQuery acts as a "zero value" implementation of the Query interface.

EmptyQuery can be used as a substitute for any operation dependent on Query.

func NewEmptyQuerier

func NewEmptyQuerier() *EmptyQuery

func (EmptyQuery) GetApisForEntry

func (EmptyQuery) GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error)

func (EmptyQuery) GetBundle

func (EmptyQuery) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error)

func (EmptyQuery) GetBundleForChannel

func (EmptyQuery) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error)

func (EmptyQuery) GetBundlePathIfExists

func (EmptyQuery) GetBundlePathIfExists(ctx context.Context, csvName string) (bundlePath string, err error)

func (EmptyQuery) GetBundlePathsForPackage

func (EmptyQuery) GetBundlePathsForPackage(ctx context.Context, pkgName string) ([]string, error)

func (EmptyQuery) GetBundleThatProvides

func (EmptyQuery) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error)

func (EmptyQuery) GetBundleThatReplaces

func (EmptyQuery) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error)

func (EmptyQuery) GetBundleVersion

func (EmptyQuery) GetBundleVersion(ctx context.Context, image string) (string, error)

func (EmptyQuery) GetBundlesForPackage

func (EmptyQuery) GetBundlesForPackage(ctx context.Context, pkgName string) (map[BundleKey]struct{}, error)

func (EmptyQuery) GetChannelEntriesFromPackage

func (EmptyQuery) GetChannelEntriesFromPackage(ctx context.Context, packageName string) ([]ChannelEntryAnnotated, error)

func (EmptyQuery) GetChannelEntriesThatProvide

func (EmptyQuery) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error)

func (EmptyQuery) GetChannelEntriesThatReplace

func (EmptyQuery) GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*ChannelEntry, err error)

func (EmptyQuery) GetCurrentCSVNameForChannel

func (EmptyQuery) GetCurrentCSVNameForChannel(ctx context.Context, pkgName, channel string) (string, error)

func (EmptyQuery) GetDefaultChannelForPackage

func (EmptyQuery) GetDefaultChannelForPackage(ctx context.Context, pkgName string) (string, error)

func (EmptyQuery) GetDefaultPackage

func (EmptyQuery) GetDefaultPackage(ctx context.Context, name string) (string, error)

func (EmptyQuery) GetDependenciesForBundle

func (EmptyQuery) GetDependenciesForBundle(ctx context.Context, name, version, path string) (dependencies []*api.Dependency, err error)

func (EmptyQuery) GetImagesForBundle

func (EmptyQuery) GetImagesForBundle(ctx context.Context, bundleName string) ([]string, error)

func (EmptyQuery) GetLatestChannelEntriesThatProvide

func (EmptyQuery) GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error)

func (EmptyQuery) GetPackage

func (EmptyQuery) GetPackage(ctx context.Context, name string) (*PackageManifest, error)

func (EmptyQuery) ListBundles

func (EmptyQuery) ListBundles(ctx context.Context) ([]*api.Bundle, error)

func (EmptyQuery) ListChannels

func (EmptyQuery) ListChannels(ctx context.Context, pkgName string) ([]string, error)

func (EmptyQuery) ListImages

func (EmptyQuery) ListImages(ctx context.Context) ([]string, error)

func (EmptyQuery) ListPackages

func (EmptyQuery) ListPackages(ctx context.Context) ([]string, error)

func (EmptyQuery) ListRegistryBundles

func (EmptyQuery) ListRegistryBundles(ctx context.Context) ([]*Bundle, error)

func (EmptyQuery) ListTables

func (EmptyQuery) ListTables(ctx context.Context) ([]string, error)

func (EmptyQuery) SendBundles

func (EmptyQuery) SendBundles(ctx context.Context, stream BundleSender) error

type GRPCQuery

type GRPCQuery interface {
	// List all available package names in the index
	ListPackages(ctx context.Context) ([]string, error)

	// Sends all available bundles in the index
	SendBundles(ctx context.Context, stream BundleSender) error

	// List all available bundles in the index
	ListBundles(ctx context.Context) (bundles []*api.Bundle, err error)

	// Get a package by name from the index
	GetPackage(ctx context.Context, name string) (*PackageManifest, error)

	// Get a bundle by its package name, channel name and csv name from the index
	GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error)

	// Get the bundle in the specified package at the head of the
	// specified channel. DEPRECATED. Returned bundles may have
	// only the "name" and "csvJson" fields populated in order to
	// support legacy usage.
	GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error)

	// Get all channel entries that say they replace this one
	GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*ChannelEntry, err error)

	// Get the bundle in a package/channel that replace this one
	GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error)

	// Get all channel entries that provide an api
	GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error)

	// Get latest channel entries that provide an api
	GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error)

	// Get the the latest bundle that provides the API in a default channel
	GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error)
}

type GVKDependency

type GVKDependency struct {
	// The group of GVK based dependency
	Group string `json:"group" yaml:"group"`

	// The kind of GVK based dependency
	Kind string `json:"kind" yaml:"kind"`

	// The version of GVK based dependency
	Version string `json:"version" yaml:"version"`
}

func (*GVKDependency) Validate

func (gd *GVKDependency) Validate() []error

Validate will validate GVK dependency type and return error(s)

type GVKProperty

type GVKProperty struct {
	// The group of GVK based property
	Group string `json:"group" yaml:"group"`

	// The kind of GVK based property
	Kind string `json:"kind" yaml:"kind"`

	// The version of the API
	Version string `json:"version" yaml:"version"`
}

type GraphLoader

type GraphLoader interface {
	Generate(packageName string) (*Package, error)
}

GraphLoader generates a graph GraphLoader supports multiple different loading schemes GraphLoader from SQL, GraphLoader from old format (filesystem), GraphLoader from SQL + input bundles

type HeadOverwriter

type HeadOverwriter interface {
	RemoveOverwrittenChannelHead(pkg, bundle string) error
}

type Icon

type Icon struct {
	MediaType  string `json:"mediatype"`
	Base64data []byte `json:"base64data"`
}

type ImageInput

type ImageInput struct {
	Bundle *Bundle
	// contains filtered or unexported fields
}

func NewImageInput

func NewImageInput(to image.Reference, from string) (*ImageInput, error)

type LabelDependency

type LabelDependency struct {
	// The Label name of dependency
	Label string `json:"label" yaml:"label"`
}

func (*LabelDependency) Validate

func (ld *LabelDependency) Validate() []error

Validate will validate Label dependency type and return error(s)

type LabelProperty

type LabelProperty struct {
	// The name of Label
	Label string `json:"label" yaml:"label"`
}

type Load

type Load interface {
	AddOperatorBundle(bundle *Bundle) error
	AddBundleSemver(graph *Package, bundle *Bundle) error
	AddPackageChannels(manifest PackageManifest) error
	AddBundlePackageChannels(manifest PackageManifest, bundle *Bundle) error
	RemovePackage(packageName string) error
	RemoveStrandedBundles() error
	DeprecateBundle(path string) error
	ClearNonHeadBundles() error
}

type Mode

type Mode int

func GetModeFromString

func GetModeFromString(mode string) (Mode, error)

type OverwriteErr

type OverwriteErr struct {
	ErrorString string
}

OverwritesErr is an error that describes that an error with the add request with --force enabled.

func (OverwriteErr) Error

func (e OverwriteErr) Error() string

type Package

type Package struct {
	Name           string
	DefaultChannel string
	Channels       map[string]Channel
}

func (*Package) HasChannel

func (p *Package) HasChannel(channel string) bool

func (*Package) HasCsv

func (p *Package) HasCsv(csv string) bool

func (*Package) String

func (p *Package) String() string

type PackageChannel

type PackageChannel struct {
	// Name is the name of the channel, e.g. `alpha` or `stable`
	Name string `json:"name" yaml:"name"`

	// CurrentCSVName defines a reference to the CSV holding the version of this package currently
	// for the channel.
	CurrentCSVName string `json:"currentCSV" yaml:"currentCSV"`
}

PackageChannel defines a single channel under a package, pointing to a version of that package.

func (PackageChannel) IsDefaultChannel

func (pc PackageChannel) IsDefaultChannel(pm PackageManifest) bool

IsDefaultChannel returns true if the PackageChennel is the default for the PackageManifest

type PackageDependency

type PackageDependency struct {
	// The name of dependency such as 'etcd'
	PackageName string `json:"packageName" yaml:"packageName"`

	// The version range of dependency in semver range format
	Version string `json:"version" yaml:"version"`
}

func (*PackageDependency) Validate

func (pd *PackageDependency) Validate() []error

Validate will validate package dependency type and return error(s)

type PackageManifest

type PackageManifest struct {
	// PackageName is the name of the overall package, ala `etcd`.
	PackageName string `json:"packageName" yaml:"packageName"`

	// Channels are the declared channels for the package, ala `stable` or `alpha`.
	Channels []PackageChannel `json:"channels" yaml:"channels"`

	// DefaultChannelName is, if specified, the name of the default channel for the package. The
	// default channel will be installed if no other channel is explicitly given. If the package
	// has a single channel, then that channel is implicitly the default.
	DefaultChannelName string `json:"defaultChannel" yaml:"defaultChannel"`
}

PackageManifest holds information about a package, which is a reference to one (or more) channels under a single package.

func DecodePackageManifest

func DecodePackageManifest(reader io.Reader) (manifest *PackageManifest, err error)

DecodePackageManifest decodes a raw stream into a a PackageManifest instance. If a package name is empty we consider the object invalid!

func SemverPackageManifest

func SemverPackageManifest(bundles []*Bundle) (*PackageManifest, error)

SemverPackageManifest generates a PackageManifest from a set of bundles, determining channel heads and the default channel using semver. Bundles with the highest version field (according to semver) are chosen as channel heads, and the default channel is taken from the last, highest versioned bundle in the entire set to define it. The given bundles must all belong to the same package or an error is thrown.

func (PackageManifest) GetDefaultChannel

func (m PackageManifest) GetDefaultChannel() string

GetDefaultChannel gets the default channel or returns the only one if there's only one. returns empty string if it can't determine the default

type PackageProperty

type PackageProperty struct {
	// The name of package such as 'etcd'
	PackageName string `json:"packageName" yaml:"packageName"`

	// The version of package in semver format
	Version string `json:"version" yaml:"version"`
}

type PackageVersionAlreadyAddedErr

type PackageVersionAlreadyAddedErr struct {
	ErrorString string
}

PackageVersionAlreadyAddedErr is an error that describes that a bundle that is already in the databse that provides this package and version

func (PackageVersionAlreadyAddedErr) Error

type PropertiesFile

type PropertiesFile struct {
	// Properties is a list of properties.
	Properties []Property `json:"properties" yaml:"properties"`
}

PropertiesFile holds the properties associated with a bundle.

type Property

type Property struct {
	// The type of property. This field is required.
	Type string `json:"type" yaml:"type"`

	// The serialized value of the propertuy
	Value json.RawMessage `json:"value" yaml:"value"`
}

Property defines a single piece of the public interface for a bundle. Dependencies are specified over properties. The Type of the property determines how to interpret the Value, but the value is treated opaquely for for non-first-party types.

func (Property) String

func (p Property) String() string

type Querier

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

func NewQuerier

func NewQuerier(packages model.Model) (*Querier, error)

func (Querier) Close

func (q Querier) Close() error

func (Querier) GetBundle

func (q Querier) GetBundle(_ context.Context, pkgName, channelName, csvName string) (*api.Bundle, error)

func (Querier) GetBundleForChannel

func (q Querier) GetBundleForChannel(_ context.Context, pkgName string, channelName string) (*api.Bundle, error)

func (Querier) GetBundleThatProvides

func (q Querier) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error)

func (Querier) GetBundleThatReplaces

func (q Querier) GetBundleThatReplaces(_ context.Context, name, pkgName, channelName string) (*api.Bundle, error)

func (Querier) GetChannelEntriesThatProvide

func (q Querier) GetChannelEntriesThatProvide(_ context.Context, group, version, kind string) ([]*ChannelEntry, error)

func (Querier) GetChannelEntriesThatReplace

func (q Querier) GetChannelEntriesThatReplace(_ context.Context, name string) ([]*ChannelEntry, error)

func (Querier) GetLatestChannelEntriesThatProvide

func (q Querier) GetLatestChannelEntriesThatProvide(_ context.Context, group, version, kind string) ([]*ChannelEntry, error)

TODO(joelanford): Need to review the expected functionality of this function. I ran

some experiments with the sqlite version of this function and it seems to only return
channel heads that provide the GVK (rather than searching down the graph if parent bundles
don't provide the API). Based on that, this function currently looks at channel heads only.
---
Separate, but possibly related, I noticed there are several channels in the channel entry
table who's minimum depth is 1. What causes 1 to be minimum depth in some cases and 0 in others?

func (Querier) GetPackage

func (q Querier) GetPackage(_ context.Context, name string) (*PackageManifest, error)

func (Querier) ListBundles

func (q Querier) ListBundles(ctx context.Context) ([]*api.Bundle, error)

func (Querier) ListPackages

func (q Querier) ListPackages(_ context.Context) ([]string, error)

func (Querier) SendBundles

func (q Querier) SendBundles(_ context.Context, s BundleSender) error

type Query

type Query interface {
	GRPCQuery

	ListTables(ctx context.Context) ([]string, error)
	GetDefaultPackage(ctx context.Context, name string) (string, error)
	GetChannelEntriesFromPackage(ctx context.Context, packageName string) ([]ChannelEntryAnnotated, error)
	// List all images in the database
	ListImages(ctx context.Context) ([]string, error)
	// List all images for a particular bundle
	GetImagesForBundle(ctx context.Context, bundleName string) ([]string, error)
	// Get Provided and Required APIs for a particular bundle
	GetApisForEntry(ctx context.Context, entryID int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error)
	// Get Version of a Bundle Image
	GetBundleVersion(ctx context.Context, image string) (string, error)
	// List Images for Package
	GetBundlePathsForPackage(ctx context.Context, pkgName string) ([]string, error)
	// List Bundles for Package
	GetBundlesForPackage(ctx context.Context, pkgName string) (map[BundleKey]struct{}, error)
	// Get DefaultChannel for Package
	GetDefaultChannelForPackage(ctx context.Context, pkgName string) (string, error)
	// List channels for package
	ListChannels(ctx context.Context, pkgName string) ([]string, error)
	// Get CurrentCSV name for channel and package
	GetCurrentCSVNameForChannel(ctx context.Context, pkgName, channel string) (string, error)
	// Get the list of dependencies for a bundle
	GetDependenciesForBundle(ctx context.Context, name, version, path string) (dependencies []*api.Dependency, err error)
	// Get the bundle path if it exists
	GetBundlePathIfExists(ctx context.Context, csvName string) (string, error)
	// ListRegistryBundles returns a set of registry bundles.
	ListRegistryBundles(ctx context.Context) ([]*Bundle, error)
}

type RegistryPopulator

type RegistryPopulator interface {
	Populate() error
}

RegistryPopulator populates a registry.

type SliceBundleSender

type SliceBundleSender []*api.Bundle

func (*SliceBundleSender) Send

func (s *SliceBundleSender) Send(b *api.Bundle) error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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