{"modulePath":"github.com/redhat-developer/service-binding-operator","version":"v0.1.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package servicebindingrequest\n\n## Constants\n\n```go\nconst (\n\t// ServiceBindingRequestResource the name of ServiceBindingRequest resource.\n\tServiceBindingRequestResource = \"servicebindingrequests\"\n\t// ServiceBindingRequestKind defines the name of the CRD kind.\n\tServiceBindingRequestKind = \"ServiceBindingRequest\"\n\t// DeploymentConfigKind defines the name of DeploymentConfig kind.\n\tDeploymentConfigKind = \"DeploymentConfig\"\n\t// ClusterServiceVersionKind the name of ClusterServiceVersion kind.\n\tClusterServiceVersionKind = \"ClusterServiceVersion\"\n\t// SecretResource defines the resource name for Secrets.\n\tSecretResource = \"secrets\"\n\t// SecretKind defines the name of Secret kind.\n\tSecretKind = \"Secret\"\n)\n```\n\n```go\nconst (\n\t// BindingReady indicates that the binding succeeded\n\tBindingReady conditionsv1.ConditionType = \"Ready\"\n\t// EmptyServiceSelectorsReason is used when the ServiceBindingRequest has empty\n\t// backingServiceSelectors.\n\tEmptyServiceSelectorsReason = \"EmptyServiceSelectors\"\n)\n```\n\n```go\nconst (\n\t// BindingSuccess binding has succeeded\n\tBindingSuccess = \"BindingSuccess\"\n\t// BindingFail binding has failed\n\tBindingFail = \"BindingFail\"\n\t//Finalizer annotation used in finalizer steps\n\tFinalizer = \"finalizer.servicebindingrequest.openshift.io\"\n)\n```\n\n```go\nconst ChangeTriggerEnv = \"ServiceBindingOperatorChangeTriggerEnvVar\"\n```\nChangeTriggerEnv hijacking environment in order to trigger a change\n\n## Variables\n\n```go\nvar (\n\t// ErrUnspecifiedBackingServiceNamespace is returned when the namespace of a service is\n\t// unspecified.\n\tErrUnspecifiedBackingServiceNamespace = errors.New(\"backing service namespace is unspecified\")\n\t// EmptyBackingServiceSelectorsErr is returned when no backing service selectors have been\n\t// informed in the Service Binding Request.\n\tErrEmptyBackingServiceSelectors = errors.New(\"backing service selectors are empty\")\n)\n```\n\n```go\nvar ApplicationNotFound = errors.New(\"Application is already deleted\")\n```\n\n```go\nvar CRDGVR = schema.GroupVersionResource{\n\tGroup:    \"apiextensions.k8s.io\",\n\tVersion:  \"v1beta1\",\n\tResource: \"customresourcedefinitions\",\n}\n```\nCRDGVR is the plural GVR for Kubernetes CRDs.\n\n```go\nvar EmptyApplicationSelectorErr = errors.New(\"application ResourceRef or MatchLabel not found\")\n```\n\n```go\nvar GroupVersion = v1alpha1.SchemeGroupVersion.WithResource(ServiceBindingRequestResource)\n```\nGroupVersion represents the service binding request resource's group version.\n\n## Functions\n\n```go\nfunc Add(mgr manager.Manager) error\n```\nAdd 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.\n\n```go\nfunc Done() (reconcile.Result, error)\n```\nDone when no error is informed and request is not set for requeue.\n\n```go\nfunc DoneOnNotFound(err error) (reconcile.Result, error)\n```\nDoneOnNotFound will return done when error is not-found, otherwise it calls out NoRequeue.\n\n```go\nfunc GetSBRNamespacedNameFromObject(obj runtime.Object) (types.NamespacedName, error)\n```\nGetSBRNamespacedNameFromObject 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.\n\n```go\nfunc IsNamespacedNameEmpty(namespacedName types.NamespacedName) bool\n```\nIsNamespacedNameEmpty returns true if any of the fields from the given namespacedName is empty.\n\n```go\nfunc NewCreateWatchEventHandler(controller *SBRController) handler.EventHandler\n```\nNewCreateWatchEventHandler creates a new instance of handler.EventHandler interface with CSVToWatcherMapper as map-func.\n\n```go\nfunc NoRequeue(err error) (reconcile.Result, error)\n```\nNoRequeue returns error without requeue flag.\n\n```go\nfunc RemoveAndUpdateSBRAnnotations(client dynamic.Interface, objs []*unstructured.Unstructured) error\n```\nRemoveAndUpdateSBRAnnotations removes SBR related annotations from all the objects and updates them using the given client.\n\n```go\nfunc RemoveSBRAnnotations(obj *unstructured.Unstructured) *unstructured.Unstructured\n```\nRemoveSBRAnnotations removes SBR related annotations and return a new object.\n\n```go\nfunc Requeue(err error, requeueAfter int64) (reconcile.Result, error)\n```\nRequeue based on empty result and no error informed upstream, request will be requeued.\n\n```go\nfunc RequeueError(err error) (reconcile.Result, error)\n```\nRequeueError simply requeue exposing the error.\n\n```go\nfunc RequeueOnConflict(err error) (reconcile.Result, error)\n```\nRequeueOnConflict in case of conflict error, returning the error with requeue, otherwise Done.\n\n```go\nfunc RequeueOnNotFound(err error, requeueAfter int64) (reconcile.Result, error)\n```\nRequeueOnNotFound inspect error, if not-found then returns Requeue, otherwise expose the error.\n\n```go\nfunc SetAndUpdateSBRAnnotations(\n\tclient dynamic.Interface,\n\tnamespacedName types.NamespacedName,\n\tobjs []*unstructured.Unstructured,\n) error\n```\nSetAndUpdateSBRAnnotations update existing annotations to include operator's. The annotations added are referring to a existing SBR namespaced name.\n\n```go\nfunc SetSBRAnnotations(namespacedName types.NamespacedName,\n\tobj *unstructured.Unstructured) *unstructured.Unstructured\n```\nSetSBRAnnotations set annotations to include SBR information and return a new object.\n\n## Types\n\n```go\ntype Binder struct {\n\t// contains filtered or unexported fields\n}\n```\nBinder executes the \"binding\" act of updating different application kinds to use intermediary secret. Those secrets should be offered as environment variables.\n\n```go\nfunc NewBinder(\n\tctx context.Context,\n\tdynClient dynamic.Interface,\n\tsbr *v1alpha1.ServiceBindingRequest,\n\tvolumeKeys []string,\n\trestMapper meta.RESTMapper,\n) *Binder\n```\nNewBinder returns a new Binder instance.\n\n```go\nfunc (b *Binder) Bind() ([]*unstructured.Unstructured, error)\n```\nBind resources to intermediary secret, by searching informed ResourceKind containing the labels in ApplicationSelector, and then updating spec.\n\n```go\nfunc (b *Binder) Unbind() error\n```\nUnbind select objects subject to binding, and proceed with \"remove\", which will unbind objects.\n\n```go\ntype Binding struct {\n\tEnvVars    map[string][]byte\n\tVolumeKeys []string\n}\n```\n\n```go\ntype CSVToWatcherMapper struct {\n\t// contains filtered or unexported fields\n}\n```\nCSVToWatcherMapper creates a EventHandler interface to map ClusterServiceVersion objects back to controller and add given GVK to watch list.\n\n```go\nfunc (c *CSVToWatcherMapper) Map(obj handler.MapObject) []reconcile.Request\n```\nMap requests directed to CSV objects and exctract related GVK to trigger another watch on controller instance.\n\n```go\ntype CustomEnvParser struct {\n\tEnvMap []corev1.EnvVar\n\tCache  map[string]interface{}\n}\n```\nCustomEnvParser is responsible to interpolate a given EnvVar containing templates.\n\n```go\nfunc NewCustomEnvParser(envMap []corev1.EnvVar, cache map[string]interface{}) *CustomEnvParser\n```\nNewCustomEnvParser returns a new CustomEnvParser.\n\n```go\nfunc (c *CustomEnvParser) Parse() (map[string]interface{}, error)\n```\nParse interpolates and caches the templates in EnvMap.\n\n```go\ntype ErrInvalidServiceBinderOptions string\n```\nErrInvalidServiceBinderOptions is returned when ServiceBinderOptions contains an invalid value.\n\n```go\nfunc (e ErrInvalidServiceBinderOptions) Error() string\n```\n\n```go\ntype ExtraFieldsModifier interface {\n\tModifyExtraFields(u *unstructured.Unstructured) error\n}\n```\nExtraFieldsModifier is useful for updating backend service which requires additional changes besides env/volumes updating. eg. for knative service we need to remove or update \\`spec.template.metadata.name\\` from service template before updating otherwise it will be rejected.\n\n```go\ntype ExtraFieldsModifierFunc func(u *unstructured.Unstructured) error\n```\nExtraFieldsModifierFunc func receiver type for ExtraFieldsModifier\n\n```go\nfunc (f ExtraFieldsModifierFunc) ModifyExtraFields(u *unstructured.Unstructured) error\n```\nModifyExtraFields implements ExtraFieldsModifier interface\n\n```go\ntype OLM struct {\n\t// contains filtered or unexported fields\n}\n```\nOLM represents the actions this operator needs to take upon Operator-Lifecycle-Manager resources, like ClusterServiceVersions (CSV) and CRDDescriptions.\n\n```go\nfunc NewOLM(client dynamic.Interface, ns string) *OLM\n```\nNewOLM instantiate a new OLM.\n\n```go\nfunc (o *OLM) ListCSVOwnedCRDs() ([]unstructured.Unstructured, error)\n```\nListCSVOwnedCRDs return a unstructured list of CRD objects from \"owned\" section in CSVs.\n\n```go\nfunc (o *OLM) ListCSVOwnedCRDsAsGVKs() ([]schema.GroupVersionKind, error)\n```\nListCSVOwnedCRDsAsGVKs return the list of owned CRDs from all CSV objects as a list of GVKs.\n\n```go\nfunc (o *OLM) ListGVKsFromCSVNamespacedName(\n\tnamespacedName types.NamespacedName,\n) ([]schema.GroupVersionKind, error)\n```\nListGVKsFromCSVNamespacedName return the list of owned GVKs for a given CSV namespaced named.\n\n```go\nfunc (o *OLM) SelectCRDByGVK(gvk schema.GroupVersionKind, crd *unstructured.Unstructured) (*olmv1alpha1.CRDDescription, error)\n```\nSelectCRDByGVK return a single CRD based on a given GVK.\n\n```go\ntype Reconciler struct {\n\tRestMapper meta.RESTMapper // restMapper to convert GVK and GVR\n\t// contains filtered or unexported fields\n}\n```\nReconciler reconciles a ServiceBindingRequest object\n\n```go\nfunc (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)\n```\nReconcile a ServiceBindingRequest by the following steps:\n\n 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;\n 2. Using OperatorLifecycleManager standards, identifying which items are intersting for binding by parsing CustomResourceDefinitionDescripton object. Alternatively, this informmation may also come from special annotations in the CR/CRD;\n 3. Search and read contents identified in previous step, creating an intermediary secret to hold data formatted as environment variables key/value;\n 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.\n\n```go\ntype Retriever struct {\n\t// contains filtered or unexported fields\n}\n```\nRetriever reads all data referred in plan instance, and store in a secret.\n\n```go\nfunc NewRetriever(\n\tclient dynamic.Interface,\n) *Retriever\n```\nNewRetriever instantiate a new retriever instance.\n\n```go\nfunc (r *Retriever) ProcessServiceContexts(\n\tglobalEnvVarPrefix string,\n\tsvcCtxs ServiceContextList,\n\tenvVarTemplates []corev1.EnvVar,\n) (map[string][]byte, []string, error)\n```\nProcessServiceContexts returns environment variables and volume keys from a ServiceContext slice.\n\n```go\ntype SBRController struct {\n\tController controller.Controller // controller-runtime instance\n\tClient     dynamic.Interface     // kubernetes dynamic api client\n\t// contains filtered or unexported fields\n}\n```\nSBRController hold the controller instance and methods for a ServiceBindingRequest.\n\n```go\nfunc NewSBRController(\n\tmgr manager.Manager,\n\toptions controller.Options,\n\tclient dynamic.Interface,\n) (*SBRController, error)\n```\nNewSBRController creates a new SBRController instance. It can return error on bootstrapping a new dynamic client.\n\n```go\nfunc (s *SBRController) AddWatchForGVK(gvk schema.GroupVersionKind) error\n```\nAddWatchForGVK creates a watch on a given GVK, as long as it's not duplicated.\n\n```go\nfunc (s *SBRController) Watch() error\n```\nWatch setup \"watch\" for all GVKs relevant for SBRController.\n\n```go\ntype SBRRequestMapper struct{}\n```\nSBRRequestMapper is the handler.Mapper interface implementation. It should influence the enqueue process considering the resources informed.\n\n```go\nfunc (m *SBRRequestMapper) Map(obj handler.MapObject) []reconcile.Request\n```\nMap 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.\n\n```go\ntype Secret struct {\n\t// contains filtered or unexported fields\n}\n```\nSecret represents the data collected by this operator, and later handled as a secret.\n\n```go\nfunc NewSecret(\n\tclient dynamic.Interface,\n\tns string,\n\tname string,\n) *Secret\n```\nNewSecret instantiate a new Secret.\n\n```go\nfunc (s *Secret) Commit(payload map[string][]byte) (*unstructured.Unstructured, error)\n```\nCommit will store informed data as a secret, commit it against the API server. It can forward errors from custom environment parser component, or from the API server itself.\n\n```go\nfunc (s *Secret) Delete() error\n```\nDelete the secret represented by this component. It can return error when the API server does.\n\n```go\nfunc (s *Secret) Get() (*unstructured.Unstructured, bool, error)\n```\nGet an unstructured object from the secret handled by this component. It can return errors in case the API server does.\n\n```go\ntype ServiceBinder struct {\n\t// Binder is responsible for interacting with the cluster and apply binding related changes.\n\tBinder *Binder\n\t// EnvVars contains the environment variables to bind.\n\tEnvVars map[string][]byte\n\t// DynClient is the Kubernetes dynamic client used to interact with the cluster.\n\tDynClient dynamic.Interface\n\t// Logger provides logging facilities for internal components.\n\tLogger *log.Log\n\t// Objects is a list of additional unstructured objects related to the Service Binding Request.\n\tObjects []*unstructured.Unstructured\n\t// SBR is the ServiceBindingRequest associated with binding.\n\tSBR *v1alpha1.ServiceBindingRequest\n\t// Secret is the Secret associated with the Service Binding Request.\n\tSecret *Secret\n}\n```\nServiceBinder manages binding for a Service Binding Request and associated objects.\n\n```go\nfunc BuildServiceBinder(\n\tctx context.Context,\n\toptions *ServiceBinderOptions,\n) (\n\t*ServiceBinder,\n\terror,\n)\n```\nBuildServiceBinder creates a new binding manager according to options.\n\n```go\nfunc (b *ServiceBinder) Bind() (reconcile.Result, error)\n```\nBind configures binding between the Service Binding Request and its related objects.\n\n```go\nfunc (b *ServiceBinder) Unbind() (reconcile.Result, error)\n```\nUnbind removes the relationship between a Service Binding Request and its related objects.\n\n```go\ntype ServiceBinderOptions struct {\n\tLogger                 *log.Log\n\tDynClient              dynamic.Interface\n\tDetectBindingResources bool\n\tSBR                    *v1alpha1.ServiceBindingRequest\n\tObjects                []*unstructured.Unstructured\n\tEnvVars                map[string][]byte\n\tEnvVarPrefix           string\n\tBinding                *Binding\n\tRESTMapper             meta.RESTMapper\n}\n```\nServiceBinderOptions is BuildServiceBinder arguments.\n\n```go\nfunc (o *ServiceBinderOptions) Valid() error\n```\nValid returns an error if the receiver is invalid, nil otherwise.\n\n```go\ntype ServiceContext struct {\n\t// Service is the resource of the service being evaluated.\n\tService *unstructured.Unstructured\n\t// EnvVars contains the service's contributed environment variables.\n\tEnvVars map[string]interface{}\n\t// VolumeKeys contains the keys that should be mounted as volume from the binding secret.\n\tVolumeKeys []string\n\t// EnvVarPrefix indicates the prefix to use in environment variables.\n\tEnvVarPrefix *string\n}\n```\nServiceContext contains information related to a service.\n\n```go\ntype ServiceContextList []*ServiceContext\n```\nServiceContextList is a list of ServiceContext values.\n\n```go\nfunc (sc ServiceContextList) GetServices() []*unstructured.Unstructured\n```\nGetServices returns a slice of service unstructured objects contained in the collection.\n\n","path":"github.com/redhat-developer/service-binding-operator/pkg/controller/servicebindingrequest","name":"servicebindingrequest","synopsis":"","isRedistributable":true}
