Documentation
¶
Index ¶
- Constants
- func Add(mgr manager.Manager) error
- func Done() (reconcile.Result, error)
- func GetSBRNamespacedNameFromObject(obj runtime.Object) (types.NamespacedName, error)
- func IsNamespacedNameEmpty(namespacedName types.NamespacedName) bool
- func NewCreateWatchEventHandler(controller *SBRController) handler.EventHandler
- func Requeue(err error, requeueAfter int64) (reconcile.Result, error)
- func RequeueError(err error) (reconcile.Result, error)
- func RequeueOnNotFound(err error, requeueAfter int64) (reconcile.Result, error)
- func SetSBRAnnotations(client dynamic.Interface, namespacedName types.NamespacedName, ...) error
- type Binder
- type CSVToWatcherMapper
- type CustomEnvParser
- type OLM
- func (o *OLM) ListCSVOwnedCRDs() ([]unstructured.Unstructured, error)
- func (o *OLM) ListCSVOwnedCRDsAsGVKs() ([]schema.GroupVersionKind, error)
- func (o *OLM) ListGVKsFromCSVNamespacedName(namespacedName types.NamespacedName) ([]schema.GroupVersionKind, error)
- func (o *OLM) SelectCRDByGVK(gvk schema.GroupVersionKind) (*olmv1alpha1.CRDDescription, error)
- type Plan
- type Planner
- type Reconciler
- type Retriever
- type SBRController
- type SBRRequestMapper
Constants ¶
const ClusterServiceVersionKind = "ClusterServiceVersion"
ClusterServiceVersionKind the name of ClusterServiceVersion kind.
const DeploymentConfigKind = "DeploymentConfig"
DeploymentConfigKind defines the name of DeploymentConfig kind.
const ServiceBindingRequestKind = "ServiceBindingRequest"
ServiceBindingRequestKind defines the name of the CRD kind.
const ServiceBindingRequestResource = "servicebindingrequests"
ServiceBindingRequestResource the name of ServiceBindingRequest resource.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
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 GetSBRNamespacedNameFromObject ¶ added in v0.0.19
func GetSBRNamespacedNameFromObject(obj runtime.Object) (types.NamespacedName, error)
GetSBRNamespacedNameFromObject returns a types.NamespacedName if the required service binding request annotations are present in the given runtime.Object, empty otherwise. When annotations are not present, it checks if the object is an actual SBR, returning the details when positive. An error can be returned in the case the object can't be decoded.
func IsNamespacedNameEmpty ¶ added in v0.0.19
func IsNamespacedNameEmpty(namespacedName types.NamespacedName) bool
IsNamespacedNameEmpty returns true if any of the fields from the given namespacedName is empty.
func NewCreateWatchEventHandler ¶ added in v0.0.19
func NewCreateWatchEventHandler(controller *SBRController) handler.EventHandler
NewCreateWatchEventHandler creates a new instance of handler.EventHandler interface with CSVToWatcherMapper as map-func.
func Requeue ¶
Requeue based on empty result and no error informed upstream, request will be requeued.
func RequeueError ¶
RequeueError simply requeue exposing the error.
func RequeueOnNotFound ¶
RequeueOnNotFound inspect error, if not-found then returns Requeue, otherwise expose the error.
func SetSBRAnnotations ¶ added in v0.0.19
func SetSBRAnnotations( client dynamic.Interface, namespacedName types.NamespacedName, objs []*unstructured.Unstructured, ) error
SetSBRAnnotations update existing annotations to include operator's. The annotations added are referring to a existing SBR namespaced name.
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() ([]*unstructured.Unstructured, error)
Bind resources to intermediary secret, by searching informed ResourceKind containing the labels in ApplicationSelector, and then updating spec.
type CSVToWatcherMapper ¶ added in v0.0.19
type CSVToWatcherMapper struct {
// contains filtered or unexported fields
}
CSVToWatcherMapper creates a EventHandler interface to map ClusterServiceVersion objects back to controller and add given GVK to watch list.
type CustomEnvParser ¶ added in v0.0.19
type CustomEnvParser struct {
EnvMap []v1alpha1.CustomEnvMap
Cache map[string]interface{}
}
func NewCustomEnvParser ¶ added in v0.0.19
func NewCustomEnvParser(envMap []v1alpha1.CustomEnvMap, cache map[string]interface{}) *CustomEnvParser
func (*CustomEnvParser) Parse ¶ added in v0.0.19
func (c *CustomEnvParser) Parse() (map[string]interface{}, error)
type OLM ¶ added in v0.0.19
type OLM struct {
// contains filtered or unexported fields
}
OLM represents the actions this operator needs to take upon Operator-Lifecycle-Manager resources, like ClusterServiceVersions (CSV) and CRDDescriptions.
func (*OLM) ListCSVOwnedCRDs ¶ added in v0.0.19
func (o *OLM) ListCSVOwnedCRDs() ([]unstructured.Unstructured, error)
ListCSVOwnedCRDs return a unstructured list of CRD objects from "owned" section in CSVs.
func (*OLM) ListCSVOwnedCRDsAsGVKs ¶ added in v0.0.19
func (o *OLM) ListCSVOwnedCRDsAsGVKs() ([]schema.GroupVersionKind, error)
ListCSVOwnedCRDsAsGVKs return the list of owned CRDs from all CSV objects as a list of GVKs.
func (*OLM) ListGVKsFromCSVNamespacedName ¶ added in v0.0.19
func (o *OLM) ListGVKsFromCSVNamespacedName( namespacedName types.NamespacedName, ) ([]schema.GroupVersionKind, error)
ListGVKsFromCSVNamespacedName return the list of owned GVKs for a given CSV namespaced named.
func (*OLM) SelectCRDByGVK ¶ added in v0.0.19
func (o *OLM) SelectCRDByGVK(gvk schema.GroupVersionKind) (*olmv1alpha1.CRDDescription, error)
SelectCRDByGVK return a single CRD based on a given GVK.
type Plan ¶
type Plan struct {
Ns string // namespace name
Name string // plan name, same than ServiceBindingRequest
CRDDescription *olmv1alpha1.CRDDescription // custom resource definition description
CR *unstructured.Unstructured // custom resource object
SBR v1alpha1.ServiceBindingRequest // service binding request
}
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.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler reconciles a ServiceBindingRequest object
func (*Reconciler) Reconcile ¶
Reconcile a ServiceBindingRequest by the following steps:
- 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;
- Using OperatorLifecycleManager standards, identifying which items are intersting for binding by parsing CustomResourceDefinitionDescripton object;
- Search and read contents identified in previous step, creating an intermediary secret to hold data formatted as environment variables key/value;
- 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 ¶
NewRetriever instantiate a new retriever instance.
func (*Retriever) Retrieve ¶
func (r *Retriever) Retrieve() ([]*unstructured.Unstructured, error)
Retrieve loop and read data pointed by the references in plan instance. It returns a slice of Unstructured refering the objects in use by the Retriever, and error when issues reading fields.
type SBRController ¶ added in v0.0.19
type SBRController struct {
Controller controller.Controller // controller-runtime instance
Client dynamic.Interface // kubernetes dynamic api client
// contains filtered or unexported fields
}
SBRController hold the controller instance and methods for a ServiceBindingRequest.
func NewSBRController ¶ added in v0.0.19
func NewSBRController( mgr manager.Manager, options controller.Options, client dynamic.Interface, ) (*SBRController, error)
NewSBRController creates a new SBRController instance. It can return error on bootstrapping a new dynamic client.
func (*SBRController) AddWatchForGVK ¶ added in v0.0.19
func (s *SBRController) AddWatchForGVK(gvk schema.GroupVersionKind) error
AddWatchForGVK creates a watch on a given GVK, as long as it's not duplicated.
func (*SBRController) Watch ¶ added in v0.0.19
func (s *SBRController) Watch() error
Watch setup "watch" for all GVKs relevant for SBRController.
type SBRRequestMapper ¶ added in v0.0.19
type SBRRequestMapper struct{}
SBRRequestMapper is the handler.Mapper interface implementation. It should influence the enqueue process considering the resources informed.
func (*SBRRequestMapper) Map ¶ added in v0.0.19
func (m *SBRRequestMapper) Map(obj handler.MapObject) []reconcile.Request
Map execute the mapping of a resource with the requests it would produce. Here we inspect the given object trying to identify if this object is part of a SBR, or a actual SBR resource.