proxier

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultReverseProxyDispatcher = NewReverseProxyDispatcher("cluster_identifier", "sub_path")

Functions

func CheckTcpConn

func CheckTcpConn(addr string) error

check tcp connection to addr

func ExtractIpAddress

func ExtractIpAddress(serverAddress string) (*url.URL, error)

func NewProxyHandlerFromConfig

func NewProxyHandlerFromConfig(config *rest.Config) (*proxy.UpgradeAwareHandler, error)

NewProxyHandler creates a new proxy handler to a single api server based on the given kube config object

func TurnCredentialsIntoConfig

func TurnCredentialsIntoConfig(clusterCredentials *m.ClusterCredentials) (*restclient.Config, error)

Types

type ClusterHandlerInstance

type ClusterHandlerInstance struct {
	ServerAddress string
	Handler       http.Handler
}

type ReverseProxyDispatcher

type ReverseProxyDispatcher struct {
	// ClusterVarName is the path parameter name of cluster identifier
	ClusterVarName string
	// ClusterVarName is the path parameter name of sub-path needs to be forwarded
	SubPathVarName string
	// contains filtered or unexported fields
}

ReverseProxyDispatcher is the handler which dispatch and proxy the incoming requests to external apiservers.

func NewReverseProxyDispatcher

func NewReverseProxyDispatcher(clusterVarName, subPathVarName string) *ReverseProxyDispatcher

func (*ReverseProxyDispatcher) DelHandlerStoreByClusterId

func (f *ReverseProxyDispatcher) DelHandlerStoreByClusterId(clusterId string)

delHandlerStoreByClusterId used when delete the cluster or switch available server

func (*ReverseProxyDispatcher) ExtractPathPrefix

func (f *ReverseProxyDispatcher) ExtractPathPrefix(req *http.Request) string

ExtractPathPrefix extracts the path prefix which needs to be stripped when the request is forwarded to the reverse proxy handler.

func (*ReverseProxyDispatcher) GetCluster

func (f *ReverseProxyDispatcher) GetCluster(clusterIdentifier string) *m.Cluster

GetCluster loop over all available storage backends to find the cluster for given identifier

func (*ReverseProxyDispatcher) GetClusterCredentials

func (f *ReverseProxyDispatcher) GetClusterCredentials(clusterId string) *m.ClusterCredentials

GetClusterCredentials loop over all available storage backends to find the credentials for given clusterId

func (*ReverseProxyDispatcher) Initialize

func (f *ReverseProxyDispatcher) Initialize()

Initialize the required components for dispatcher

func (*ReverseProxyDispatcher) InitializeHandlerForCluster

func (f *ReverseProxyDispatcher) InitializeHandlerForCluster(clusterId string, req *http.Request) (*ClusterHandlerInstance, error)

InitializeHandlerForCluster was called when a cluster channel is requested for the first time. There are also other cases when we may also need to re-establish the apiserver connection. This includes apiserver connection failure or apiserver addresses's major changes.

func (*ReverseProxyDispatcher) InitializeUpstreamServer

func (f *ReverseProxyDispatcher) InitializeUpstreamServer(clusterId string, serverAddresses []string)

InitializeUpstreamServer initialize the upstreamServer instance for cluster

func (*ReverseProxyDispatcher) ServeHTTP

func (f *ReverseProxyDispatcher) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*ReverseProxyDispatcher) StartClusterAddressesPoller

func (f *ReverseProxyDispatcher) StartClusterAddressesPoller(clusterId string)

type UpstreamServer

type UpstreamServer struct {
	CheckPeriod     time.Duration
	TcpCheckTimeOut time.Duration

	// Callback functions
	// OnAvailableChanged will be called when upstreamServer detects a failure
	OnAvailabilityChanged func()
	// contains filtered or unexported fields
}

func NewUpstreamServer

func NewUpstreamServer(clusterId string, serverAddresses []string, onAvailabilityChanged func()) *UpstreamServer

func (*UpstreamServer) GetAvailableServer

func (s *UpstreamServer) GetAvailableServer() string

func (*UpstreamServer) Initialize

func (s *UpstreamServer) Initialize() error

func (*UpstreamServer) Stop

func (s *UpstreamServer) Stop()

Stop stops the current UpstreamServer checker

func (*UpstreamServer) UpdateServerAddresses

func (s *UpstreamServer) UpdateServerAddresses(addresses []string)

UpdateServerAddresses update the server addresses in upstreamServer object

type WsTunnel

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

Jump to

Keyboard shortcuts

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