resolver

package
v0.10.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: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APILabelKeyPrefix is the key prefix for a CSV's APIs label
	APILabelKeyPrefix = "olm.api."
)
View Source
const SkipPackageAnnotationKey = "olm.skipRange"

Variables

View Source
var ExistingOperator = OperatorSourceInfo{"", "", "", CatalogKey{"", ""}}

Functions

func APIKeyToGVKHash

func APIKeyToGVKHash(key opregistry.APIKey) (string, error)

func APIKeyToGVKString

func APIKeyToGVKString(key opregistry.APIKey) string

func LabelSetsFor

func LabelSetsFor(obj interface{}) ([]labels.Set, error)

LabelSetsFor returns API label sets for the given object. Concrete types other than OperatorSurface and CustomResource definition no-op.

func NewServiceAccountStepResources

func NewServiceAccountStepResources(csv *v1alpha1.ClusterServiceVersion, catalogSourceName, catalogSourceNamespace string) ([]v1alpha1.StepResource, error)

NewServiceAccountStepResources returns a list of step resources required to satisfy the RBAC requirements of the given CSV's InstallStrategy

func NewStepResourceFromBundle

func NewStepResourceFromBundle(bundle *registry.Bundle, namespace, replaces, catalogSourceName, catalogSourceNamespace string) ([]v1alpha1.StepResource, error)

func NewStepResourceFromObject

func NewStepResourceFromObject(obj runtime.Object, catalogSourceName, catalogSourceNamespace string) (v1alpha1.StepResource, error)

NewStepResourceForObject returns a new StepResource for the provided object

func NewSubscriptionStepResource

func NewSubscriptionStepResource(namespace string, info OperatorSourceInfo) (v1alpha1.StepResource, error)

func RBACForClusterServiceVersion

func RBACForClusterServiceVersion(csv *v1alpha1.ClusterServiceVersion) (map[string]*OperatorPermissions, error)

Types

type APIIntersectionReconcileFunc

type APIIntersectionReconcileFunc func(add APISet, group OperatorGroupSurface, otherGroups ...OperatorGroupSurface) APIReconciliationResult

func (APIIntersectionReconcileFunc) Reconcile

type APIIntersectionReconciler

type APIIntersectionReconciler interface {
	Reconcile(add APISet, group OperatorGroupSurface, otherGroups ...OperatorGroupSurface) APIReconciliationResult
}

type APIMultiOwnerSet

type APIMultiOwnerSet map[opregistry.APIKey]OperatorSet

func EmptyAPIMultiOwnerSet

func EmptyAPIMultiOwnerSet() APIMultiOwnerSet

func (APIMultiOwnerSet) PopAPIKey

func (s APIMultiOwnerSet) PopAPIKey() *opregistry.APIKey

func (APIMultiOwnerSet) PopAPIRequirers

func (s APIMultiOwnerSet) PopAPIRequirers() OperatorSet

type APIOwnerSet

type APIOwnerSet map[opregistry.APIKey]OperatorSurface

func EmptyAPIOwnerSet

func EmptyAPIOwnerSet() APIOwnerSet

type APIReconciliationResult

type APIReconciliationResult int
const (
	RemoveAPIs APIReconciliationResult = iota
	AddAPIs
	APIConflict
	NoAPIConflict
)

func ReconcileAPIIntersection

func ReconcileAPIIntersection(add APISet, group OperatorGroupSurface, otherGroups ...OperatorGroupSurface) APIReconciliationResult

type APISet

type APISet map[opregistry.APIKey]struct{}

func EmptyAPISet

func EmptyAPISet() APISet

func GVKStringToProvidedAPISet

func GVKStringToProvidedAPISet(gvksStr string) APISet

func (APISet) Difference

func (s APISet) Difference(set APISet) APISet

func (APISet) Intersection

func (s APISet) Intersection(sets ...APISet) APISet

Intersection returns the intersection of the APISet and the given list of APISets

func (APISet) IsSubset

func (s APISet) IsSubset(set APISet) bool

IsSubset returns true if the APISet is a subset of the given one

func (APISet) PopAPIKey

func (s APISet) PopAPIKey() *opregistry.APIKey

func (APISet) String

func (s APISet) String() string

func (APISet) StripPlural

func (s APISet) StripPlural() APISet

StripPlural returns the APISet with the Plural field of all APIKeys removed

func (APISet) Union

func (s APISet) Union(sets ...APISet) APISet

Union returns the union of the APISet and the given list of APISets

type CatalogKey

type CatalogKey struct {
	Name      string
	Namespace string
}

func (*CatalogKey) String

func (k *CatalogKey) String() string

type Evolver

type Evolver interface {
	Evolve(add map[OperatorSourceInfo]struct{}) error
}

Evolvers modify a generation to a new state

func NewNamespaceGenerationEvolver

func NewNamespaceGenerationEvolver(querier SourceQuerier, gen Generation) Evolver

type Generation

type Generation interface {
	AddOperator(o OperatorSurface) error
	RemoveOperator(o OperatorSurface)
	ResetUnchecked()
	MissingAPIs() APIMultiOwnerSet
	Operators() OperatorSet
	MarkAPIChecked(key registry.APIKey)
	UncheckedAPIs() APISet
}

Generation represents a set of operators and their required/provided API surfaces at a point in time.

type NamespaceGeneration

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

NamespaceGeneration represents a generation of operators in a single namespace with methods for managing api checks

func NewEmptyGeneration

func NewEmptyGeneration() *NamespaceGeneration

func NewGenerationFromCluster

func NewGenerationFromCluster(csvs []*v1alpha1.ClusterServiceVersion, subs []*v1alpha1.Subscription) (*NamespaceGeneration, error)

func (*NamespaceGeneration) AddOperator

func (g *NamespaceGeneration) AddOperator(o OperatorSurface) error

func (*NamespaceGeneration) MarkAPIChecked

func (g *NamespaceGeneration) MarkAPIChecked(key registry.APIKey)

func (*NamespaceGeneration) MissingAPIs

func (g *NamespaceGeneration) MissingAPIs() APIMultiOwnerSet

func (*NamespaceGeneration) Operators

func (g *NamespaceGeneration) Operators() OperatorSet

func (*NamespaceGeneration) RemoveOperator

func (g *NamespaceGeneration) RemoveOperator(o OperatorSurface)

func (*NamespaceGeneration) ResetUnchecked

func (g *NamespaceGeneration) ResetUnchecked()

func (*NamespaceGeneration) UncheckedAPIs

func (g *NamespaceGeneration) UncheckedAPIs() APISet

type NamespaceGenerationEvolver

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

func (*NamespaceGenerationEvolver) Evolve

func (e *NamespaceGenerationEvolver) Evolve(add map[OperatorSourceInfo]struct{}) error

Evolve takes new requested operators, adds them to the generation, and attempts to resolve dependencies with querier

type NamespaceSet

type NamespaceSet map[string]struct{}

func NewNamespaceSet

func NewNamespaceSet(namespaces []string) NamespaceSet

func NewNamespaceSetFromString

func NewNamespaceSetFromString(namespaces string) NamespaceSet

NewNamespaceSetFromString creates a namespace set from a comma-delimited list of namespaces

func (NamespaceSet) Contains

func (n NamespaceSet) Contains(namespace string) bool

func (NamespaceSet) Intersection

func (n NamespaceSet) Intersection(set NamespaceSet) NamespaceSet

func (NamespaceSet) IsAllNamespaces

func (n NamespaceSet) IsAllNamespaces() bool

func (NamespaceSet) Peek

func (n NamespaceSet) Peek() string

func (NamespaceSet) Union

func (n NamespaceSet) Union(set NamespaceSet) NamespaceSet

type NamespaceSourceQuerier

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

func NewNamespaceSourceQuerier

func NewNamespaceSourceQuerier(sources map[CatalogKey]client.Interface) *NamespaceSourceQuerier

func (*NamespaceSourceQuerier) FindBundle

func (q *NamespaceSourceQuerier) FindBundle(pkgName, channelName, bundleName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error)

func (*NamespaceSourceQuerier) FindLatestBundle

func (q *NamespaceSourceQuerier) FindLatestBundle(pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error)

func (*NamespaceSourceQuerier) FindProvider

func (*NamespaceSourceQuerier) FindReplacement

func (q *NamespaceSourceQuerier) FindReplacement(currentVersion *semver.Version, bundleName, pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error)

func (*NamespaceSourceQuerier) Queryable

func (q *NamespaceSourceQuerier) Queryable() error

type Operator

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

func NewOperatorFromBundle

func NewOperatorFromBundle(bundle *opregistry.Bundle, replaces string, startingCSV string, sourceKey CatalogKey) (*Operator, error)

func NewOperatorFromV1Alpha1CSV

func NewOperatorFromV1Alpha1CSV(csv *v1alpha1.ClusterServiceVersion) (*Operator, error)

func (*Operator) Bundle

func (o *Operator) Bundle() *opregistry.Bundle

func (*Operator) Identifier

func (o *Operator) Identifier() string

func (*Operator) Package

func (o *Operator) Package() string

func (*Operator) ProvidedAPIs

func (o *Operator) ProvidedAPIs() APISet

func (*Operator) Replaces

func (o *Operator) Replaces() string

func (*Operator) RequiredAPIs

func (o *Operator) RequiredAPIs() APISet

func (*Operator) SourceInfo

func (o *Operator) SourceInfo() *OperatorSourceInfo

func (*Operator) Version

func (o *Operator) Version() *semver.Version

type OperatorGroup

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

func NewOperatorGroup

func NewOperatorGroup(group *v1.OperatorGroup) *OperatorGroup

func (*OperatorGroup) GroupIntersection

func (g *OperatorGroup) GroupIntersection(groups ...OperatorGroupSurface) []OperatorGroupSurface

func (*OperatorGroup) Identifier

func (g *OperatorGroup) Identifier() string

func (*OperatorGroup) Namespace

func (g *OperatorGroup) Namespace() string

func (*OperatorGroup) ProvidedAPIs

func (g *OperatorGroup) ProvidedAPIs() APISet

func (*OperatorGroup) Targets

func (g *OperatorGroup) Targets() NamespaceSet

type OperatorGroupSurface

type OperatorGroupSurface interface {
	Identifier() string
	Namespace() string
	Targets() NamespaceSet
	ProvidedAPIs() APISet
	GroupIntersection(groups ...OperatorGroupSurface) []OperatorGroupSurface
}

func NewOperatorGroupSurfaces

func NewOperatorGroupSurfaces(groups ...v1.OperatorGroup) []OperatorGroupSurface

type OperatorPermissions

type OperatorPermissions struct {
	ServiceAccount      *corev1.ServiceAccount
	Roles               []*rbacv1.Role
	RoleBindings        []*rbacv1.RoleBinding
	ClusterRoles        []*rbacv1.ClusterRole
	ClusterRoleBindings []*rbacv1.ClusterRoleBinding
}

func NewOperatorPermissions

func NewOperatorPermissions(serviceAccount *corev1.ServiceAccount) *OperatorPermissions

func (*OperatorPermissions) AddClusterRole

func (o *OperatorPermissions) AddClusterRole(clusterRole *rbacv1.ClusterRole)

func (*OperatorPermissions) AddClusterRoleBinding

func (o *OperatorPermissions) AddClusterRoleBinding(clusterRoleBinding *rbacv1.ClusterRoleBinding)

func (*OperatorPermissions) AddRole

func (o *OperatorPermissions) AddRole(role *rbacv1.Role)

func (*OperatorPermissions) AddRoleBinding

func (o *OperatorPermissions) AddRoleBinding(roleBinding *rbacv1.RoleBinding)

type OperatorSet

type OperatorSet map[string]OperatorSurface

func EmptyOperatorSet

func EmptyOperatorSet() OperatorSet

func (OperatorSet) Snapshot

func (o OperatorSet) Snapshot() OperatorSet

Snapshot returns a new set, pointing to the same values

type OperatorSourceInfo

type OperatorSourceInfo struct {
	Package     string
	Channel     string
	StartingCSV string
	Catalog     CatalogKey
}

func (*OperatorSourceInfo) String

func (i *OperatorSourceInfo) String() string

type OperatorSurface

type OperatorSurface interface {
	ProvidedAPIs() APISet
	RequiredAPIs() APISet
	Identifier() string
	Replaces() string
	Version() *semver.Version
	SourceInfo() *OperatorSourceInfo
	Bundle() *opregistry.Bundle
}

OperatorSurface describes the API surfaces provided and required by an Operator.

type OperatorsV1alpha1Resolver

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

func (*OperatorsV1alpha1Resolver) ResolveSteps

func (r *OperatorsV1alpha1Resolver) ResolveSteps(namespace string, sourceQuerier SourceQuerier) ([]*v1alpha1.Step, []*v1alpha1.Subscription, error)

type Resolver

type Resolver interface {
	ResolveSteps(namespace string, sourceQuerier SourceQuerier) ([]*v1alpha1.Step, []*v1alpha1.Subscription, error)
}

type SourceQuerier

type SourceQuerier interface {
	FindProvider(api opregistry.APIKey) (*opregistry.Bundle, *CatalogKey, error)
	FindBundle(pkgName, channelName, bundleName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error)
	FindLatestBundle(pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error)
	FindReplacement(currentVersion *semver.Version, bundleName, pkgName, channelName string, initialSource CatalogKey) (*opregistry.Bundle, *CatalogKey, error)
	Queryable() error
}

type SourceRef

type SourceRef struct {
	Address     string
	Client      client.Interface
	LastConnect metav1.Time
	LastHealthy metav1.Time
}

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