handler

package
v0.0.0-...-fd0897c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConnection define the invalide connection
	ErrInvalidConnection = errors.New("invalid connection")

	// ErrNoCredentials define no creds
	ErrNoCredentials = errors.New("no credentials available")
)

Functions

This section is empty.

Types

type CredInfo

type CredInfo struct {
	UID            string
	Name           string
	Namespace      string
	ServiceAccount string
	Err            error
}

CredInfo returned by grpc Credential that the workload API can use.

func CallerFromAuthInfo

func CallerFromAuthInfo(ainfo credentials.AuthInfo) (CredInfo, bool)

CallerFromAuthInfo return the auth info

func CallerFromContext

func CallerFromContext(ctx context.Context) (CredInfo, bool)

CallerFromContext return the caller info

func NewCreds

func NewCreds(wli *pbmgmt.WorkloadInfo) *CredInfo

NewCreds creates the CredInfo.

func (CredInfo) AuthType

func (c CredInfo) AuthType() string

AuthType return the auth type

type Options

type Options struct {
	// PathPrefix is the uds path prefix for each workload service.
	PathPrefix string
	// Sockfile is the the uds file name for each workload service.
	SockFile string
	// RegAPI is the callback to invoke to connect the gRPC Server.
	RegAPI RegisterGrpcServer
}

Options contains the configuration for the workload service.

type RegisterGrpcServer

type RegisterGrpcServer func(s *grpc.Server)

RegisterGrpcServer is used by WorkloadAPI to register itself as the grpc server. It is invoked by the workload handler when it is initializing the workload socket.

type WorkloadHandler

type WorkloadHandler interface {
	Serve()
	Stop()
	WaitDone()
}

WorkloadHandler support this given interface. nodeagentmgmt invokes: - Serve() as a go routine when a Workload is added. - Stop() when a Workload is deleted. - WaitDone() to wait for a response back from Workloadhandler

func NewHandler

func NewHandler(wli *pbmgmt.WorkloadInfo, options Options) WorkloadHandler

NewHandler returns the new server with default setup.

Jump to

Keyboard shortcuts

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