Documentation
¶
Index ¶
- type Application
- type Bindable
- type BindingItem
- type BindingItems
- type Bindings
- type CRD
- type CRDDescription
- type Context
- type ContextProvider
- type EnvBinding
- type FlowStatus
- type Handler
- type HandlerFunc
- type HasResource
- type MetaContainer
- func (container *MetaContainer) AddEnvFromVar(envVar corev1.EnvFromSource) error
- func (container *MetaContainer) AddEnvVars(vars []corev1.EnvVar) error
- func (container *MetaContainer) AddVolumeMount(mount corev1.VolumeMount) error
- func (container *MetaContainer) MountPath(bindingName string) (string, error)
- func (container *MetaContainer) RemoveEnvFromVars(secretName string) error
- func (container *MetaContainer) RemoveEnvVars(name string) error
- func (container *MetaContainer) RemoveVolumeMount(name string) error
- type MetaPodSpec
- type Pipeline
- type SecretBackedBindings
- type Service
- type WorkloadContainer
- type WorkloadMapping
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 BindingItem ¶
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 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 the binding needs to be removed
UnbindRequested() bool
// Returns true if the binding is being removed
IsRemoved() bool
// Cleans temporary annotations on the underlying resources
CleanAnnotations() 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 ¶
Provides context for a given service binding
type EnvBinding ¶ added in v0.9.0
type FlowStatus ¶
Pipeline flow control
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
func (s *SecretBackedBindings) Source() *corev1.ObjectReference
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 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)
Click to show internal directories.
Click to hide internal directories.