appregistry

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDatabase added in v1.5.0

func BuildDatabase(manifestPath, databasePath string) error

func BuildLayer added in v1.5.0

func BuildLayer(directory string) (string, error)

func NewBundleProcessor added in v1.1.1

func NewBundleProcessor() (*bundleProcessor, error)

NewBundleProcessor is a bundleProcessor constructor

func NewDbLoader added in v1.1.1

func NewDbLoader(dbName string, logger *logrus.Entry) (*dbLoader, error)

func NewFlattenedProcessor added in v1.1.1

func NewFlattenedProcessor() (*flattenedProcessor, error)

func NewFormatChecker added in v1.1.1

func NewFormatChecker() *formatChecker

func NewManifestDecoder added in v1.1.1

func NewManifestDecoder(logger *log.Entry) (*manifestDecoder, error)

Types

type AppregistryBuildOption added in v1.5.0

type AppregistryBuildOption func(*AppregistryBuildOptions)

func WithAppRegistryEndpoint added in v1.5.0

func WithAppRegistryEndpoint(s string) AppregistryBuildOption

func WithAppRegistryOrg added in v1.5.0

func WithAppRegistryOrg(s string) AppregistryBuildOption

func WithAppender added in v1.5.0

func WithAppender(a ImageAppender) AppregistryBuildOption

func WithAuthToken added in v1.5.0

func WithAuthToken(s string) AppregistryBuildOption

func WithCacheDir added in v1.5.0

func WithCacheDir(s string) AppregistryBuildOption

func WithClient added in v1.5.4

func WithDatabasePath added in v1.5.0

func WithDatabasePath(s string) AppregistryBuildOption

func WithFrom added in v1.5.0

func WithFrom(s string) AppregistryBuildOption

func WithTo added in v1.5.0

type AppregistryBuildOptions added in v1.5.0

type AppregistryBuildOptions struct {
	Appender ImageAppender

	From, To            string
	AuthToken           string
	AppRegistryEndpoint string
	AppRegistryOrg      string
	DatabasePath        string
	CacheDir            string

	// derived
	CleanOutput bool
	ManifestDir string
	DatabaseDir string

	Client apprclient.Client
}

func DefaultAppregistryBuildOptions added in v1.5.0

func DefaultAppregistryBuildOptions() *AppregistryBuildOptions

func (*AppregistryBuildOptions) Apply added in v1.5.0

func (c *AppregistryBuildOptions) Apply(options []AppregistryBuildOption)

Apply sequentially applies the given options to the config.

func (*AppregistryBuildOptions) Complete added in v1.5.0

func (o *AppregistryBuildOptions) Complete() error

func (*AppregistryBuildOptions) ToOption added in v1.5.0

ToOption converts an AppregistryBuildOptions object into a function that applies its current configuration to another AppregistryBuildOptions instance

func (*AppregistryBuildOptions) Validate added in v1.5.0

func (o *AppregistryBuildOptions) Validate() error

type AppregistryImageBuilder added in v1.5.0

type AppregistryImageBuilder struct {
	Appender ImageAppender

	// options
	From, To            string
	AuthToken           string
	AppRegistryEndpoint string
	AppRegistryOrg      string
	DatabasePath        string
	CacheDir            string

	// derived
	CleanOutput bool
	ManifestDir string
	DatabaseDir string
	// contains filtered or unexported fields
}

func NewAppregistryImageBuilder added in v1.5.0

func NewAppregistryImageBuilder(options ...AppregistryBuildOption) (*AppregistryImageBuilder, error)

func (*AppregistryImageBuilder) Build added in v1.5.0

func (b *AppregistryImageBuilder) Build() error

type AppregistryLoader

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

func NewLoader

func NewLoader(kubeconfig string, dbName string, downloadPath string, logger *logrus.Entry) (*AppregistryLoader, error)

NewLoader returns a new instance of AppregistryLoader.

kubeconfig specifies the location of kube configuration file. dbName specifies the database name to be used for sqlite. downloadPath specifies the folder where the downloaded nested bundle(s) will be stored.

func (*AppregistryLoader) Load

func (a *AppregistryLoader) Load(csvSources []string, csvPackages string) (registry.Query, error)

type CRDKey

type CRDKey struct {
	Kind    string `json:"kind"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

CRDKey contains metadata needed to uniquely identify a CRD.

OLM uses CRDKey to uniquely identify a CustomResourceDefinition object. We are following the same pattern to be consistent.

func (CRDKey) String

func (k CRDKey) String() string

String returns a string representation of this CRDKey object with Kind, Name and Version concatenated.

CRDKey is used as the key to map of CustomResourceDefinition object(s). This function ensures that Kind, Name and Version are taken into account to compute the key associated with a CustomResourceDefinition object.

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) GetCustomResourceDefintions

func (csv *ClusterServiceVersion) GetCustomResourceDefintions() (owned []*CRDKey, required []*CRDKey, 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.

type CustomResourceDefinition

type CustomResourceDefinition struct {
	v1beta1.CustomResourceDefinition `json:",inline"`
}

CustomResourceDefinition is a structured representation of custom resource definition(s) specified in `customResourceDefinitions` section of an operator manifest.

func (*CustomResourceDefinition) Key

func (crd *CustomResourceDefinition) Key() CRDKey

Key returns an instance of CRDKey which uniquely identifies a given CustomResourceDefinition object.

type ImageAppendFunc added in v1.5.0

type ImageAppendFunc func(from, to, layer string) error

func (ImageAppendFunc) Append added in v1.5.0

func (f ImageAppendFunc) Append(from, to, layer string) error

type ImageAppender added in v1.5.0

type ImageAppender interface {
	Append(from, to, layer string) error
}

type Input

type Input struct {
	// Sources is the set of remote operator source(s) specified where operator
	// manifest(s) are located.
	Sources []*Source

	// Packages is the set of package name(s) specified.
	Packages []*Package
}

func (*Input) IsGoodToProceed added in v1.1.1

func (i *Input) IsGoodToProceed() bool

func (*Input) PackagesToMap

func (i *Input) PackagesToMap() map[Package]bool

type ManifestDownloader added in v1.5.0

type ManifestDownloader interface {
	// DownloadManifests downloads the manifests in a namespace into a local directory
	DownloadManifests(directory, namespace string) error
}

ManifestDownloader is an interface that is implemented by structs that implement the DownloadManifests method.

func NewManifestDownloader added in v1.5.0

func NewManifestDownloader(client apprclient.Client) ManifestDownloader

NewDownloader is a constructor for the Downloader interface

type ManifestYAMLParser

type ManifestYAMLParser interface {
	// Unmarshal unmarshals raw operator manifest YAML into structured
	// representation.
	//
	// The function accepts raw yaml specified in rawYAML and converts it into
	// an instance of StructuredOperatorManifestData.
	Unmarshal(rawYAML []byte) (marshaled *StructuredOperatorManifestData, err error)

	// Marshal marshals a structured representation of an operator manifest into
	// raw YAML representation so that it can be used to create a configMap
	// object for a catalog source in OLM.
	//
	// The function accepts a structured representation of operator manifest(s)
	// specified in marshaled and returns a raw yaml representation of it.
	Marshal(bundle *StructuredOperatorManifestData) (*RawOperatorManifestData, error)

	MarshalCSV(csv *ClusterServiceVersion) (string, error)

	MarshalCRD(crd *CustomResourceDefinition) (string, error)

	MarshalPackage(pkg *PackageManifest) (string, error)
}

ManifestYAMLParser is an interface that is responsible for marshaling raw operator manifest into structured representation and vice versa.

type OperatorSourceSpecifier added in v1.1.1

type OperatorSourceSpecifier interface {
	Parse(specifiers []string) ([]*Source, error)
}

OperatorSourceSpecifier interface provides capability to have different ways of specifying operator source via command line flags. This helps us maintain backward compatability.

type Package added in v1.5.8

type Package struct {
	// The name of the package
	Name string
	// The release number of the package
	Release string
}

func (*Package) String added in v1.5.8

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"`

	// 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.

The following type has been directly copied as is from OLM. See https://github.com/operator-framework/operator-lifecycle-manager/blob/724b209ccfff33b6208cc5d05283800d6661d441/pkg/controller/registry/types.go#L105.

We use it to unmarshal 'packages/package/channels' element of an operator manifest.

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.

The following type has been copied as is from OLM. See https://github.com/operator-framework/operator-lifecycle-manager/blob/724b209ccfff33b6208cc5d05283800d6661d441/pkg/controller/registry/types.go#L78:6.

We use it to unmarshal 'packages' element of an operator manifest.

type Processor added in v1.1.1

type Processor interface {
	Process(header *tar.Header, manifestName, workingDirectory string, reader io.Reader) (done bool, err error)
}

Processor is an interface that wraps the Process method.

Process is called by tar walker to notify of an element just discovered.

if done is set to true then tar walker will exit from the walk loop. Otherwise, it will continue

type RawOperatorManifestData

type RawOperatorManifestData struct {
	// CustomResourceDefinitions is the set of custom resource definition(s)
	// associated with this package manifest.
	CustomResourceDefinitions string `yaml:"customResourceDefinitions"`

	// ClusterServiceVersions is the set of cluster service version(s)
	// associated with this package manifest.
	ClusterServiceVersions string `yaml:"clusterServiceVersions"`

	// Packages is the set of package(s) associated with this operator manifest.
	Packages string `yaml:"packages"`
}

RawOperatorManifestData encapsulates the list of CRD(s), CSV(s) and package(s) associated with a set of manifest(s).

type RegistryImageBuilder added in v1.5.0

type RegistryImageBuilder interface {
	Build() error
}

type Source added in v1.1.1

type Source struct {
	// Endpoint points to the base URL of remote AppRegistry server.
	Endpoint string

	// RegistryNamespace is the namespace in remote registry where the operator
	// metadata is located.
	RegistryNamespace string

	// Secret is the kubernetes secret object that contains the authorization
	// token that can be used to access private repositories.
	Secret types.NamespacedName
}

func (*Source) IsSecretSpecified added in v1.1.1

func (s *Source) IsSecretSpecified() bool

func (*Source) String added in v1.1.1

func (s *Source) String() string

type StructuredOperatorManifestData

type StructuredOperatorManifestData struct {
	// CustomResourceDefinitions is the list of custom resource definition(s)
	// associated with this operator manifest.
	CustomResourceDefinitions []CustomResourceDefinition `json:"customResourceDefinitions"`

	// ClusterServiceVersions is the list of cluster service version(s)
	//associated with this operators manifest.
	ClusterServiceVersions []ClusterServiceVersion `json:"clusterServiceVersions"`

	// Packages is the list of package(s) associated with this operator manifest.
	Packages []PackageManifest `json:"packages"`
}

StructuredOperatorManifestData is a structured representation of operator manifest(s). An operator manifest is a YAML document with the following sections: - customResourceDefinitions - clusterServiceVersions - packages

An operator manifest is unmarshaled into this type so that we can perform certain operations like, but not limited to:

  • Construct a new operator manifest object to be used by a CatalogSourceConfig by combining a set of existing operator manifest(s).
  • Construct a new operator manifest object by extracting a certain operator/package from a a given operator manifest.

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