trafficmgr

package
v2.5.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Installer

type Installer interface {
	EnsureAgent(c context.Context,
		obj k8sapi.Workload,
		config *ServiceProps,
		agentImageName string,
		telepresenceAPIPort uint16,
	) (string, string, error)
	EnsureManager(c context.Context) error
	RemoveManagerAndAgents(c context.Context, agentsOnly bool, agents []*manager.AgentInfo) error
}

func NewTrafficManagerInstaller

func NewTrafficManagerInstaller(kc *k8s.Cluster) (Installer, error)

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 Service

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

type ServiceProps

type ServiceProps struct {
	Service            *core.Service
	ServicePort        *core.ServicePort
	Container          *core.Container
	ContainerPortIndex int
}

type Session

type Session interface {
	restapi.AgentState
	AddIntercept(context.Context, *rpc.CreateInterceptRequest) (*rpc.InterceptResult, error)
	CanIntercept(context.Context, *rpc.CreateInterceptRequest) (*rpc.InterceptResult, k8sapi.Workload, *ServiceProps)
	GetInterceptSpec(string) *manager.InterceptSpec
	Status(context.Context) *rpc.ConnectInfo
	IngressInfos(c context.Context) ([]*manager.IngressInfo, error)
	RemoveIntercept(context.Context, string) error
	Run(context.Context) error
	Uninstall(context.Context, *rpc.UninstallRequest) (*rpc.UninstallResult, 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
	GetCurrentNamespaces(forClientAccess bool) []string
	ActualNamespace(string) string
	AddNamespaceListener(k8s.NamespaceListener)
}

func NewSession

func NewSession(c context.Context, sr *scout.Reporter, cr *rpc.ConnectRequest, svc Service, extraServices []SessionService) (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 {
	// contains filtered or unexported fields
}

func (*TrafficManager) AddIntercept

AddIntercept adds one intercept

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

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) EnsureAgent

func (ki TrafficManager) EnsureAgent(
	c context.Context,
	obj k8sapi.Workload,
	svcprops *ServiceProps,
	agentImageName string,
	telepresenceAPIPort uint16,
) (string, string, error)

EnsureAgent does a lot of things but at a high level it ensures that the traffic agent is installed alongside the proper workload. In doing that, it also ensures that the workload is referenced by a service. Lastly, it returns the service UID associated with the workload since this is where that correlation is made.

func (TrafficManager) EnsureManager

func (ki TrafficManager) EnsureManager(c context.Context) error

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, h http.Header) (*restapi.InterceptInfo, error)

func (*TrafficManager) ManagerClient

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

func (*TrafficManager) RemoveIntercept

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

RemoveIntercept removes one intercept by name

func (*TrafficManager) RemoveLocalOnlyIntercept

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

func (TrafficManager) RemoveManagerAndAgents

func (ki TrafficManager) RemoveManagerAndAgents(c context.Context, agentsOnly bool, agents []*manager.AgentInfo) error

RemoveManagerAndAgents will remove the agent from all deployments listed in the given agents slice. Unless agentsOnly is true, it will also remove the traffic-manager service and deployment.

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 (*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