bindings

package
v0.0.0-...-a36a61a Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelManagedBy              = "app.kubernetes.io/managed-by"
	LabelBoundEndpointName      = "bindings.k8s.ngrok.com/endpoint-binding-name"
	LabelBoundEndpointNamespace = "bindings.k8s.ngrok.com/endpoint-binding-namespace"
	LabelEndpointURL            = "bindings.k8s.ngrok.com/endpoint-url"

	// Used for indexing Services by their BoundEndpoint owner. Not an actual
	// field on the Service object.
	BoundEndpointOwnerKey = ".metadata.controller"
	// Used for indexing BoundEndpoints by their target namespace. Not an actual
	// field on the BoundEndpoint object.
	BoundEndpointTargetNamespacePath = ".spec.targetNamespace"

	// TODO(hkatz) ngrok-error-codes
	NgrokErrorUpstreamServiceCreateFailed = "ERR_NGROK_0001"
	NgrokErrorTargetServiceCreateFailed   = "ERR_NGROK_0002"
	NgrokErrorFailedToBind                = "ERR_NGROK_003"
	NgrokErrorNotAllowed                  = "ERR_NGROK_004"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundEndpointPoller

type BoundEndpointPoller struct {
	client.Client
	Scheme   *runtime.Scheme
	Log      logr.Logger
	Recorder record.EventRecorder

	// Namespace is the namespace to manage for BoundEndpoints
	Namespace string

	// KubernetesOperatorConfigName is the expected name of the KubernetesOperator that we should poll
	KubernetesOperatorConfigName string

	// NgrokClientset is the ngrok API clientset
	NgrokClientset ngrokapi.Clientset

	// AllowedURLs is a list of allowed URL patterns for endpoints that may be projected into the cluster
	AllowedURLs []string

	// PollingInterval is how often to poll the ngrok API for reconciling the BindingEndpoints
	PollingInterval time.Duration

	// PortRange is the allocatable port range for the Service definitions to Pod Forwarders
	PortRange PortRangeConfig

	// TargetServiceAnnotations is a map of key/value pairs to attach to the BoundEndpoint's Target Service
	TargetServiceAnnotations map[string]string

	// TargetServiceAnnotations is a map of key/value pairs to attach to the BoundEndpoint's Target Service
	TargetServiceLabels map[string]string
	// contains filtered or unexported fields
}

BoundEndpointPoller is a process to poll the ngrok API for binding_endpoints and reconcile the desired state with the cluster state of BoundEndpoints

func (*BoundEndpointPoller) Start

func (r *BoundEndpointPoller) Start(ctx context.Context) error

Start implements the manager.Runnable interface.

type BoundEndpointReconciler

type BoundEndpointReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	Log      logr.Logger
	Recorder record.EventRecorder

	// ClusterDomain is the last part of the FQDN for Service DNS in-cluster
	ClusterDomain string

	// UpstreamServiceLabelSelectors are the set of labels for the Pod Forwarders
	UpstreamServiceLabelSelector map[string]string
	// contains filtered or unexported fields
}

BoundEndpointReconciler reconciles a BoundEndpoint object

func (*BoundEndpointReconciler) Reconcile

func (r *BoundEndpointReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile turns BoundEndpoints into 2 Services - ExternalName Target Service in the Target Namespace/Service name pointed at the Upstream Service - Upstream Service in the ngrok-op namespace pointed at the Pod Forwarders

func (*BoundEndpointReconciler) SetupWithManager

func (r *BoundEndpointReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ForwarderReconciler

type ForwarderReconciler struct {
	client.Client

	Log      logr.Logger
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder

	BindingsDriver         *bindingsdriver.BindingsDriver
	KubernetesOperatorName string
	// contains filtered or unexported fields
}

func (*ForwarderReconciler) Reconcile

func (r *ForwarderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ForwarderReconciler) SetupWithManager

func (r *ForwarderReconciler) SetupWithManager(mgr ctrl.Manager) (err error)

type PortRangeConfig

type PortRangeConfig struct {
	// Start is the minimum port number
	Min uint16

	// Max is the maximum port number
	Max uint16
}

PortRangeConfig is a configuration for a port range Note: PortRange is inclusive: `[Min, Max]`

Jump to

Keyboard shortcuts

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