Documentation ¶
Index ¶
- Constants
- Variables
- func BundleStringToAPIBundle(bundleString string) (*api.Bundle, error)
- func BundleStringToObjectStrings(bundleString string) ([]string, error)
- func ChannelEntryToAPIChannelEntry(entry *ChannelEntry) *api.ChannelEntry
- func DecodeUnstructured(reader io.Reader) (obj *unstructured.Unstructured, err error)
- func DefaultYAMLDecoder() runtime.Decoder
- func PackageChannelToAPIChannel(channel *PackageChannel) *api.Channel
- func PackageManifestToAPIPackage(manifest *PackageManifest) *api.Package
- type APIKey
- type Annotations
- type AnnotationsFile
- type Bundle
- func (b *Bundle) Add(obj *unstructured.Unstructured)
- func (b *Bundle) AllProvidedAPIsInBundle() error
- func (b *Bundle) ClusterServiceVersion() (*ClusterServiceVersion, error)
- func (b *Bundle) CustomResourceDefinitions() ([]*v1beta1.CustomResourceDefinition, error)
- func (b *Bundle) Images() (map[string]struct{}, error)
- func (b *Bundle) ProvidedAPIs() (map[APIKey]struct{}, error)
- func (b *Bundle) Replaces() (string, error)
- func (b *Bundle) RequiredAPIs() (map[APIKey]struct{}, error)
- func (b *Bundle) Serialize() (csvName, bundleImage string, csvBytes []byte, bundleBytes []byte, err error)
- func (b *Bundle) Size() int
- func (b *Bundle) SkipRange() (string, error)
- func (b *Bundle) Skips() ([]string, error)
- func (b *Bundle) Version() (string, error)
- type BundleGraphLoader
- type BundleKey
- type Channel
- type ChannelEntry
- type ChannelEntryAnnotated
- type ClusterServiceVersion
- func (csv *ClusterServiceVersion) GetApiServiceDefinitions() (owned []*DefinitionKey, required []*DefinitionKey, err error)
- func (csv *ClusterServiceVersion) GetCustomResourceDefintions() (owned []*DefinitionKey, required []*DefinitionKey, err error)
- func (csv *ClusterServiceVersion) GetOperatorImages() (map[string]struct{}, error)
- func (csv *ClusterServiceVersion) GetRelatedImages() (imageSet map[string]struct{}, err error)
- func (csv *ClusterServiceVersion) GetReplaces() (string, error)
- func (csv *ClusterServiceVersion) GetSkipRange() string
- func (csv *ClusterServiceVersion) GetSkips() ([]string, error)
- func (csv *ClusterServiceVersion) GetVersion() (string, error)
- type DefinitionKey
- type Dependencies
- type DependenciesFile
- type Dependency
- type DirGraphLoader
- type DirectoryPopulator
- type EmptyQuery
- func (EmptyQuery) GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error)
- func (EmptyQuery) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error)
- func (EmptyQuery) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error)
- func (EmptyQuery) GetBundlePathsForPackage(ctx context.Context, pkgName string) ([]string, error)
- func (EmptyQuery) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error)
- func (EmptyQuery) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error)
- func (EmptyQuery) GetBundleVersion(ctx context.Context, image string) (string, error)
- func (EmptyQuery) GetBundlesForPackage(ctx context.Context, pkgName string) (map[BundleKey]struct{}, error)
- func (EmptyQuery) GetChannelEntriesFromPackage(ctx context.Context, packageName string) ([]ChannelEntryAnnotated, error)
- func (EmptyQuery) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error)
- func (EmptyQuery) GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*ChannelEntry, err error)
- func (EmptyQuery) GetCurrentCSVNameForChannel(ctx context.Context, pkgName, channel string) (string, error)
- func (EmptyQuery) GetDefaultChannelForPackage(ctx context.Context, pkgName string) (string, error)
- func (EmptyQuery) GetDefaultPackage(ctx context.Context, name string) (string, error)
- func (EmptyQuery) GetDependenciesForBundle(ctx context.Context, name, version, path string) (dependencies []*api.Dependency, err error)
- func (EmptyQuery) GetImagesForBundle(ctx context.Context, bundleName string) ([]string, error)
- func (EmptyQuery) GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error)
- func (EmptyQuery) GetPackage(ctx context.Context, name string) (*PackageManifest, error)
- func (EmptyQuery) ListBundles(ctx context.Context) ([]*api.Bundle, error)
- func (EmptyQuery) ListChannels(ctx context.Context, pkgName string) ([]string, error)
- func (EmptyQuery) ListImages(ctx context.Context) ([]string, error)
- func (EmptyQuery) ListPackages(ctx context.Context) ([]string, error)
- func (EmptyQuery) ListTables(ctx context.Context) ([]string, error)
- type GVKDependency
- type GraphLoader
- type Load
- type Mode
- type Package
- type PackageChannel
- type PackageDependency
- type PackageManifest
- type Query
- type RegistryPopulator
Constants ¶
const ( ReplacesMode = iota SemVerMode SkipPatchMode )
const ( GVKType = "olm.gvk" PackageType = "olm.package" )
Variables ¶
var Codecs = serializer.NewCodecFactory(Scheme)
Codecs provides access to encoding and decoding for the scheme
var ( // ErrPackageNotInDatabase is an error that describes a package not found error when querying the registry ErrPackageNotInDatabase = errors.New("Package not in database") )
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 BundleStringToObjectStrings ¶
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 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 PackageChannelToAPIChannel ¶
func PackageChannelToAPIChannel(channel *PackageChannel) *api.Channel
func PackageManifestToAPIPackage ¶
func PackageManifestToAPIPackage(manifest *PackageManifest) *api.Package
Types ¶
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
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
type Bundle ¶
type Bundle struct { Name string Objects []*unstructured.Unstructured Package string Channels []string BundleImage string Dependencies []*Dependency // contains filtered or unexported fields }
func NewBundle ¶
func NewBundle(name, pkgName string, channels []string, objs ...*unstructured.Unstructured) *Bundle
func NewBundleFromStrings ¶
func (*Bundle) Add ¶
func (b *Bundle) Add(obj *unstructured.Unstructured)
func (*Bundle) AllProvidedAPIsInBundle ¶
func (*Bundle) ClusterServiceVersion ¶
func (b *Bundle) ClusterServiceVersion() (*ClusterServiceVersion, error)
func (*Bundle) CustomResourceDefinitions ¶
func (b *Bundle) CustomResourceDefinitions() ([]*v1beta1.CustomResourceDefinition, error)
func (*Bundle) ProvidedAPIs ¶
func (*Bundle) RequiredAPIs ¶
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, newDefaultChannel string, 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 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 and see if they are CSV. According to the strict one CSV rule for every bundle, we return the first file that is considered a CSV type.
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) 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) 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 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. It can be `olm.package` for operator-version based // dependency or `olm.gvk` for gvk based dependency. This field is required. Type string `json:"type" yaml:"type"` // The value of the dependency (either GVKDependency or PackageDependency) Value string `json:"value" yaml:"value"` }
Dependencies is a list of dependencies for a given bundle
func (*Dependency) GetType ¶
func (e *Dependency) GetType() string
GetType returns the type of dependency
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, to image.Reference, from string) *DirectoryPopulator
func (*DirectoryPopulator) Populate ¶
func (i *DirectoryPopulator) Populate(mode Mode) error
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) GetBundleForChannel ¶
func (EmptyQuery) GetBundlePathsForPackage ¶
func (EmptyQuery) GetBundleThatProvides ¶
func (EmptyQuery) GetBundleThatReplaces ¶
func (EmptyQuery) GetBundleVersion ¶
func (EmptyQuery) GetBundlesForPackage ¶
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) GetDefaultChannelForPackage ¶
func (EmptyQuery) GetDefaultPackage ¶
func (EmptyQuery) GetDependenciesForBundle ¶
func (EmptyQuery) GetDependenciesForBundle(ctx context.Context, name, version, path string) (dependencies []*api.Dependency, err error)
func (EmptyQuery) GetImagesForBundle ¶
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) ListChannels ¶
func (EmptyQuery) ListImages ¶
func (EmptyQuery) ListImages(ctx context.Context) ([]string, error)
func (EmptyQuery) ListPackages ¶
func (EmptyQuery) ListPackages(ctx context.Context) ([]string, error)
func (EmptyQuery) ListTables ¶
func (EmptyQuery) ListTables(ctx context.Context) ([]string, error)
type GVKDependency ¶
type GraphLoader ¶
GraphLoader generates a graph GraphLoader supports multiple different loading schemes GraphLoader from SQL, GraphLoader from old format (filesystem), GraphLoader from SQL + input bundles
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 ClearNonHeadBundles() error }
type Package ¶
func (*Package) HasChannel ¶
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 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 (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 Query ¶
type Query interface { ListTables(ctx context.Context) ([]string, error) ListPackages(ctx context.Context) ([]string, error) GetPackage(ctx context.Context, name string) (*PackageManifest, error) GetDefaultPackage(ctx context.Context, name string) (string, error) GetChannelEntriesFromPackage(ctx context.Context, packageName string) ([]ChannelEntryAnnotated, error) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error) 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) // 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) // List all available bundles in the database ListBundles(ctx context.Context) (bundles []*api.Bundle, err error) // Get the list of dependencies for a bundle GetDependenciesForBundle(ctx context.Context, name, version, path string) (dependencies []*api.Dependency, err error) }
type RegistryPopulator ¶
type RegistryPopulator interface {
Populate() error
}
RegistryPopulator populates a registry.