appregistry

package
v0.0.0-...-01b5cc5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBundleProcessor

func NewBundleProcessor() (*bundleProcessor, error)

NewBundleProcessor is a bundleProcessor constructor

func NewFlattenedProcessor

func NewFlattenedProcessor() (*flattenedProcessor, error)

func NewFormatChecker

func NewFormatChecker() *formatChecker

Types

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 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 ManifestDecoder

type ManifestDecoder interface {
	Decode(manifests []*apprclient.OperatorMetadata, workingDirectory string) (result Result, err error)
}

func NewManifestDecoder

func NewManifestDecoder() (ManifestDecoder, error)

NewManifestDecoder creates a new manifestDecoder

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 *olm.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 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, 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 Result

type Result struct {
	// FlattenedCount is the total number of flattened single-file operator
	// manifest(s) processed so far.
	FlattenedCount int

	// NestedCount is the total number of nested operator manifest(s)
	// processed so far.
	NestedCount int

	// DependentImages is a list of images required for the operator deployments
	// to succeed
	DependentImages []string
}

func (*Result) IsEmpty

func (r *Result) IsEmpty() bool

IsEmpty returns true if no operator manifest has been processed so far.

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 []olm.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