registry

package
v3.11.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: Apache-2.0 Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ConfigMapCRDName     = "customResourceDefinitions"
	ConfigMapCSVName     = "clusterServiceVersions"
	ConfigMapPackageName = "packages"
)

Variables

This section is empty.

Functions

func LoadCRDFromFile

func LoadCRDFromFile(m *InMem, filepath string) (*v1beta1.CustomResourceDefinition, error)

LoadCRDFromFile is a utility function for loading the CRD schemas.

func LoadCSVFromFile

func LoadCSVFromFile(m *InMem, filepath string) (*v1alpha1.ClusterServiceVersion, error)

LoadCSVFromFile is a utility function for loading CSV definitions

Types

type CRDKey

type CRDKey struct {
	Kind    string
	Name    string
	Version string
}

CRDKey contains metadata needed to uniquely identify a CRD

func (CRDKey) String

func (k CRDKey) String() string

type CSVAndChannelInfo

type CSVAndChannelInfo struct {
	// CSV is the CSV found.
	CSV *v1alpha1.ClusterServiceVersion

	// Channel is the channel that "contains" this CSV, as it is declared as part of the channel.
	Channel PackageChannel

	// IsDefaultChannel returns true iff the channel is the default channel for the package.
	IsDefaultChannel bool
}

CSVAndChannelInfo holds information about a CSV and the channel in which it lives.

type CSVMetadata

type CSVMetadata struct {
	Name    string
	Version string
}

CSVMetadata holds the necessary information to locate a particular CSV in the catalog

type ConfigMapCatalogResourceLoader

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

ConfigMapCatalogResourceLoader loads a ConfigMap of resources into the in-memory catalog

func NewConfigMapCatalogResourceLoader

func NewConfigMapCatalogResourceLoader(namespace string, opClient operatorclient.ClientInterface) ConfigMapCatalogResourceLoader

func (*ConfigMapCatalogResourceLoader) LoadCatalogResources

func (d *ConfigMapCatalogResourceLoader) LoadCatalogResources(catalog *InMem, configMapName string) error

func (*ConfigMapCatalogResourceLoader) LoadCatalogResourcesFromConfigMap

func (d *ConfigMapCatalogResourceLoader) LoadCatalogResourcesFromConfigMap(catalog *InMem, cm *v1.ConfigMap) error

type DirectoryCatalogResourceLoader

type DirectoryCatalogResourceLoader struct {
	Catalog *InMem
}

DirectoryCatalogResourceLoader loads a directory of resources into the in-memory catalog files ending in `.crd.yaml` will be parsed as CRDs files ending in`.clusterserviceversion.yaml` will be parsed as CRDs

func (*DirectoryCatalogResourceLoader) LoadCRDsWalkFunc

func (d *DirectoryCatalogResourceLoader) LoadCRDsWalkFunc(path string, f os.FileInfo, err error) error

func (*DirectoryCatalogResourceLoader) LoadCSVsWalkFunc

func (d *DirectoryCatalogResourceLoader) LoadCSVsWalkFunc(path string, f os.FileInfo, err error) error

func (*DirectoryCatalogResourceLoader) LoadCatalogResources

func (d *DirectoryCatalogResourceLoader) LoadCatalogResources(directory string) error

func (*DirectoryCatalogResourceLoader) LoadPackagesWalkFunc

func (d *DirectoryCatalogResourceLoader) LoadPackagesWalkFunc(path string, f os.FileInfo, err error) error

type InMem

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

func NewInMem

func NewInMem() *InMem

NewInMem returns a ptr to a new InMem instance

func NewInMemoryFromConfigMap

func NewInMemoryFromConfigMap(cmClient operatorclient.ClientInterface, namespace, cmName string) (*InMem, error)

func NewInMemoryFromDirectory

func NewInMemoryFromDirectory(directory string) (*InMem, error)

func (*InMem) AddOrReplaceService

func (m *InMem) AddOrReplaceService(csv v1alpha1.ClusterServiceVersion)

AddOrReplaceService registers service into the catalog, overwriting any existing values

func (*InMem) AddPackageManifest

func (m *InMem) AddPackageManifest(pkg PackageManifest) error

addPackageManifest adds a new package manifest to the in memory catalog.

func (*InMem) AllPackages

func (m *InMem) AllPackages() map[string]PackageManifest

AllPackages returns all package manifests in the catalog

func (*InMem) FindCRDByKey

func (m *InMem) FindCRDByKey(key CRDKey) (*v1beta1.CustomResourceDefinition, error)

FindCRDByName looks up the full CustomResourceDefinition for the resource with the given name

func (*InMem) FindCSVByName

func (m *InMem) FindCSVByName(name string) (*v1alpha1.ClusterServiceVersion, error)

FindCSVByName looks up the CSV with the given name.

func (*InMem) FindCSVForPackageNameUnderChannel

func (m *InMem) FindCSVForPackageNameUnderChannel(packageName string, channelName string) (*v1alpha1.ClusterServiceVersion, error)

FindCSVForPackageNameUnderChannel finds the CSV referenced by the specified channel under the package with the specified name.

func (*InMem) FindReplacementCSVForName

func (m *InMem) FindReplacementCSVForName(name string) (*v1alpha1.ClusterServiceVersion, error)

FindReplacementCSVForName looks up any CSV in the catalog that replaces the given CSV, if any.

func (*InMem) FindReplacementCSVForPackageNameUnderChannel

func (m *InMem) FindReplacementCSVForPackageNameUnderChannel(packageName string, channelName string, csvName string) (*v1alpha1.ClusterServiceVersion, error)

FindReplacementCSVForPackageNameUnderChannel returns the CSV that replaces the CSV with the matching CSV name, within the package and channel specified.

func (*InMem) ListLatestCSVsForCRD

func (m *InMem) ListLatestCSVsForCRD(key CRDKey) ([]CSVAndChannelInfo, error)

ListLatestCSVsForCRD lists the latests versions of the service that manages the given CRD.

func (*InMem) ListServices

func (m *InMem) ListServices() ([]v1alpha1.ClusterServiceVersion, error)

ListServices lists all versions of the service in the catalog

func (*InMem) SetCRDDefinition

func (m *InMem) SetCRDDefinition(crd v1beta1.CustomResourceDefinition) error

SetCRDDefinition sets the full resource definition of a CRD in the stored map only sets a new definition if one is not already set

type PackageChannel

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

	// CurrentCSVName defines a reference to the CSV holding the version of this package currently
	// for the channel.
	CurrentCSVName string `json:"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"`

	// Channels are the declared channels for the package, ala `stable` or `alpha`.
	Channels []PackageChannel `json:"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"`
}

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

func LoadPackageFromFile

func LoadPackageFromFile(m *InMem, filepath string) (*PackageManifest, error)

LoadPackageFromFile is a utility function for loading Package definitions

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 ResourceKey

type ResourceKey struct {
	Name      string
	Kind      string
	Namespace string
}

ResourceKey contains metadata to uniquely identify a resource

type Source

type Source interface {
	FindCSVForPackageNameUnderChannel(packageName string, channelName string) (*v1alpha1.ClusterServiceVersion, error)
	FindReplacementCSVForPackageNameUnderChannel(packageName string, channelName string, csvName string) (*v1alpha1.ClusterServiceVersion, error)
	AllPackages() map[string]PackageManifest

	// Deprecated: Switch to FindReplacementCSVForPackageNameUnderChannel when the caller has package and channel
	// information.
	FindReplacementCSVForName(name string) (*v1alpha1.ClusterServiceVersion, error)

	FindCSVByName(name string) (*v1alpha1.ClusterServiceVersion, error)
	ListServices() ([]v1alpha1.ClusterServiceVersion, error)

	FindCRDByKey(key CRDKey) (*v1beta1.CustomResourceDefinition, error)
	ListLatestCSVsForCRD(key CRDKey) ([]CSVAndChannelInfo, error)
}

type SourceRef

type SourceRef struct {
	SourceKey ResourceKey
	Source    Source
}

SourceRef associates a Source with it's SourceKey

type SubscriptionKey

type SubscriptionKey struct {
	Name      string
	Namespace string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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