Documentation
¶
Index ¶
- Constants
- func ConstructFullPath(context, apiVersion, path string) string
- func GenerateRouteName(method, context, apiVersion, path, vhost string) string
- func NewServerCallbacks(logger *slog.Logger, onFirstConnect chan struct{}) *serverCallbacks
- func SortRoutesByPriority(routes []*route.Route) []*route.Route
- type EnvoyRoutes
- type SDSSecretManager
- type Server
- type SnapshotManager
- func (sm *SnapshotManager) GetCache() cache.SnapshotCache
- func (sm *SnapshotManager) GetTranslator() *Translator
- func (sm *SnapshotManager) SetSDSSecretManager(sdsSecretManager *SDSSecretManager)
- func (sm *SnapshotManager) SetStatusCallback(callback StatusUpdateCallback)
- func (sm *SnapshotManager) UpdateSnapshot(ctx context.Context, correlationID string) error
- type StatusUpdateCallback
- type Translator
Constants ¶
const ( DynamicForwardProxyClusterName = "dynamic-forward-proxy-cluster" ExternalProcessorGRPCServiceClusterName = "ext-processor-grpc-service" OTELCollectorClusterName = "otel_collector" WebSubHubInternalClusterName = "WEBSUBHUB_INTERNAL_CLUSTER" )
const (
// SecretNameUpstreamCA is the name of the SDS secret for upstream CA certificates
SecretNameUpstreamCA = "upstream_ca_bundle"
)
SharedRouteConfigName is the name of the shared route configuration used by both HTTP and HTTPS listeners
Variables ¶
This section is empty.
Functions ¶
func ConstructFullPath ¶
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 ¶
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 ¶
Types ¶
type EnvoyRoutes ¶
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
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 ¶
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