xds

package
v0.0.0-...-7350628 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DynamicForwardProxyClusterName          = "dynamic-forward-proxy-cluster"
	ExternalProcessorGRPCServiceClusterName = "ext-processor-grpc-service"
	OTELCollectorClusterName                = "otel_collector"
	WebSubHubInternalClusterName            = "WEBSUBHUB_INTERNAL_CLUSTER"
)
View Source
const (
	// SecretNameUpstreamCA is the name of the SDS secret for upstream CA certificates
	SecretNameUpstreamCA = "upstream_ca_bundle"
)
View Source
const SharedRouteConfigName = "shared_route_config"

SharedRouteConfigName is the name of the shared route configuration used by both HTTP and HTTPS listeners

Variables

This section is empty.

Functions

func ConstructFullPath

func ConstructFullPath(context, apiVersion, path string) string

ConstructFullPath builds the full path by replacing $version placeholder in context and appending path If context contains $version, it will be replaced with the actual apiVersion value Example 1: context=/weather/$version, version=v1.0, path=/us/seattle -> /weather/v1.0/us/seattle Example 2: context=/weather, version=v1.0, path=/us/seattle -> /weather/us/seattle

func GenerateRouteName

func GenerateRouteName(method, context, apiVersion, path, vhost string) string

GenerateRouteName creates a unique route name in the format: HttpMethod|RoutePath|Vhost This format is used by both Envoy routes and the policy engine for route matching It builds the full path by combining context, version, and path using ConstructFullPath

func NewServerCallbacks

func NewServerCallbacks(logger *slog.Logger, onFirstConnect chan struct{}) *serverCallbacks

func SortRoutesByPriority

func SortRoutesByPriority(routes []*route.Route) []*route.Route

SortRoutesByPriority sorts routes by match precedence in descending order

Types

type EnvoyRoutes

type EnvoyRoutes []*route.Route

func (EnvoyRoutes) Len

func (x EnvoyRoutes) Len() int

func (EnvoyRoutes) Less

func (x EnvoyRoutes) Less(i, j int) bool

Returns true if route i should come AFTER route j (for ascending order). Since we use sort.Reverse for descending order, this effectively means route i has LOWER priority than route j when Less returns true.

Priority order (highest to lowest): 1. Path match type: Exact > Regex > Prefix 2. Path length (longer paths have higher priority) 3. Number of header matches (more headers = higher priority) 4. Number of exact header matches 5. Number of query parameter matches 6. Number of exact query parameter matches

func (EnvoyRoutes) Swap

func (x EnvoyRoutes) Swap(i, j int)

type SDSSecretManager

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

SDSSecretManager manages SDS secrets for TLS certificates

func NewSDSSecretManager

func NewSDSSecretManager(certStore *certstore.CertStore, cache cache.SnapshotCache, nodeID string, logger *slog.Logger) *SDSSecretManager

NewSDSSecretManager creates a new SDS secret manager It shares the same cache and node ID as the main xDS to ensure Envoy can fetch secrets

func (*SDSSecretManager) GetCache

func (sm *SDSSecretManager) GetCache() cache.SnapshotCache

GetCache returns the SDS snapshot cache

func (*SDSSecretManager) GetNodeID

func (sm *SDSSecretManager) GetNodeID() string

GetNodeID returns the node ID for SDS clients

func (*SDSSecretManager) GetSecret

func (sm *SDSSecretManager) GetSecret() (types.Resource, error)

GetSecret creates the SDS secret resource for inclusion in xDS snapshot

func (*SDSSecretManager) UpdateSecrets

func (sm *SDSSecretManager) UpdateSecrets() error

UpdateSecrets creates and updates the SDS snapshot with certificate secrets This now updates the main xDS snapshot instead of a separate SDS snapshot

type Server

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

Server is the xDS gRPC server

func NewServer

func NewServer(snapshotManager *SnapshotManager, sdsSecretManager *SDSSecretManager, port int, logger *slog.Logger, onFirstConnect chan struct{}) *Server

NewServer creates a new xDS server

func (*Server) Start

func (s *Server) Start() error

Start starts the xDS gRPC server

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully stops the xDS server

type SnapshotManager

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

SnapshotManager manages xDS snapshots for Envoy

func NewSnapshotManager

func NewSnapshotManager(store *storage.ConfigStore, logger *slog.Logger, routerConfig *config.RouterConfig, db storage.Storage, cfg *config.Config) *SnapshotManager

NewSnapshotManager creates a new snapshot manager

func (*SnapshotManager) GetCache

func (sm *SnapshotManager) GetCache() cache.SnapshotCache

GetCache returns the snapshot cache for use by xDS server

func (*SnapshotManager) GetTranslator

func (sm *SnapshotManager) GetTranslator() *Translator

GetTranslator returns the translator instance

func (*SnapshotManager) SetSDSSecretManager

func (sm *SnapshotManager) SetSDSSecretManager(sdsSecretManager *SDSSecretManager)

SetSDSSecretManager sets the SDS secret manager

func (*SnapshotManager) SetStatusCallback

func (sm *SnapshotManager) SetStatusCallback(callback StatusUpdateCallback)

SetStatusCallback sets the callback for status updates

func (*SnapshotManager) UpdateSnapshot

func (sm *SnapshotManager) UpdateSnapshot(ctx context.Context, correlationID string) error

UpdateSnapshot generates a new xDS snapshot from all configurations and updates the cache The correlationID parameter is optional and used for request tracing in logs

type StatusUpdateCallback

type StatusUpdateCallback func(configID string, success bool, correlationID string)

StatusUpdateCallback is called after xDS snapshot update completes

type Translator

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

Translator converts API configurations to Envoy xDS resources

func NewTranslator

func NewTranslator(logger *slog.Logger, routerConfig *config.RouterConfig, db storage.Storage, config *config.Config) *Translator

NewTranslator creates a new translator

func (*Translator) GetCertStore

func (t *Translator) GetCertStore() *certstore.CertStore

GetCertStore returns the certificate store instance

func (*Translator) SetTransformers

func (t *Translator) SetTransformers(transformers map[string]models.ConfigTransformer)

SetTransformers sets the kind-to-transformer map used by TranslateConfigs. When a transformer is available for a config's kind, the translator will produce a RuntimeDeployConfig first, then convert it to Envoy resources.

func (*Translator) TranslateConfigs

func (t *Translator) TranslateConfigs(
	configs []*models.StoredConfig,
	correlationID string,
) (map[resource.Type][]types.Resource, error)

TranslateConfigs translates all API configurations to Envoy resources The correlationID parameter is optional and used for request tracing in logs

Jump to

Keyboard shortcuts

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