Documentation
¶
Index ¶
- func NewWorkerProxyServiceServer(scsClient *atomic.Value, ssClient *atomic.Value) *workerProxyServiceServer
- type Config
- type HandlerProperties
- type LastStatusInformation
- type TestConnectionInfo
- type TestSessionInfo
- type TestWorker
- func (tw *TestWorker) AddClusterWorkerMember(t testing.TB, opts *TestWorkerOpts) *TestWorker
- func (tw *TestWorker) Cancel()
- func (tw *TestWorker) Config() *Config
- func (tw *TestWorker) Context() context.Context
- func (tw *TestWorker) LookupSession(id string) (TestSessionInfo, bool)
- func (tw *TestWorker) Name() string
- func (tw *TestWorker) ProxyAddrs() []string
- func (tw *TestWorker) Shutdown()
- func (tw *TestWorker) UpstreamAddrs() []string
- func (tw *TestWorker) Worker() *Worker
- type TestWorkerOpts
- type Worker
- func (w *Worker) ControllerMultihopConn() (multihop.MultihopServiceClient, error)
- func (w *Worker) ControllerServerCoordinationServiceConn() (pbs.ServerCoordinationServiceClient, error)
- func (w *Worker) ControllerSessionConn() (pbs.SessionServiceClient, error)
- func (w *Worker) GrpcClientConn() (*grpc.ClientConn, error)
- func (w *Worker) LastStatusSuccess() *LastStatusInformation
- func (w *Worker) ParseAndStoreTags(incoming map[string][]string)
- func (w *Worker) Resolver() *manual.Resolver
- func (w *Worker) Shutdown() error
- func (w *Worker) Start() error
- func (w *Worker) StartControllerConnections() error
- func (w *Worker) WaitForNextSuccessfulStatusUpdate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandlerProperties ¶
type HandlerProperties struct {
ListenerConfig *listenerutil.ListenerConfig
}
type LastStatusInformation ¶
type LastStatusInformation struct { *pbs.StatusResponse StatusTime time.Time LastCalculatedUpstreams []string }
type TestConnectionInfo ¶
type TestConnectionInfo struct { Id string Status pbs.CONNECTIONSTATUS CloseTime time.Time }
TestConnectionInfo provides detail about a particular connection as a part of TestSessionInfo. See that struct for details about the purpose of this data and how it's gathered.
type TestSessionInfo ¶
type TestSessionInfo struct { Id string Status pbs.SESSIONSTATUS // Connections is indexed by connection ID, which is also included // within TestConnectionInfo for convenience. Connections map[string]TestConnectionInfo }
TestSessionInfo provides detail about a particular session from the worker's local session state. This detail is a point-in-time snapshot of what's in sessionInfoMap for a particular session, and may not contain all of the information that is contained within it, or the underlying ConnInfoMap. Only details that are really important to testing are passed along.
type TestWorker ¶
type TestWorker struct {
// contains filtered or unexported fields
}
TestWorker wraps a base.Server and Worker to provide a fully-programmatic worker for tests. Error checking (for instance, for valid config) is not stringent at the moment.
func NewTestWorker ¶
func NewTestWorker(t testing.TB, opts *TestWorkerOpts) *TestWorker
func (*TestWorker) AddClusterWorkerMember ¶
func (tw *TestWorker) AddClusterWorkerMember(t testing.TB, opts *TestWorkerOpts) *TestWorker
func (*TestWorker) Cancel ¶
func (tw *TestWorker) Cancel()
func (*TestWorker) Config ¶
func (tw *TestWorker) Config() *Config
func (*TestWorker) Context ¶
func (tw *TestWorker) Context() context.Context
func (*TestWorker) LookupSession ¶
func (tw *TestWorker) LookupSession(id string) (TestSessionInfo, bool)
LookupSession returns session info from the worker's local session state.
The return boolean will be true if the session was found, false if it wasn't.
See TestSessionInfo for details on how to use this info.
func (*TestWorker) Name ¶
func (tw *TestWorker) Name() string
func (*TestWorker) ProxyAddrs ¶
func (tw *TestWorker) ProxyAddrs() []string
func (*TestWorker) Shutdown ¶
func (tw *TestWorker) Shutdown()
Shutdown runs any cleanup functions; be sure to run this after your test is done
func (*TestWorker) UpstreamAddrs ¶
func (tw *TestWorker) UpstreamAddrs() []string
func (*TestWorker) Worker ¶
func (tw *TestWorker) Worker() *Worker
Worker returns the underlying worker
type TestWorkerOpts ¶
type TestWorkerOpts struct { // Config; if not provided a dev one will be created Config *config.Config // Sets initial upstream addresses InitialUpstreams []string // If true, the worker will not be started DisableAutoStart bool // The worker auth KMS to use, or one will be created WorkerAuthKms wrapping.Wrapper // The worker credential storage KMS to use, or one will be created WorkerAuthStorageKms wrapping.Wrapper // The location of the worker's auth storage WorkerAuthStoragePath string // The name to use for the worker, otherwise one will be randomly // generated, unless provided in a non-nil Config Name string // The logger to use, or one will be created Logger hclog.Logger // The registerer to use for registering all the collectors. Nil means // no metrics are registered. PrometheusRegisterer prometheus.Registerer // The amount of time to wait before marking connections as closed when a // connection cannot be made back to the controller StatusGracePeriodDuration time.Duration // Overrides worker's nonceFn, for cases where we want to have control // over the nonce we send to the Controller NonceFn randFn // If set, override the normal auth rotation period AuthRotationPeriod time.Duration }
type Worker ¶
type Worker struct { // The storage for node enrollment WorkerAuthStorage *nodeefile.Storage WorkerAuthCurrentKeyId *ua.String WorkerAuthRegistrationRequest string // Test-specific options (and possibly hidden dev-mode flags) TestOverrideX509VerifyDnsName string TestOverrideX509VerifyCertPool *x509.CertPool TestOverrideAuthRotationPeriod time.Duration // contains filtered or unexported fields }
func (*Worker) ControllerMultihopConn ¶
func (w *Worker) ControllerMultihopConn() (multihop.MultihopServiceClient, error)
ControllerMultihopConn returns the underlying multihop service client
func (*Worker) ControllerServerCoordinationServiceConn ¶
func (w *Worker) ControllerServerCoordinationServiceConn() (pbs.ServerCoordinationServiceClient, error)
ControllerServerCoordinationServiceConn returns the underlying server coordination service client
func (*Worker) ControllerSessionConn ¶
func (w *Worker) ControllerSessionConn() (pbs.SessionServiceClient, error)
ControllerSessionConn returns the underlying session service client
func (*Worker) GrpcClientConn ¶
func (w *Worker) GrpcClientConn() (*grpc.ClientConn, error)
GrpcClientConn returns the underlying client connection
func (*Worker) LastStatusSuccess ¶
func (w *Worker) LastStatusSuccess() *LastStatusInformation
LastStatusSuccess reports the last time we sent a successful status request.
func (*Worker) ParseAndStoreTags ¶
func (*Worker) Shutdown ¶
Shutdown shuts down the workers. skipListeners can be used to not stop listeners, useful for tests if we want to stop and start a worker. In order to create new listeners we'd have to migrate listener setup logic here -- doable, but work for later.
func (*Worker) StartControllerConnections ¶
StartControllerConnections starts up the resolver and initiates controller connection client creation
func (*Worker) WaitForNextSuccessfulStatusUpdate ¶
WaitForNextSuccessfulStatusUpdate waits for the next successful status. It's used by testing (and in the future, shutdown) in place of a more opaque and possibly unnecessarily long sleep for things like initial controller check-in, etc.
The timeout is aligned with the worker's status grace period. A nil error means the status was sent successfully.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package common contains types and helper functions that are used across the different packages under internal/server/worker.
|
Package common contains types and helper functions that are used across the different packages under internal/server/worker. |
internal
|
|
metric
Package metric provides functions to initialize the worker specific collectors and hooks to measure metrics and update the relevant collectors.
|
Package metric provides functions to initialize the worker specific collectors and hooks to measure metrics and update the relevant collectors. |
Package proxy contains a collection of proxy handlers for the worker to call once a connection has been authorized.
|
Package proxy contains a collection of proxy handlers for the worker to call once a connection has been authorized. |