context

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 31 Imported by: 7 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Provider = func(client dynamic.Interface, subjectAccessReviewClient clientauthzv1.SubjectAccessReviewInterface, typeLookup kubernetes.K8STypeLookup) pipeline.ContextProvider {
	return &provider{
		client:     client,
		typeLookup: typeLookup,
		get: func(binding interface{}) (pipeline.Context, error) {
			switch sb := binding.(type) {
			case *v1alpha1.ServiceBinding:
				return &bindingImpl{
					impl: impl{
						conditions:                make(map[string]*metav1.Condition),
						client:                    client,
						subjectAccessReviewClient: subjectAccessReviewClient,
						typeLookup:                typeLookup,
						bindingMeta:               &sb.ObjectMeta,
						statusSecretName: func() string {
							return sb.Status.Secret
						},
						setStatusSecretName: func(name string) {
							sb.Status.Secret = name
						},
						unstructuredBinding: func() (*unstructured.Unstructured, error) {
							return converter.ToUnstructured(sb)
						},
						statusConditions: func() *[]metav1.Condition {
							return &sb.Status.Conditions
						},
						ownerReference: func() metav1.OwnerReference {
							return sb.AsOwnerReference()
						},
						groupVersionResource: func() schema.GroupVersionResource {
							return v1alpha1.GroupVersionResource
						},
						requester: func() *authv1.UserInfo {
							return apis.Requester(sb.ObjectMeta)
						},
						serviceBuilder: service.NewBuilder(typeLookup).WithClient(client).LookOwnedResources(sb.Spec.DetectBindingResources),
						labelSelectionRateLimiter: workqueue.NewMaxOfRateLimiter(
							workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, 2*time.Minute),
							&workqueue.BucketRateLimiter{
								Limiter: rate.NewLimiter(rate.Limit(10), 100),
							},
						),
					},
					serviceBinding: sb,
				}, nil
			}
			return nil, fmt.Errorf("cannot create context for passed instance %v", binding)
		},
	}
}
View Source
var SpecProvider = func(client dynamic.Interface, subjectAccessReviewClient authv1.SubjectAccessReviewInterface, typeLookup kubernetes.K8STypeLookup) pipeline.ContextProvider {
	return &provider{
		client:     client,
		typeLookup: typeLookup,
		get: func(binding interface{}) (pipeline.Context, error) {
			switch sb := binding.(type) {
			case *v1beta1.ServiceBinding:
				if sb.Generation != 0 {
					sb.Status.ObservedGeneration = sb.Generation
				}
				ctx := &specImpl{
					impl: impl{
						conditions:                make(map[string]*metav1.Condition),
						client:                    client,
						subjectAccessReviewClient: subjectAccessReviewClient,
						typeLookup:                typeLookup,
						bindingMeta:               &sb.ObjectMeta,
						statusSecretName: func() string {
							if sb.Status.Binding == nil {
								return ""
							}
							return sb.Status.Binding.Name
						},
						setStatusSecretName: func(name string) {
							sb.Status.Binding = &v1beta1.ServiceBindingSecretReference{Name: name}
						},
						unstructuredBinding: func() (*unstructured.Unstructured, error) {
							return converter.ToUnstructured(sb)
						},
						statusConditions: func() *[]metav1.Condition {
							return &sb.Status.Conditions
						},
						ownerReference: func() metav1.OwnerReference {
							return sb.AsOwnerReference()
						},
						groupVersionResource: func() schema.GroupVersionResource {
							return v1beta1.GroupVersionResource
						},
						requester: func() *v1.UserInfo {
							return apis.Requester(sb.ObjectMeta)
						},
						serviceBuilder: service.NewBuilder(typeLookup).WithClient(client),
						labelSelectionRateLimiter: workqueue.NewMaxOfRateLimiter(
							workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, 2*time.Minute),
							&workqueue.BucketRateLimiter{
								Limiter: rate.NewLimiter(rate.Limit(10), 100),
							},
						),
					},
					serviceBinding: sb,
				}
				if sb.Spec.Type != "" {
					ctx.AddBindingItem(&pipeline.BindingItem{Name: "type", Value: sb.Spec.Type})
				}
				if sb.Spec.Provider != "" {
					ctx.AddBindingItem(&pipeline.BindingItem{Name: "provider", Value: sb.Spec.Provider})
				}
				return ctx, nil
			}
			return nil, fmt.Errorf("cannot create context for passed instance %v", binding)
		},
	}
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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