Documentation
¶
Index ¶
Constants ¶
const ( ServiceBindingRootEnv = "SERVICE_BINDING_ROOT" Group = "projector.servicebinding.io" VolumePrefix = "servicebinding-" SecretAnnotationPrefix = Group + "/secret-" TypeAnnotationPrefix = Group + "/type-" ProviderAnnotationPrefix = Group + "/provider-" MappingAnnotationPrefix = Group + "/mapping-" )
Variables ¶
This section is empty.
Functions ¶
func MappingVersion ¶ added in v0.3.0
func MappingVersion(version string, mappings *servicebindingv1beta1.ClusterWorkloadResourceMappingSpec) *servicebindingv1beta1.ClusterWorkloadResourceMappingTemplate
The workload's version is either directly matched, or the wildcard version `*` mapping template is returned. If no explicit mapping is found, a mapping appropriate for a PodSpecable resource may be used.
func NewMetaPodTemplate ¶
func NewMetaPodTemplate(ctx context.Context, workload runtime.Object, mapping *servicebindingv1beta1.ClusterWorkloadResourceMappingTemplate) (*metaPodTemplate, error)
NewMetaPodTemplate coerces the workload object into a MetaPodTemplate following the mapping definition. The resulting MetaPodTemplate may have one or more service bindings applied to it at a time, but should not be reused. The workload must be JSON marshalable.
Types ¶
type MappingSource ¶
type MappingSource interface {
// LookupRESTMapping returns the RESTMapping for the workload type. The rest mapping contains a GroupVersionResource which can
// be used to fetch the workload mapping.
LookupRESTMapping(ctx context.Context, obj runtime.Object) (*meta.RESTMapping, error)
// LookupWorkloadMapping the mapping template for the workload. Typically a ClusterWorkloadResourceMapping is defined for the
// workload's fully qualified resource `{resource}.{group}`.
LookupWorkloadMapping(ctx context.Context, gvr schema.GroupVersionResource) (*servicebindingv1beta1.ClusterWorkloadResourceMappingSpec, error)
}
func NewStaticMapping ¶
func NewStaticMapping(wm *servicebindingv1beta1.ClusterWorkloadResourceMappingSpec, rm *meta.RESTMapping) MappingSource
NewStaticMapping returns a single ClusterWorkloadResourceMappingSpec for each lookup. It is useful for testing.
type ServiceBindingProjector ¶
type ServiceBindingProjector interface {
// Project the service into the workload as defined by the ServiceBinding.
Project(ctx context.Context, binding *servicebindingv1beta1.ServiceBinding, workload runtime.Object) error
// Unproject the serice from the workload as defined by the ServiceBinding.
Unproject(ctx context.Context, binding *servicebindingv1beta1.ServiceBinding, workload runtime.Object) error
}
func New ¶
func New(mappingSource MappingSource) ServiceBindingProjector
New creates a service binding projector configured for the mapping source. The binding projector is typically created once and applied to multiple workloads.