expose

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Copyright 2020 Jared Allard

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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