Documentation ¶
Index ¶
- Variables
- func CheckTcpConn(addr string) error
- func ExtractIpAddress(serverAddress string) (*url.URL, error)
- func NewProxyHandlerFromConfig(config *rest.Config) (*proxy.UpgradeAwareHandler, error)
- func TurnCredentialsIntoConfig(clusterCredentials *m.ClusterCredentials) (*restclient.Config, error)
- type ClusterHandlerInstance
- type ReverseProxyDispatcher
- func (f *ReverseProxyDispatcher) DelHandlerStoreByClusterId(clusterId string)
- func (f *ReverseProxyDispatcher) ExtractPathPrefix(req *http.Request) string
- func (f *ReverseProxyDispatcher) GetCluster(clusterIdentifier string) *m.Cluster
- func (f *ReverseProxyDispatcher) GetClusterCredentials(clusterId string) *m.ClusterCredentials
- func (f *ReverseProxyDispatcher) Initialize()
- func (f *ReverseProxyDispatcher) InitializeHandlerForCluster(clusterId string, req *http.Request) (*ClusterHandlerInstance, error)
- func (f *ReverseProxyDispatcher) InitializeUpstreamServer(clusterId string, serverAddresses []string)
- func (f *ReverseProxyDispatcher) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (f *ReverseProxyDispatcher) StartClusterAddressesPoller(clusterId string)
- type UpstreamServer
- type WsTunnel
Constants ¶
This section is empty.
Variables ¶
var DefaultReverseProxyDispatcher = NewReverseProxyDispatcher("cluster_identifier", "sub_path")
Functions ¶
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 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