servicebindingrequest

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new ServiceBindingRequest Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.

func Done

func Done() (reconcile.Result, error)

Done when no error is informed and request is not set for requeue.

func Requeue

func Requeue(err error, requeueAfter int64) (reconcile.Result, error)

Requeue based on empty result and no error informed upstream, request will be requeued.

func RequeueError

func RequeueError(err error) (reconcile.Result, error)

RequeueError simply requeue exposing the error.

func RequeueOnNotFound

func RequeueOnNotFound(err error, requeueAfter int64) (reconcile.Result, error)

RequeueOnNotFound inspect error, if not-found then returns Requeue, otherwise expose the error.

Types

type Binder

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

Binder executes the "binding" act of updating different application kinds to use intermediary secret. Those secrets should be offered as environment variables.

func NewBinder

func NewBinder(
	ctx context.Context,
	client client.Client,
	dynClient dynamic.Interface,
	sbr *v1alpha1.ServiceBindingRequest,
	volumeKeys []string,
) *Binder

NewBinder returns a new Binder instance.

func (*Binder) Bind

func (b *Binder) Bind() ([]string, error)

Bind resources to intermediary secret, by searching informed ResourceKind containing the labels in ApplicationSelector, and then updating spec.

type Plan

type Plan struct {
	Ns             string                      // namespace name
	Name           string                      // plan name, same than ServiceBindingRequest
	CRDDescription *olmv1alpha1.CRDDescription // custom resource definition description
	CR             *ustrv1.Unstructured        // custom resource object
}

Plan outcome, after executing planner.

type Planner

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

Planner plans resources needed to bind a given backend service, using OperatorLifecycleManager standards and CustomResourceDefinitionDescription data to understand which attributes are needed.

func NewPlanner

func NewPlanner(
	ctx context.Context,
	client dynamic.Interface,
	sbr *v1alpha1.ServiceBindingRequest,
) *Planner

NewPlanner instantiate Planner type.

func (*Planner) Plan

func (p *Planner) Plan() (*Plan, error)

Plan by retrieving the necessary resources related to binding a service backend.

type Reconciler

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

Reconciler reconciles a ServiceBindingRequest object

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile a ServiceBindingRequest by the following steps:

  1. Inspecting SBR in order to identify backend service. The service is composed by a CRD name and kind, and by inspecting "connects-to" label identify the name of service instance;
  2. Using OperatorLifecycleManager standards, identifying which items are intersting for binding by parsing CustomResourceDefinitionDescripton object;
  3. Search and read contents identified in previous step, creating an intermediary secret to hold data formatted as environment variables key/value;
  4. Search applications that are interested to bind with given service, by inspecting labels. The Deployment (and other kinds) will be updated in "spec" level.

type Retriever

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

Retriever reads all data referred in plan instance, and store in a secret.

func NewRetriever

func NewRetriever(ctx context.Context, client client.Client, plan *Plan, bindingPrefix string) *Retriever

NewRetriever instantiate a new retriever instance.

func (*Retriever) Retrieve

func (r *Retriever) Retrieve() error

Retrieve loop and read data pointed by the references in plan instance.

Jump to

Keyboard shortcuts

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