mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-01 16:01:26 +02:00
support loading route configuration via rds
This commit is contained in:
parent
850a903341
commit
d23a110e6e
3 changed files with 131 additions and 64 deletions
|
@ -11,8 +11,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
clusterTypeURL = "type.googleapis.com/envoy.config.cluster.v3.Cluster"
|
||||
listenerTypeURL = "type.googleapis.com/envoy.config.listener.v3.Listener"
|
||||
clusterTypeURL = "type.googleapis.com/envoy.config.cluster.v3.Cluster"
|
||||
listenerTypeURL = "type.googleapis.com/envoy.config.listener.v3.Listener"
|
||||
routeConfigurationTypeURL = "type.googleapis.com/envoy.config.route.v3.RouteConfiguration"
|
||||
)
|
||||
|
||||
func (srv *Server) buildDiscoveryResources(ctx context.Context) (map[string][]*envoy_service_discovery_v3.Resource, error) {
|
||||
|
@ -44,5 +45,18 @@ func (srv *Server) buildDiscoveryResources(ctx context.Context) (map[string][]*e
|
|||
Resource: any,
|
||||
})
|
||||
}
|
||||
|
||||
routeConfigurations, err := srv.Builder.BuildRouteConfigurations(ctx, cfg.Config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, routeConfiguration := range routeConfigurations {
|
||||
resources[routeConfigurationTypeURL] = append(resources[routeConfigurationTypeURL], &envoy_service_discovery_v3.Resource{
|
||||
Name: routeConfiguration.Name,
|
||||
Version: hex.EncodeToString(cryptutil.HashProto(routeConfiguration)),
|
||||
Resource: protoutil.NewAny(routeConfiguration),
|
||||
})
|
||||
}
|
||||
|
||||
return resources, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue