trafficmgr

package
v2.7.6-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SessionExpiredErr = errors.New("session expired")

Functions

func DeleteManager added in v2.7.1

func DeleteManager(ctx context.Context, req *rpc.HelmRequest) error

func DeleteSessionFromUserCache added in v2.6.7

func DeleteSessionFromUserCache(ctx context.Context) error

DeleteSessionFromUserCache removes user info cache if existing or returns an error. An attempt to remove a non-existing cache is a no-op and the function returns nil.

func EnsureManager added in v2.7.0

func EnsureManager(ctx context.Context, req *rpc.HelmRequest) error

func LoadSessionFromUserCache added in v2.6.7

func LoadSessionFromUserCache(ctx context.Context, host string) (*manager.SessionInfo, error)

LoadSessionFromUserCache gets the session from cache or returns an error if something goes wrong while loading or unmarshalling.

func SaveSessionToUserCache added in v2.6.7

func SaveSessionToUserCache(ctx context.Context, host string, session *manager.SessionInfo) error

SaveSessionToUserCache saves the provided session to user cache and returns an error if something goes wrong while marshalling or persisting.

func WithSession added in v2.7.0

func WithSession(ctx context.Context, session Session) context.Context

Types

type ManagerProxy

type ManagerProxy interface {
	managerrpc.ManagerServer

	// SetClient replaces the client of this proxy
	SetClient(client managerrpc.ManagerClient, callOptions ...grpc.CallOption)
}

func NewManagerProxy

func NewManagerProxy() ManagerProxy

NewManagerProxy returns a rpc.ManagerServer that just proxies all requests through the given rpc.ManagerClient.

type SavedSession added in v2.6.7

type SavedSession struct {
	Host    string
	Session *manager.SessionInfo `json:"session"`
}

type Service

type Service interface {
	RootDaemonClient(context.Context) (daemon.DaemonClient, error)
	SetManagerClient(manager.ManagerClient, ...grpc.CallOption)
	LoginExecutor() auth.LoginExecutor
}

type Session

type Session interface {
	restapi.AgentState
	k8s.KubeConfig
	AddIntercept(context.Context, *rpc.CreateInterceptRequest) (*rpc.InterceptResult, error)
	CanIntercept(context.Context, *rpc.CreateInterceptRequest) (*serviceProps, *rpc.InterceptResult)
	AddInterceptor(string, int) error
	RemoveInterceptor(string) error
	GetInterceptSpec(string) *manager.InterceptSpec
	InterceptsForWorkload(string, string) []*manager.InterceptSpec
	Status(context.Context) *rpc.ConnectInfo
	IngressInfos(c context.Context) ([]*manager.IngressInfo, error)
	ClearIntercepts(context.Context) error
	RemoveIntercept(context.Context, string) error
	Run(context.Context) error
	Uninstall(context.Context, *rpc.UninstallRequest) (*rpc.Result, error)
	UpdateStatus(context.Context, *rpc.ConnectRequest) *rpc.ConnectInfo
	WatchWorkloads(context.Context, *rpc.WatchWorkloadsRequest, WatchWorkloadsStream) error
	WithK8sInterface(context.Context) context.Context
	WorkloadInfoSnapshot(context.Context, []string, rpc.ListRequest_Filter, bool) (*rpc.WorkloadInfoSnapshot, error)
	ManagerClient() manager.ManagerClient
	ManagerConn() *grpc.ClientConn
	GetCurrentNamespaces(forClientAccess bool) []string
	ActualNamespace(string) string
	RemainWithToken(context.Context) error
	AddNamespaceListener(k8s.NamespaceListener)
	GatherLogs(context.Context, *connector.LogsRequest) (*connector.LogsResponse, error)
	ForeachAgentPod(ctx context.Context, fn func(context.Context, typed.PodInterface, *core.Pod), filter func(*core.Pod) bool) error
}

func GetSession added in v2.7.0

func GetSession(ctx context.Context) Session

func NewSession

func NewSession(
	ctx context.Context,
	sr *scout.Reporter,
	cr *rpc.ConnectRequest,
	svc Service,
	extraServices []SessionService,
	fuseFtp rpc2.FuseFTPClient,
) (context.Context, Session, *connector.ConnectInfo)

type SessionService

type SessionService interface {
	Name() string
	// Run should run the Session service. Run will be launched in its own goroutine and it's expected that it blocks until the context is finished.
	Run(ctx context.Context, scout *scout.Reporter, session Session) error
}

A SessionService represents a service that should be started together with each daemon session. Can be used when passing in custom commands to start up any resources needed for the commands.

type TrafficManager

type TrafficManager struct {
	*k8s.Cluster
	// contains filtered or unexported fields
}

func (*TrafficManager) AddIntercept

func (tm *TrafficManager) AddIntercept(c context.Context, ir *rpc.CreateInterceptRequest) (result *rpc.InterceptResult, err error)

AddIntercept adds one intercept

func (*TrafficManager) AddInterceptor added in v2.6.0

func (tm *TrafficManager) AddInterceptor(s string, i int) error

AddInterceptor associates the given interceptId with a pid of a running process. This ensures that the running process will be signalled when the intercept is removed

func (*TrafficManager) AddLocalOnlyIntercept

func (tm *TrafficManager) AddLocalOnlyIntercept(c context.Context, spec *manager.InterceptSpec) (*rpc.InterceptResult, error)

AddLocalOnlyIntercept adds a local-only intercept

func (*TrafficManager) CanIntercept

func (tm *TrafficManager) CanIntercept(c context.Context, ir *rpc.CreateInterceptRequest) (*serviceProps, *rpc.InterceptResult)

CanIntercept checks if it is possible to create an intercept for the given request. The intercept can proceed only if the returned rpc.InterceptResult is nil. The returned runtime.Object is either nil, indicating a local intercept, or the workload for the intercept.

func (*TrafficManager) ClearIntercepts added in v2.6.0

func (tm *TrafficManager) ClearIntercepts(c context.Context) error

ClearIntercepts removes all intercepts

func (*TrafficManager) ForeachAgentPod added in v2.7.0

func (tm *TrafficManager) ForeachAgentPod(ctx context.Context, fn func(context.Context, typed.PodInterface, *core.Pod), filter func(*core.Pod) bool) error

func (*TrafficManager) GatherLogs added in v2.5.5

func (tm *TrafficManager) GatherLogs(ctx context.Context, request *connector.LogsRequest) (*connector.LogsResponse, error)

GatherLogs acquires the logs for the traffic-manager and/or traffic-agents specified by the connector.LogsRequest and returns them to the caller

func (*TrafficManager) GetInterceptSpec

func (tm *TrafficManager) GetInterceptSpec(name string) *manager.InterceptSpec

GetInterceptSpec returns the InterceptSpec for the given name, or nil if no such spec exists

func (*TrafficManager) IngressInfos

func (tm *TrafficManager) IngressInfos(c context.Context) ([]*manager.IngressInfo, error)

func (*TrafficManager) InterceptInfo

func (tm *TrafficManager) InterceptInfo(ctx context.Context, callerID, path string, _ uint16, headers http.Header) (*restapi.InterceptInfo, error)

func (*TrafficManager) InterceptsForWorkload added in v2.6.1

func (tm *TrafficManager) InterceptsForWorkload(workloadName, namespace string) []*manager.InterceptSpec

InterceptsForWorkload returns the client's current intercepts on the given namespace and workload combination

func (*TrafficManager) ManagerClient

func (tm *TrafficManager) ManagerClient() manager.ManagerClient

func (*TrafficManager) ManagerConn added in v2.7.0

func (tm *TrafficManager) ManagerConn() *grpc.ClientConn

func (*TrafficManager) RemainWithToken

func (tm *TrafficManager) RemainWithToken(ctx context.Context) error

func (*TrafficManager) RemoveIntercept

func (tm *TrafficManager) RemoveIntercept(c context.Context, name string) error

RemoveIntercept removes one intercept by name

func (*TrafficManager) RemoveInterceptor added in v2.6.0

func (tm *TrafficManager) RemoveInterceptor(s string) error

func (*TrafficManager) RemoveLocalOnlyIntercept

func (tm *TrafficManager) RemoveLocalOnlyIntercept(c context.Context, name, namespace string) error

func (*TrafficManager) Run

func (tm *TrafficManager) Run(c context.Context) error

Run (1) starts up with ensuring that the manager is installed and running, but then for most of its life

  • (2) calls manager.ArriveAsClient and then periodically calls manager.Remain
  • run the intercepts (manager.WatchIntercepts) and then
  • (3) listen on the appropriate local ports and forward them to the intercepted Services, and
  • (4) mount the appropriate remote volumes.

func (*TrafficManager) Status

func (tm *TrafficManager) Status(c context.Context) *rpc.ConnectInfo

func (*TrafficManager) Uninstall

func (tm *TrafficManager) Uninstall(ctx context.Context, ur *rpc.UninstallRequest) (*rpc.Result, error)

Uninstall parts or all of Telepresence from the cluster if the client has sufficient credentials to do so.

Uninstalling everything requires that the client owns the helm chart installation and has permissions to run a `helm uninstall traffic-manager`.

Uninstalling all or specific agents require that the client can get and update the agents ConfigMap.

func (*TrafficManager) UpdateStatus

func (tm *TrafficManager) UpdateStatus(c context.Context, cr *rpc.ConnectRequest) *rpc.ConnectInfo

func (*TrafficManager) WatchWorkloads

func (*TrafficManager) WorkloadInfoSnapshot

func (tm *TrafficManager) WorkloadInfoSnapshot(
	ctx context.Context,
	namespaces []string,
	filter rpc.ListRequest_Filter,
	includeLocalIntercepts bool,
) (*rpc.WorkloadInfoSnapshot, error)

type WatchWorkloadsStream

type WatchWorkloadsStream interface {
	Send(*rpc.WorkloadInfoSnapshot) error
}

Jump to

Keyboard shortcuts

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