pipeline

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application interface {

	// Application resource
	HasResource

	// optional dot-separated path inside the application resource locating field where intermediate binding secret ref should be injected
	// the returns value follows foo.bar.bla convention, but it can be empty
	SecretPath() string

	// Returns a container-like interface.
	BindablePods() (*MetaPodSpec, error)

	// A flag indicating if changes have been propogated
	IsUpdated() bool

	// GroupVersionResource of the application
	GroupVersionResource() schema.GroupVersionResource

	// Use a different mapping
	SetMapping(WorkloadMapping)
}

Application to be bound to service(s)

type Bindable added in v0.11.0

type Bindable interface {
	IsBindable() (bool, error)
}

type BindingItem

type BindingItem struct {
	Name   string
	Value  interface{}
	Source Service
}

type BindingItems

type BindingItems []*BindingItem

func (*BindingItems) AsMap

func (items *BindingItems) AsMap() map[string]string

Returns map representation of given list of binding items

type Bindings added in v0.8.0

type Bindings interface {
	// available bindgins
	Items() (BindingItems, error)

	// reference to resource holding the bindings, nil if not persisted in a resource
	Source() *v1.ObjectReference
}

a collection of bindings

type CRD

type CRD interface {

	// CRD resource
	HasResource

	Bindable
}

Custom Resource Definition

type CRDDescription added in v0.11.0

type CRDDescription olmv1alpha1.CRDDescription

func (*CRDDescription) BindingAnnotations added in v0.11.0

func (crdDescription *CRDDescription) BindingAnnotations() map[string]string

type Context

type Context interface {
	BindingName() string

	// Services referred by binding
	// if reading fails, return error
	Services() ([]Service, error)

	// Applications referred by binding
	// if no application found, return an error
	Applications() ([]Application, error)

	// Returns true if binding is about to be removed
	UnbindRequested() bool

	BindingSecretName() string

	// Return true if bindings should be projected as files inside application containers
	BindAsFiles() bool

	// Template that should be applied on collected binding names, prior projection
	NamingTemplate() string

	// Additional bindings that will be projected into application containers
	// entry key is the future binding name
	// entry value contains template that generates binding value
	Mappings() map[string]string

	// Add binding item to the context
	AddBindingItem(item *BindingItem)

	// Add bindings to the context
	AddBindings(bindings Bindings)

	// List binding items that should be projected into application containers
	BindingItems() BindingItems

	// EnvBindings returns list of (env variable name, binding name) pairs
	// describing what binding should be injected as env var as well
	EnvBindings() []*EnvBinding

	// Indicates that the binding should be retried at some later time
	// The current processing stops and context gets closed
	RetryProcessing(reason error)

	// Indicates that the binding should be retried with a delay.  The context will determine the
	// appropriate delay to add.  This will close the context, and is similar to RetryProcessing
	DelayReprocessing(reason error)

	// Indicates that en error has occurred while processing the binding
	Error(err error)

	// Stops processing
	StopProcessing()

	// Closes the context, persisting changed resources
	// Returns error if occurrs
	Close() error

	// Persists the secret containing binding data into the cluster.
	PersistSecret() error

	// Sets context condition
	SetCondition(condition *metav1.Condition)

	kubernetes.ConfigMapReader
	kubernetes.SecretReader

	FlowStatus() FlowStatus

	WorkloadResourceTemplate(gvr *schema.GroupVersionResource, containerPath string) (*WorkloadMapping, error)

	// Is this service binding getting its workloads from a label selector?
	HasLabelSelector() bool
}

Pipeline context passed to each handler

type ContextProvider

type ContextProvider interface {
	Get(binding interface{}) (Context, error)
}

Provides context for a given service binding

type EnvBinding added in v0.9.0

type EnvBinding struct {
	Var  string
	Name string
}

type FlowStatus

type FlowStatus struct {
	Retry bool
	Stop  bool
	Err   error
	Delay time.Duration
}

Pipeline flow control

type Handler

type Handler interface {
	Handle(ctx Context)
}

A pipeline stage

type HandlerFunc

type HandlerFunc func(ctx Context)

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx Context)

type HasResource

type HasResource interface {
	Resource() *unstructured.Unstructured
}

type MetaContainer added in v1.1.0

type MetaContainer struct {
	Name        string
	Env         []string
	EnvFrom     []string
	VolumeMount []string
	Data        map[string]interface{}
}

A container-like object. EnvFrom is optional; all other fields are required.

func (*MetaContainer) AddEnvFromVar added in v1.1.0

func (container *MetaContainer) AddEnvFromVar(envVar corev1.EnvFromSource) error

func (*MetaContainer) AddEnvVars added in v1.1.0

func (container *MetaContainer) AddEnvVars(vars []corev1.EnvVar) error

func (*MetaContainer) AddVolumeMount added in v1.1.0

func (container *MetaContainer) AddVolumeMount(mount corev1.VolumeMount) error

func (*MetaContainer) MountPath added in v1.1.0

func (container *MetaContainer) MountPath(bindingName string) (string, error)

func (*MetaContainer) RemoveEnvFromVars added in v1.1.0

func (container *MetaContainer) RemoveEnvFromVars(secretName string) error

func (*MetaContainer) RemoveEnvVars added in v1.1.0

func (container *MetaContainer) RemoveEnvVars(name string) error

func (*MetaContainer) RemoveVolumeMount added in v1.1.0

func (container *MetaContainer) RemoveVolumeMount(name string) error

type MetaPodSpec added in v1.1.0

type MetaPodSpec struct {
	Containers []MetaContainer
	Volume     []string
	Data       map[string]interface{}
}

func (*MetaPodSpec) AddVolume added in v1.1.0

func (template *MetaPodSpec) AddVolume(volume corev1.Volume) error

func (*MetaPodSpec) RemoveVolume added in v1.1.0

func (template *MetaPodSpec) RemoveVolume(name string) error

type Pipeline

type Pipeline interface {

	// Reconcile given service binding
	// Returns true if processing should be repeated
	// and optional error if occurred
	// important: even if error occurred it might not be needed to retry processing
	Process(binding interface{}) (bool, time.Duration, error)
}

Reconciliation pipeline

type SecretBackedBindings added in v0.8.0

type SecretBackedBindings struct {
	// service associated to the bindings
	Service Service

	// secret containing the bindings
	// each binding correspond to a (key, value) pair
	Secret *unstructured.Unstructured
	// contains filtered or unexported fields
}

bindings whose life-cycle is bound to k8s secret

func (*SecretBackedBindings) Items added in v0.8.0

func (s *SecretBackedBindings) Items() (BindingItems, error)

func (*SecretBackedBindings) Source added in v0.8.0

type Service

type Service interface {

	// Service resource
	HasResource

	// Return CRD for this service, otherwise nil if not backed by CRD
	// Error might be returned if occurred during the operation
	CustomResourceDefinition() (CRD, error)

	// Resources owned by the service, if any
	// Error might be returned if occurred during the operation
	OwnedResources() ([]*unstructured.Unstructured, error)

	// Attach binding definition to service
	AddBindingDef(def binding.Definition)

	// All binding definitions attached to the service
	BindingDefs() []binding.Definition

	// Optional service id
	Id() *string

	Bindable
}

Service to be bound

type WorkloadContainer added in v1.1.0

type WorkloadContainer struct {
	Path         *jsonpath.JSONPath
	Name         []string
	Env          []string
	EnvFrom      []string
	VolumeMounts []string
}

type WorkloadMapping added in v1.1.0

type WorkloadMapping struct {
	Containers []WorkloadContainer
	Volume     []string
}

func FromWorkloadResourceMappingTemplate added in v1.1.0

func FromWorkloadResourceMappingTemplate(mapping v1beta1.ClusterWorkloadResourceMappingTemplate) (*WorkloadMapping, error)

Directories

Path Synopsis
handler
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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