projector

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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

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 *servicebindingv1.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) (*servicebindingv1.ClusterWorkloadResourceMappingSpec, error)
}

func NewStaticMapping

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 *servicebindingv1.ServiceBinding, workload runtime.Object) error
	// Unproject the service from the workload as defined by the ServiceBinding.
	Unproject(ctx context.Context, binding *servicebindingv1.ServiceBinding, workload runtime.Object) error
	// IsProjected returns true when the workload has been projected into by the binding
	IsProjected(ctx context.Context, binding *servicebindingv1.ServiceBinding, workload runtime.Object) bool
}

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.

Jump to

Keyboard shortcuts

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