userd

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ProcessName = "connector"

Variables

This section is empty.

Functions

func RunSession added in v2.9.0

func RunSession(c context.Context, s Session) error

RunSession (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 WithNewServiceFunc added in v2.9.0

func WithNewServiceFunc(ctx context.Context, f NewServiceFunc) context.Context

func WithNewSessionFunc added in v2.9.0

func WithNewSessionFunc(ctx context.Context, f NewSessionFunc) context.Context

func WithService added in v2.9.4

func WithService(ctx context.Context, s Service) context.Context

func WithSession

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

Types

type InterceptInfo added in v2.9.0

type InterceptInfo interface {
	APIKey() string
	InterceptResult() *rpc.InterceptResult
	PreparedIntercept() *manager.PreparedIntercept
	PortIdentifier() (agentconfig.PortIdentifier, error)
}

type KubeConfig added in v2.9.0

type KubeConfig interface {
	GetContext() string
	GetRestConfig() *rest.Config
	GetManagerNamespace() string
}

type NamespaceListener added in v2.9.0

type NamespaceListener func(context.Context)

type NewServiceFunc added in v2.9.0

type NewServiceFunc func(context.Context, *dgroup.Group, *scout.Reporter, *client.Config, *grpc.Server) (Service, error)

func GetNewServiceFunc added in v2.9.0

func GetNewServiceFunc(ctx context.Context) NewServiceFunc

type NewSessionFunc added in v2.9.0

func GetNewSessionFunc added in v2.9.0

func GetNewSessionFunc(ctx context.Context) NewSessionFunc

type Service added in v2.7.0

type Service interface {
	// As will cast this instance to what the given ptr points to, and assign
	// that to the pointer. It will panic if type is not implemented.
	As(ptr any)

	Reporter() *scout.Reporter

	Server() *grpc.Server

	// SetManagerClient will assign the manager client that this Service will use when acting as
	// a ManagerServer proxy
	SetManagerClient(manager.ManagerClient, ...grpc.CallOption)

	// GetAPIKey returns the current API key
	GetAPIKey(context.Context) (string, error)

	// FuseFTPMgr returns the manager responsible for creating a client that can connect to the FuseFTP service.
	FuseFTPMgr() remotefs.FuseFTPManager

	RootSessionInProcess() bool
}

A Service is one that runs during the entire lifecycle of the daemon. This should be used to augment the daemon with GRPC services.

func GetService added in v2.9.4

func GetService(ctx context.Context) Service

type Session added in v2.9.0

type Session interface {
	restapi.AgentState
	KubeConfig

	// As will cast this instance to what the given ptr points to, and assign
	// that to the pointer. It will panic if type is not implemented.
	As(ptr any)

	InterceptProlog(context.Context, *manager.CreateInterceptRequest) *rpc.InterceptResult
	InterceptEpilog(context.Context, *rpc.CreateInterceptRequest, *rpc.InterceptResult) *rpc.InterceptResult
	RemoveIntercept(context.Context, string) error

	AddInterceptor(string, *rpc.Interceptor) error
	RemoveInterceptor(string) error
	ClearIntercepts(context.Context) error

	GetInterceptInfo(string) *manager.InterceptInfo
	GetInterceptSpec(string) *manager.InterceptSpec
	InterceptsForWorkload(string, string) []*manager.InterceptSpec

	ManagerClient() manager.ManagerClient
	ManagerConn() *grpc.ClientConn
	ManagerName() string
	ManagerVersion() semver.Version

	Status(context.Context) *rpc.ConnectInfo
	UpdateStatus(context.Context, *rpc.ConnectRequest) *rpc.ConnectInfo

	Uninstall(context.Context, *rpc.UninstallRequest) (*common.Result, error)

	WatchWorkloads(context.Context, *rpc.WatchWorkloadsRequest, WatchWorkloadsStream) error
	WorkloadInfoSnapshot(context.Context, []string, rpc.ListRequest_Filter, bool) (*rpc.WorkloadInfoSnapshot, error)

	GetCurrentNamespaces(forClientAccess bool) []string
	ActualNamespace(string) string
	AddNamespaceListener(context.Context, NamespaceListener)

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

	GatherLogs(context.Context, *connector.LogsRequest) (*connector.LogsResponse, error)
	GatherTraces(ctx context.Context, tr *connector.TracesRequest) *common.Result

	Reporter() *scout.Reporter
	SessionInfo() *manager.SessionInfo

	ApplyConfig(context.Context) error
	GetConfig(context.Context) (*client.SessionConfig, error)
	StartServices(g *dgroup.Group)
	Epilog(ctx context.Context)
	Done() <-chan struct{}
}

func GetSession added in v2.11.0

func GetSession(ctx context.Context) Session

type WatchWorkloadsStream added in v2.9.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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