controller

package
v0.0.0-...-a52e8f6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LivenessBUCSample name of ServiceBindingUsage used for liveness probe
	LivenessBUCSample = "informer.liveness.probe.service.binding.usage.name"
)

Variables

This section is empty.

Functions

func EnsureMapIsInitiated

func EnsureMapIsInitiated(m map[string]string) map[string]string

EnsureMapIsInitiated ensures that given map is initiated. - returns given map if it's already allocated - otherwise returns empty map

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if given error is NotFound error

func Merge

func Merge(m1, m2 map[string]string) (map[string]string, error)

Merge returns map which is union of input maps. In case of of the same key defined in both maps, ConflictError will be returned

func NewGuard

func NewGuard(
	sbuClient sbuClient.ServicecatalogV1alpha1Interface,
	ks kindsSupervisors,
	sbuDelay time.Duration,
	log logrus.FieldLogger) *guard

NewGuard creates a new guard

Types

type BindingLabelsFetcher

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

BindingLabelsFetcher extracts binding labels defined in ClusterServiceClass for given ServiceBinding

func NewBindingLabelsFetcher

NewBindingLabelsFetcher returnd BindingLabelsFetcher

func (*BindingLabelsFetcher) Fetch

func (c *BindingLabelsFetcher) Fetch(svcBinding *scTypes.ServiceBinding) (map[string]string, error)

Fetch returns binding labels defined in ClusterServiceClass/ServiceClass

type BindingUsageSpecStorage

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

BindingUsageSpecStorage provides functionality to get/delete/save ServiceBindingUsage.Spec

func NewBindingUsageSpecStorage

func NewBindingUsageSpecStorage(cfgMapClient configMapClient, cfgMapName string) *BindingUsageSpecStorage

NewBindingUsageSpecStorage returns new instance of BindingUsageSpecStorage

func (*BindingUsageSpecStorage) Delete

func (c *BindingUsageSpecStorage) Delete(namespace, name string) error

Delete deletes stored spec for given ServiceBindingUsage

func (*BindingUsageSpecStorage) Get

func (c *BindingUsageSpecStorage) Get(usageNS, usageName string) (*UsageSpec, bool, error)

Get returns stored spec for given ServiceBindingUsage

func (*BindingUsageSpecStorage) Upsert

func (c *BindingUsageSpecStorage) Upsert(bUsage *sbuTypes.ServiceBindingUsage, applied bool) error

Upsert upserts spec for given ServiceBindingUsage

type ConflictError

type ConflictError struct {
	ConflictingResource string
}

ConflictError indicates situation when conflict occurs

func (*ConflictError) Error

func (e *ConflictError) Error() string

type GenericSupervisor

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

GenericSupervisor ensures that expected labels are present or not on a k8s resource provided by given resourceInterface.

func NewGenericSupervisor

func NewGenericSupervisor(resourceInterface dynamic.NamespaceableResourceInterface, labeler labelsSvc, log logrus.FieldLogger) *GenericSupervisor

NewGenericSupervisor creates a new GenericSupervisor.

func (*GenericSupervisor) EnsureLabelsCreated

func (m *GenericSupervisor) EnsureLabelsCreated(namespace, resourceName, usageName string, labels map[string]string) error

EnsureLabelsCreated ensures that given labels are added to resource

func (*GenericSupervisor) EnsureLabelsDeleted

func (m *GenericSupervisor) EnsureLabelsDeleted(namespace, resourceName, usageName string) error

EnsureLabelsDeleted ensures that given labels are deleted on resource

func (*GenericSupervisor) GetInjectedLabels

func (m *GenericSupervisor) GetInjectedLabels(namespace, resourceName, usageName string) (map[string]string, error)

GetInjectedLabels returns labels applied on given resource by usage controller

func (*GenericSupervisor) HasSynced

func (m *GenericSupervisor) HasSynced() bool

HasSynced returns true, because the GenericSupervisor does not use any informers/caches

type Kind

type Kind string

Kind represents Kubernetes Kind name

type KubernetesResourceSupervisor

type KubernetesResourceSupervisor interface {
	EnsureLabelsCreated(resourceNs, resourceName, usageName string, labels map[string]string) error
	EnsureLabelsDeleted(resourceNs, resourceName, usageName string) error
	GetInjectedLabels(resourceNs, resourceName, usageName string) (map[string]string, error)
}

KubernetesResourceSupervisor validates if given Kubernetes resource can be modified by ServiceBindingUsage. If yes it can ensure that labels are present or deleted on previous validated resource.

type NotFoundError

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

NotFoundError indicates situation when given resource was not found

func NewNotFoundError

func NewNotFoundError(format string, args ...interface{}) NotFoundError

NewNotFoundError returns a new not found error with given message

func (NotFoundError) Error

func (e NotFoundError) Error() string

func (NotFoundError) NotFound

func (NotFoundError) NotFound() bool

NotFound returns information if such error should be treated as not found

type PodPresetModifier

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

PodPresetModifier provides functionality needed to create and delete PodPreset

func NewPodPresetModifier

func NewPodPresetModifier(settingsClient settingsv1alpha1.SettingsV1alpha1Interface) *PodPresetModifier

NewPodPresetModifier creates a new PodPresetModifier

func (*PodPresetModifier) EnsurePodPresetDeleted

func (m *PodPresetModifier) EnsurePodPresetDeleted(namespace, name string) error

EnsurePodPresetDeleted deletes a PodPreset if needed

func (*PodPresetModifier) UpsertPodPreset

func (m *PodPresetModifier) UpsertPodPreset(podPreset *svcatSettings.PodPreset) error

UpsertPodPreset creates a new PodPreset or update it if needed

type ResourceSupervisorAggregator

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

ResourceSupervisorAggregator aggregates all defined resources supervisors

func NewResourceSupervisorAggregator

func NewResourceSupervisorAggregator() *ResourceSupervisorAggregator

NewResourceSupervisorAggregator returns new instance of ResourceSupervisorAggregator

func (*ResourceSupervisorAggregator) Get

Get returns supervisor for given kind

func (*ResourceSupervisorAggregator) Register

Register adds new resource supervisor

func (*ResourceSupervisorAggregator) Unregister

func (f *ResourceSupervisorAggregator) Unregister(k Kind) error

Unregister removes resource supervisor

type SBUDeletedEvent

type SBUDeletedEvent struct {
	UsedByKind string
	Namespace  string
	Name       string
}

SBUDeletedEvent contains information about deleted ServiceBindingUsage

type ServiceBindingUsageController

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

ServiceBindingUsageController watches ServiceBindingUsage and injects data to given Deployment/Function

func NewServiceBindingUsage

func NewServiceBindingUsage(
	appliedSpecStorage appliedSpecStorage,
	bindingUsageClient sbuClient.ServicecatalogV1alpha1Interface,
	sbuInformer sbuInformer.ServiceBindingUsageInformer,
	bindingInformer scInformer.ServiceBindingInformer,
	kindSupervisors kindsSupervisors,
	podPresetModifier podPresetModifier,
	labelsFetcher bindingLabelsFetcher,
	sbuGuard sbuGuard,
	log logrus.FieldLogger,
	cbm businessMetric) *ServiceBindingUsageController

NewServiceBindingUsage creates a new ServiceBindingUsageController.

func (*ServiceBindingUsageController) AddOnDeleteListener

func (c *ServiceBindingUsageController) AddOnDeleteListener(listener onDeleteListener)

AddOnDeleteListener adds OnDeleteListener The method is not thread safe

func (*ServiceBindingUsageController) Run

func (c *ServiceBindingUsageController) Run(stopCh <-chan struct{})

Run begins watching and syncing.

type UsageSpec

type UsageSpec struct {
	UsedBy  sbuTypes.LocalReferenceByKindAndName
	Applied bool
}

UsageSpec represents DTO which is used to store information about applied sbu in config map

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
automock
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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