Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTaglessImage = errors.New("indexImage is tagless, skipping the addon as it is not onboarded")
Functions ¶
This section is empty.
Types ¶
type BundleCache ¶
type BundleCache interface { Get(bundleImage string) (*registry.Bundle, error) // bundles are defined to be immutable by OPM, se we don't have to update // the cache if an entry already exists. Set(bundleImage string, bundle *registry.Bundle) error }
BundleCache - cache a bundle object to avoid having to pull and extract the bundleImage.
func NewBundleMemoryCache ¶
func NewBundleMemoryCache(encoder BundleEncoder) BundleCache
NewBundleMemoryCache - in-memory cache for bundle, using an encoder
type BundleEncoder ¶
type BundleEncoder interface { Encode(bundle *registry.Bundle) ([]byte, error) Decode(data []byte) (*registry.Bundle, error) }
BundleEncoder - encodes a bundle object for more efficient caching. Bundle objects are large structure and we want to compress and work with a friendlier format when caching or sending them on the wire (e.g.: Redis)
func NewJSONSnappyEncoder ¶
func NewJSONSnappyEncoder() BundleEncoder
NewJSONSnappyEncoder - encodes a bundle to snappy compressed JSON
type BundleExtractor ¶
type BundleExtractor interface {
Extract(ctx context.Context, bundleImage string) (*registry.Bundle, error)
}
BundleExtractor - extracts a single bundle from it's bundleImage, using the bundle format by OPM. Bundle format: https://docs.openshift.com/container-platform/4.9/operators/understanding/olm-packaging-format.html#olm-bundle-format_olm-packaging-format
type BundleExtractorOpt ¶
type BundleExtractorOpt func(e *DefaultBundleExtractor)
func WithBundleCache ¶
func WithBundleCache(cache BundleCache) BundleExtractorOpt
func WithBundleLog ¶
func WithBundleLog(log logrus.FieldLogger) BundleExtractorOpt
func WithBundleTimeout ¶
func WithBundleTimeout(timeout time.Duration) BundleExtractorOpt
type DefaultBundleExtractor ¶
type DefaultBundleExtractor struct { Log logrus.FieldLogger Cache BundleCache Timeout time.Duration }
func NewBundleExtractor ¶
func NewBundleExtractor(opts ...BundleExtractorOpt) *DefaultBundleExtractor
type DefaultIndexExtractor ¶
type DefaultIndexExtractor struct { Log logrus.FieldLogger Cache IndexCache }
func NewIndexExtractor ¶
func NewIndexExtractor(opts ...IndexExtractorOpt) *DefaultIndexExtractor
NewIndexExtractor - takes a variadic slice of options to configure an index extractor and applies defaults if no appropriate option is given.
func (*DefaultIndexExtractor) ExtractAllBundleImages ¶
func (e *DefaultIndexExtractor) ExtractAllBundleImages(indexImage string) ([]string, error)
ExtractAllBundleImages - returns a sorted list of all bundles for all pkgs
func (*DefaultIndexExtractor) ExtractBundleImages ¶
func (e *DefaultIndexExtractor) ExtractBundleImages(indexImage string, pkgName string) ([]string, error)
ExtractBundleImages - returns a sorted list of bundles for a given pkg
type Extractor ¶
type Extractor interface { // extract all bundles from indexImage matching pkgName ExtractBundles(indexImage string, pkgName string) ([]*registry.Bundle, error) // extract all bundles from indexImage, for all packages ExtractAllBundles(indexImage string) ([]*registry.Bundle, error) }
Extractor - utilizes both the indexExtractor and bundleExtractor to first extract all bundleImages from an indexImage, and then extract all the corresponding bundles from those underlying bundleImages.
type IndexCache ¶
type IndexCache interface { GetBundleImages(indexImage string, pkgName string) []string // An indexImage is mutable, so we have to update the cache on every call. SetBundleImages(indexImage string, bundleImagesMap map[string][]string) }
Cache - caches bundleImages using a double index. We first cache results per indexImage and then by pkgName.
func NewIndexMemoryCache ¶
func NewIndexMemoryCache() IndexCache
NewIndexMemoryCache - in-memory cache for bundleImages. Indexes first by indexImage, then by pkgName.
type IndexExtractor ¶
type IndexExtractor interface { // extract all bundleImages contained in indexImage, matching pkgName ExtractBundleImages(indexImage string, pkgName string) ([]string, error) // extract all bundleImages contained in the indexImage, for all packages. ExtractAllBundleImages(indexImage string) ([]string, error) }
IndexExtractor - extracts bundleImages from an indexImage. Supports both the sql and file based catalog format. An indexImage contains one or multiple packages, which contain bundleImages. Catalog format: https://docs.openshift.com/container-platform/4.9/operators/admin/olm-managing-custom-catalogs.html#olm-managing-custom-catalogs-fb
type IndexExtractorOpt ¶
type IndexExtractorOpt func(e *DefaultIndexExtractor)
func WithIndexCache ¶
func WithIndexCache(cache IndexCache) IndexExtractorOpt
func WithIndexLog ¶
func WithIndexLog(log logrus.FieldLogger) IndexExtractorOpt
type JSONSnappyEncoder ¶
type JSONSnappyEncoder struct{}
type MainExtractor ¶
type MainExtractor struct { Log logrus.FieldLogger Index IndexExtractor Bundle BundleExtractor }
func New ¶
func New(opts ...MainExtractorOpt) *MainExtractor
New - creates a new mainExtractor, with the provided options. Order of provided options matter, as the logger descends into both the bundle and index extractors.
func (*MainExtractor) ApplyDefaults ¶
func (e *MainExtractor) ApplyDefaults()
func (*MainExtractor) ExtractAllBundles ¶
func (e *MainExtractor) ExtractAllBundles(indexImage string) ([]*registry.Bundle, error)
ExtractAllBundles - extract bundles for all packages from indexImage
func (*MainExtractor) ExtractBundles ¶
func (e *MainExtractor) ExtractBundles(indexImage string, pkgName string) ([]*registry.Bundle, error)
ExtractBundles - extract bundles from indexImage matching pkgName
type MainExtractorOpt ¶
type MainExtractorOpt func(e *MainExtractor)
func WithBundleExtractor ¶
func WithBundleExtractor(bundleExtractor BundleExtractor) MainExtractorOpt
func WithIndexExtractor ¶
func WithIndexExtractor(indexExtractor IndexExtractor) MainExtractorOpt
func WithLog ¶
func WithLog(log logrus.FieldLogger) MainExtractorOpt