grpc

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package grpc contains the functionality for the gRPC server for communicating with the nginx agent.

Index

Constants

This section is empty.

Variables

View Source
var ErrStatusInvalidConnection = status.Error(codes.Unauthenticated, "invalid connection")

Functions

This section is empty.

Types

type AgentConnectionsTracker

type AgentConnectionsTracker struct {
	// contains filtered or unexported fields
}

AgentConnectionsTracker keeps track of all connections between the control plane and nginx agents.

func (*AgentConnectionsTracker) GetConnection

func (c *AgentConnectionsTracker) GetConnection(key string) Connection

GetConnection returns the requested connection.

func (*AgentConnectionsTracker) RemoveConnection

func (c *AgentConnectionsTracker) RemoveConnection(key string)

RemoveConnection removes a connection from the tracking map.

func (*AgentConnectionsTracker) SetInstanceID

func (c *AgentConnectionsTracker) SetInstanceID(key, id string)

SetInstanceID sets the nginx instanceID for a connection.

func (*AgentConnectionsTracker) Track

func (c *AgentConnectionsTracker) Track(key string, conn Connection)

Track adds a connection to the tracking map.

type Connection

type Connection struct {
	PodName    string
	InstanceID string
	Parent     types.NamespacedName
}

Connection contains the data about a single nginx agent connection.

func (*Connection) Ready

func (c *Connection) Ready() bool

Ready returns if the connection is ready to be used. In other words, agent has registered itself and an nginx instance with the control plane.

type ConnectionsTracker

type ConnectionsTracker interface {
	Track(key string, conn Connection)
	GetConnection(key string) Connection
	SetInstanceID(key, id string)
	RemoveConnection(key string)
}

ConnectionsTracker defines an interface to track all connections between the control plane and nginx agents.

func NewConnectionsTracker

func NewConnectionsTracker() ConnectionsTracker

NewConnectionsTracker returns a new AgentConnectionsTracker instance.

type Interceptor

type Interceptor interface {
	Stream(logr.Logger) grpc.StreamServerInterceptor
	Unary(logr.Logger) grpc.UnaryServerInterceptor
}

Interceptor provides hooks to intercept the execution of an RPC on the server.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a gRPC server for communicating with the nginx agent.

func NewServer

func NewServer(
	logger logr.Logger,
	port int,
	registerSvcs []func(*grpc.Server),
	k8sClient client.Client,
	tokenAudience string,
	resetConnChan chan<- struct{},
) *Server

func (*Server) Start

func (g *Server) Start(ctx context.Context) error

Start is a runnable that starts the gRPC server for communicating with the nginx agent.

Directories

Path Synopsis
Package context contains the functions for storing extra information in the gRPC context.
Package context contains the functions for storing extra information in the gRPC context.
Package filewatcher contains the functions to watch for TLS file updates for the gRPC server.
Package filewatcher contains the functions to watch for TLS file updates for the gRPC server.
Code generated by counterfeiter.
Code generated by counterfeiter.
Package interceptor contains the middleware for intercepting an RPC call.
Package interceptor contains the middleware for intercepting an RPC call.
Package messenger provides a wrapper around a gRPC stream with the nginx agent.
Package messenger provides a wrapper around a gRPC stream with the nginx agent.
messengerfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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