expose

package
v1.15.6 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Description: This file has the package expose.

Package expose has helpers for exposing localports

Description: This file has the package expose.

Index

Constants

View Source
const (
	ExposedPodLabel = "localizer.jaredallard.github.com/exposed"
	ObjectsPodLabel = "localizer.jaredallard.github.com/objects"
)

Variables

View Source
var (
	// ErrUnderlyingTransportDied is triggered when the kubernetes port-forward loses
	// connection. This results in the transport protocol dying as well.
	ErrUnderlyingTransportDied = errors.New("underlying transport died")

	// ErrUnderlyingTransportProtocolDied is triggered when the ssh tunnel loses connection,
	// this can be due to the ssh connection being destroyed or the port-forward being killed
	ErrUnderlyingTransportProtocolDied = errors.New("underlying transport protocol (ssh) died")

	// ErrNotInitialized is used to start the initialization
	// process. It is not an error, despite its name.
	ErrNotInitialized = errors.New("not initialized")

	// ErrUnderlyingTransportPodDestroyed is triggered only when a pod is destroyed,
	// note that this will usually case ErrUnderlyingTransportDied to be triggered.
	ErrUnderlyingTransportPodDestroyed = errors.New("underlying transport pod died")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewExposer

func NewExposer(k kubernetes.Interface, kconf *rest.Config, log logrus.FieldLogger) *Client

NewExposer returns a new client capable of exposing localports to remote locations

func (*Client) Expose

func (c *Client) Expose(ctx context.Context, ports []kube.ResolvedServicePort, namespace, serviceName string) (*ServiceForward, error)

Expose exposed a port, localPort, on the local host, and opens a remote port that can be accessed via the remote service at remotePort

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

Start warms up the expose cache and enables running Expose() among other things.

type ServiceForward

type ServiceForward struct {
	ServiceName string
	Namespace   string
	Selector    map[string]string
	Ports       []kube.ResolvedServicePort
	// contains filtered or unexported fields
}

func (*ServiceForward) Start

func (p *ServiceForward) Start(ctx context.Context) error

Start starts forwarding a service, this blocks

Jump to

Keyboard shortcuts

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