xds: remove Server.Initialize

Requiring a call to initialize to set a single field is not really substantially different
from having to set that field to a value.
This commit is contained in:
Daniel Nephin 2020-12-23 13:08:23 -05:00
parent bbf1a116f6
commit f6543b1651
3 changed files with 6 additions and 18 deletions

View File

@ -650,13 +650,13 @@ func (a *Agent) listenAndServeGRPC() error {
}
xdsServer := &xds.Server{
Logger: a.logger.Named(logging.Envoy),
CfgMgr: a.proxyConfig,
ResolveToken: a.resolveToken,
CheckFetcher: a,
CfgFetcher: a,
Logger: a.logger.Named(logging.Envoy),
CfgMgr: a.proxyConfig,
ResolveToken: a.resolveToken,
CheckFetcher: a,
CfgFetcher: a,
AuthCheckFrequency: xds.DefaultAuthCheckFrequency,
}
xdsServer.Initialize()
var err error
if a.config.HTTPSPort > 0 {

View File

@ -125,13 +125,6 @@ type Server struct {
CfgFetcher ConfigFetcher
}
// Initialize will finish configuring the Server for first use.
func (s *Server) Initialize() {
if s.AuthCheckFrequency == 0 {
s.AuthCheckFrequency = DefaultAuthCheckFrequency
}
}
// StreamAggregatedResources implements
// envoydisco.AggregatedDiscoveryServiceServer. This is the ADS endpoint which is
// the only xDS API we directly support for now.

View File

@ -102,7 +102,6 @@ func TestServer_StreamAggregatedResources_BasicProtocol(t *testing.T) {
CfgMgr: mgr,
ResolveToken: aclResolve,
}
s.Initialize()
sid := structs.NewServiceID("web-sidecar-proxy", nil)
@ -454,7 +453,6 @@ func TestServer_StreamAggregatedResources_ACLEnforcement(t *testing.T) {
CfgMgr: mgr,
ResolveToken: aclResolve,
}
s.Initialize()
errCh := make(chan error, 1)
go func() {
@ -528,7 +526,6 @@ func TestServer_StreamAggregatedResources_ACLTokenDeleted_StreamTerminatedDuring
ResolveToken: aclResolve,
AuthCheckFrequency: 1 * time.Hour, // make sure this doesn't kick in
}
s.Initialize()
errCh := make(chan error, 1)
go func() {
@ -622,7 +619,6 @@ func TestServer_StreamAggregatedResources_ACLTokenDeleted_StreamTerminatedInBack
ResolveToken: aclResolve,
AuthCheckFrequency: 100 * time.Millisecond, // Make this short.
}
s.Initialize()
errCh := make(chan error, 1)
go func() {
@ -707,7 +703,6 @@ func TestServer_StreamAggregatedResources_IngressEmptyResponse(t *testing.T) {
CfgMgr: mgr,
ResolveToken: aclResolve,
}
s.Initialize()
sid := structs.NewServiceID("ingress-gateway", nil)