|
|
@ -95,9 +95,7 @@ func (s *Server) DeltaAggregatedResources(stream ADSDeltaStream) error { |
|
|
|
func getEnvoyConfiguration(proxySnapshot proxysnapshot.ProxySnapshot, logger hclog.Logger, cfgFetcher configfetcher.ConfigFetcher) (map[string][]proto.Message, error) { |
|
|
|
func getEnvoyConfiguration(proxySnapshot proxysnapshot.ProxySnapshot, logger hclog.Logger, cfgFetcher configfetcher.ConfigFetcher) (map[string][]proto.Message, error) { |
|
|
|
switch proxySnapshot.(type) { |
|
|
|
switch proxySnapshot.(type) { |
|
|
|
case *proxycfg.ConfigSnapshot: |
|
|
|
case *proxycfg.ConfigSnapshot: |
|
|
|
logger.Trace("ProxySnapshot update channel received a ProxySnapshot of type ConfigSnapshot", |
|
|
|
logger.Trace("ProxySnapshot update channel received a ProxySnapshot of type ConfigSnapshot") |
|
|
|
"proxySnapshot", proxySnapshot, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
generator := NewResourceGenerator( |
|
|
|
generator := NewResourceGenerator( |
|
|
|
logger, |
|
|
|
logger, |
|
|
|
cfgFetcher, |
|
|
|
cfgFetcher, |
|
|
@ -105,23 +103,18 @@ func getEnvoyConfiguration(proxySnapshot proxysnapshot.ProxySnapshot, logger hcl |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
c := proxySnapshot.(*proxycfg.ConfigSnapshot) |
|
|
|
c := proxySnapshot.(*proxycfg.ConfigSnapshot) |
|
|
|
logger.Trace("ConfigSnapshot", c) |
|
|
|
|
|
|
|
return generator.AllResourcesFromSnapshot(c) |
|
|
|
return generator.AllResourcesFromSnapshot(c) |
|
|
|
case *proxytracker.ProxyState: |
|
|
|
case *proxytracker.ProxyState: |
|
|
|
logger.Trace("ProxySnapshot update channel received a ProxySnapshot of type ProxyState", |
|
|
|
logger.Trace("ProxySnapshot update channel received a ProxySnapshot of type ProxyState") |
|
|
|
"proxySnapshot", proxySnapshot, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
generator := xdsv2.NewResourceGenerator( |
|
|
|
generator := xdsv2.NewResourceGenerator( |
|
|
|
logger, |
|
|
|
logger, |
|
|
|
) |
|
|
|
) |
|
|
|
c := proxySnapshot.(*proxytracker.ProxyState) |
|
|
|
c := proxySnapshot.(*proxytracker.ProxyState) |
|
|
|
logger.Trace("ProxyState", c) |
|
|
|
|
|
|
|
resources, err := generator.AllResourcesFromIR(c) |
|
|
|
resources, err := generator.AllResourcesFromIR(c) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
logger.Error("error generating resources from proxy state template", "err", err) |
|
|
|
logger.Error("error generating resources from proxy state template", "err", err) |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
logger.Trace("generated resources from proxy state template", "resources", resources) |
|
|
|
|
|
|
|
return resources, nil |
|
|
|
return resources, nil |
|
|
|
default: |
|
|
|
default: |
|
|
|
return nil, errors.New("proxysnapshot must be of type ProxyState or ConfigSnapshot") |
|
|
|
return nil, errors.New("proxysnapshot must be of type ProxyState or ConfigSnapshot") |
|
|
|