appregistry

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBundleProcessor

func NewBundleProcessor(logger *logrus.Entry, downloadPath string) (*bundleProcessor, error)

func NewDbLoader

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

func NewFlattenedProcessor

func NewFlattenedProcessor(logger *logrus.Entry) *flattenedProcessor

func NewFormatChecker

func NewFormatChecker() *formatChecker

func NewKubeClient

func NewKubeClient(kubeconfig string, logger *logrus.Entry) (clientset *kubernetes.Clientset, err error)

func NewManifestDecoder

func NewManifestDecoder(logger *logrus.Entry, directory string) (*manifestDecoder, error)

func NewMarketplaceClient

func NewMarketplaceClient(kubeconfig string, logger *logrus.Entry) (clientset marketplace.Interface, err error)

Types

type AppregistryLoader

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

func NewLoader

func NewLoader(kubeconfig string, dbName string, downloadPath string, logger *logrus.Entry, legacy bool) (*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) (store registry.Query, err 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 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 []string
}

func (*Input) IsGoodToProceed

func (i *Input) IsGoodToProceed() bool

func (*Input) PackagesToMap

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

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

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

type OperatorSourceSpecifier

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.

func NewOperatorSourceCRSpecifier

func NewOperatorSourceCRSpecifier(kubeconfig string, logger *logrus.Entry) (OperatorSourceSpecifier, error)

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

type Processor interface {
	Process(header *tar.Header, 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 Source

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

func (s *Source) IsSecretSpecified() bool

func (*Source) String

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.

Jump to

Keyboard shortcuts

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