Documentation
¶
Index ¶
- Constants
- Variables
- func IsAttribute(s string) bool
- func IsConfigMap(s string) bool
- func IsErrHandlerNotFound(err error) bool
- func IsSecret(s string) bool
- type AttributeHandler
- type BindingInfo
- type ErrHandlerNotFound
- type ErrInvalidBindingValue
- type Handler
- type InvalidArgumentErr
- type ResourceHandler
- type Result
- type UnknownBindingTypeErr
Constants ¶
const ( // BindingTypeVolumeMount indicates the binding should happen through a volume mount. BindingTypeVolumeMount bindingType = "volumemount" // BindingTypeEnvVar indicates the binding should happen through environment variables. BindingTypeEnvVar bindingType = "env" )
const AttributeValue = "binding:env:attribute"
const ConfigMapValue = "binding:env:object:configmap"
const SecretValue = "binding:env:object:secret"
const (
// ServiceBindingOperatorAnnotationPrefix is the prefix of Service Binding Operator related annotations.
ServiceBindingOperatorAnnotationPrefix = "servicebindingoperator.redhat.io/"
)
const VolumeMountSecretValue = "binding:volumemount:secret"
Variables ¶
var ErrEmptyAnnotationName = errors.New("empty annotation name")
var ErrInvalidAnnotationName = errors.New("invalid annotation name")
var ErrInvalidAnnotationPrefix = errors.New("invalid annotation prefix")
var ResourceNameFieldNotFoundErr = errors.New("secret name field not found")
Functions ¶
func IsAttribute ¶
IsAttribute returns true if the annotation value should trigger the attribute handler.
func IsConfigMap ¶
IsConfigMap returns true if the annotation value should trigger config map handler.
func IsErrHandlerNotFound ¶
Types ¶
type AttributeHandler ¶
type AttributeHandler struct {
// contains filtered or unexported fields
}
AttributeHandler handles "binding:env:attribute" annotations.
func NewAttributeHandler ¶
func NewAttributeHandler( bindingInfo *BindingInfo, resource unstructured.Unstructured, ) *AttributeHandler
NewAttributeHandler constructs an AttributeHandler.
func (*AttributeHandler) Handle ¶
func (h *AttributeHandler) Handle() (Result, error)
Handle returns a unstructured object according to the "binding:env:attribute" annotation strategy.
type BindingInfo ¶
type BindingInfo struct {
// ResourceReferencePath is the field in the Backing Service CR referring to a bindable property, either
// embedded or a reference to a related object..
ResourceReferencePath string
// SourcePath is the field that will be collected from the Backing Service CR or a related object.
SourcePath string
// Descriptor is the field reference to another manifest.
Descriptor string
// Value is the original annotation value.
Value string
}
BindingInfo represents the pieces of a binding as parsed from an annotation.
func NewBindingInfo ¶
func NewBindingInfo(name string, value string) (*BindingInfo, error)
NewBindingInfo parses the encoded in the annotation name, returning its parts.
type ErrHandlerNotFound ¶
type ErrHandlerNotFound string
func (ErrHandlerNotFound) Error ¶
func (e ErrHandlerNotFound) Error() string
type ErrInvalidBindingValue ¶
type ErrInvalidBindingValue string
func (ErrInvalidBindingValue) Error ¶
func (e ErrInvalidBindingValue) Error() string
type Handler ¶
Handler should be implemented by types that want to offer a mechanism to provide binding data to the system.
func BuildHandler ¶
func BuildHandler( kubeClient dynamic.Interface, obj *unstructured.Unstructured, annotationKey string, annotationValue string, restMapper meta.RESTMapper, ) (Handler, error)
BuildHandler attempts to create an annotation handler for the given annotationKey and annotationValue. kubeClient is required by some annotation handlers, and an error is returned in the case it is required by an annotation handler but is not defined.
func NewConfigMapHandler ¶
func NewConfigMapHandler( client dynamic.Interface, bindingInfo *BindingInfo, resource unstructured.Unstructured, restMapper meta.RESTMapper, ) (Handler, error)
NewConfigMapHandler constructs an annotation handler that can extract related data from config maps.
func NewSecretHandler ¶
func NewSecretHandler( client dynamic.Interface, bindingInfo *BindingInfo, resource unstructured.Unstructured, restMapper meta.RESTMapper, ) (Handler, error)
NewSecretHandler constructs a SecretHandler.
type InvalidArgumentErr ¶
type InvalidArgumentErr string
func (InvalidArgumentErr) Error ¶
func (e InvalidArgumentErr) Error() string
type ResourceHandler ¶
type ResourceHandler struct {
// contains filtered or unexported fields
}
ResourceHandler handles annotations related to external resources.
func NewResourceHandler ¶
func NewResourceHandler( client dynamic.Interface, bindingInfo *BindingInfo, resource unstructured.Unstructured, relatedGroupVersionResource schema.GroupVersionResource, inputPathPrefix *string, restMapper meta.RESTMapper, ) (*ResourceHandler, error)
NewSecretHandler constructs a SecretHandler.
func (*ResourceHandler) Handle ¶
func (h *ResourceHandler) Handle() (Result, error)
Handle returns the value for an external resource strategy.
type Result ¶
type Result struct {
// Data contains the annotation data collected by an annotation handler inside a deep structure
// with its root being the value specified in the Path field.
Data map[string]interface{}
// Type indicates where the Object field should be injected in the application; can be either
// "env" or "volumemount".
Type bindingType
// Path is the nested location the collected data can be found in the Data field.
Path string
}
Result contains data that has been collected by an annotation handler.
type UnknownBindingTypeErr ¶
type UnknownBindingTypeErr string
func (UnknownBindingTypeErr) Error ¶
func (e UnknownBindingTypeErr) Error() string