registry

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 12 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

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 DefaultYAMLDecoder

func DefaultYAMLDecoder() runtime.Decoder

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 Bundle

type Bundle struct {
	Name    string
	Objects []*unstructured.Unstructured
	Package string
	Channel string
	// contains filtered or unexported fields
}

func NewBundle

func NewBundle(name, pkgName, channelName string, objs ...*unstructured.Unstructured) *Bundle

func NewBundleFromStrings

func NewBundleFromStrings(name, pkgName, channelName string, 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() ([]*apiextensions.CustomResourceDefinition, error)

func (*Bundle) ProvidedAPIs

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

func (*Bundle) RequiredAPIs

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

func (*Bundle) Serialize

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

func (*Bundle) Size

func (b *Bundle) Size() int

type ChannelEntry

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

ChannelEntry is a denormalized node in a channel graph

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 (*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) 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) 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 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) GetBundle

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

func (EmptyQuery) GetBundleForChannel

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

func (EmptyQuery) GetBundleThatProvides

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

func (EmptyQuery) GetBundleThatReplaces

func (EmptyQuery) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (string, 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) 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) ListPackages

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

func (EmptyQuery) ListTables

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

type Load

type Load interface {
	AddOperatorBundle(bundle *Bundle) error
	AddPackageChannels(manifest PackageManifest) error
}

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 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 (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)
	GetBundle(ctx context.Context, pkgName, channelName, csvName string) (string, error)
	GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (string, 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) (string, 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) (string, *ChannelEntry, error)
}

Jump to

Keyboard shortcuts

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