controller

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

Types

type BindingLabelsFetcher

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

BindingLabelsFetcher extracts binding labels defined in ClusterServiceClass for given ServiceBinding

func NewBindingLabelsFetcher

func NewBindingLabelsFetcher(siLister scListers.ServiceInstanceLister,
	scLister scListers.ClusterServiceClassLister) *BindingLabelsFetcher

NewBindingLabelsFetcher returnd BindingLabelsFetcher

func (*BindingLabelsFetcher) Fetch

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

Fetch returns binding labels defined in ClusterServiceClass

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 DeploymentSupervisor

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

DeploymentSupervisor validates if Deployment can be modified by given ServiceBindingUsage. If yes it can ensure that labels are present or deleted on Deployment

func NewDeploymentSupervisor

func NewDeploymentSupervisor(deploymentInformer informerV1beta2.DeploymentInformer, appsClient clientAppsV1beta2.AppsV1beta2Interface, log logrus.FieldLogger) *DeploymentSupervisor

NewDeploymentSupervisor creates a new DeploymentSupervisor.

func (*DeploymentSupervisor) EnsureLabelsCreated

func (m *DeploymentSupervisor) EnsureLabelsCreated(deployNS, deployName, usageName string, labels map[string]string) error

EnsureLabelsCreated ensures that given labels are added to Deployment

func (*DeploymentSupervisor) EnsureLabelsDeleted

func (m *DeploymentSupervisor) EnsureLabelsDeleted(deployNs, deployName, usageName string) error

EnsureLabelsDeleted ensures that given labels are deleted on Deployment

func (*DeploymentSupervisor) GetInjectedLabels

func (m *DeploymentSupervisor) GetInjectedLabels(deployNS, deployName, usageName string) (map[string]string, error)

GetInjectedLabels returns labels applied on given Deployment by usage controller

func (*DeploymentSupervisor) HasSynced

func (m *DeploymentSupervisor) HasSynced() bool

HasSynced returns true if the shared informer's store has synced

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 InterfaceProvider.

func NewGenericSupervisor

func NewGenericSupervisor(interfaceProvider InterfaceProvider, labeler labelDeleteApplier, 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 InterfaceProvider

type InterfaceProvider interface {
	ResourceInterface(namespace string) dynamic.ResourceInterface
}

InterfaceProvider provides dynamic.ResourceInterface for given namespace

type Kind

type Kind string

Kind represents Kubernetes Kind name

const (
	// KindDeployment represents Deployment resource
	KindDeployment Kind = "Deployment"
	// KindKubelessFunction represents Kubeless Function resource
	KindKubelessFunction Kind = "Function"
)

type KubelessFunctionSupervisor

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

KubelessFunctionSupervisor validates if Function can be modified by given ServiceBindingUsage. If yes it can ensure that labels are present or deleted on Deployment for given Function

func NewKubelessFunctionSupervisor

func NewKubelessFunctionSupervisor(fnInformer kubelessInformer.FunctionInformer, kubelessClient kubelessClient.KubelessV1beta1Interface, log logrus.FieldLogger) *KubelessFunctionSupervisor

NewKubelessFunctionSupervisor creates a new KubelessFunctionSupervisor.

func (*KubelessFunctionSupervisor) EnsureLabelsCreated

func (m *KubelessFunctionSupervisor) EnsureLabelsCreated(fnNs, fnName, usageName string, labels map[string]string) error

EnsureLabelsCreated ensures that given labels are added to Deployment for given Function

func (*KubelessFunctionSupervisor) EnsureLabelsDeleted

func (m *KubelessFunctionSupervisor) EnsureLabelsDeleted(fnNs, fnName, usageName string) error

EnsureLabelsDeleted ensures that given labels are deleted on Deployment for given Function

func (*KubelessFunctionSupervisor) GetInjectedLabels

func (m *KubelessFunctionSupervisor) GetInjectedLabels(fnNS, fnName, usageName string) (map[string]string, error)

GetInjectedLabels returns labels applied on given Function

func (*KubelessFunctionSupervisor) HasSynced

func (m *KubelessFunctionSupervisor) HasSynced() bool

HasSynced returns true if the shared informer's store has synced

type KubernetesResourceSupervisor

type KubernetesResourceSupervisor interface {
	HasSynced() bool
	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 clientSettingsV1alpha1.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 *k8sSettings.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) HasSynced

func (f *ResourceSupervisorAggregator) HasSynced() bool

HasSynced returns true if all registered supervisors are synced

func (*ResourceSupervisorAggregator) Register

Register adds new resource supervisor

func (*ResourceSupervisorAggregator) Unregister

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

Unregister removes resource supervisor

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,
	log logrus.FieldLogger) *ServiceBindingUsageController

NewServiceBindingUsage creates a new ServiceBindingUsageController.

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 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 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