delete all v2 resources type when deleting a namespace (CE) (#18621)

* add namespace scope to ServiceV1Alpha1Type

* add CE portion of namespace deletion
This commit is contained in:
Dhia Ayachi 2023-08-31 10:18:25 -04:00 committed by GitHub
parent 255aa158db
commit f8d77f027a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -7,6 +7,9 @@ import (
"bytes"
"context"
"fmt"
"github.com/hashicorp/consul/internal/catalog"
"github.com/hashicorp/consul/internal/mesh"
"github.com/hashicorp/consul/internal/resource/demo"
"net"
"os"
"strings"
@ -559,6 +562,10 @@ func newDefaultDeps(t *testing.T, c *Config) Deps {
RPCHoldTimeout: c.RPCHoldTimeout,
}
connPool.SetRPCClientTimeout(c.RPCClientTimeout)
registry := resource.NewRegistry()
demo.RegisterTypes(registry)
mesh.RegisterTypes(registry)
catalog.RegisterTypes(registry)
return Deps{
EventPublisher: stream.NewEventPublisher(10 * time.Second),
Logger: logger,
@ -578,7 +585,7 @@ func newDefaultDeps(t *testing.T, c *Config) Deps {
GetNetRPCInterceptorFunc: middleware.GetNetRPCInterceptor,
EnterpriseDeps: newDefaultDepsEnterprise(t, logger, c),
XDSStreamLimiter: limiter.NewSessionLimiter(),
Registry: resource.NewRegistry(),
Registry: registry,
}
}

View File

@ -461,6 +461,8 @@ type Server struct {
// handles metrics reporting to HashiCorp
reportingManager *reporting.ReportingManager
registry resource.Registry
}
func (s *Server) DecrementBlockingQueries() uint64 {
@ -547,6 +549,7 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server,
publisher: flat.EventPublisher,
incomingRPCLimiter: incomingRPCLimiter,
routineManager: routine.NewManager(logger.Named(logging.ConsulServer)),
registry: flat.Registry,
}
incomingRPCLimiter.Register(s)

View File

@ -32,6 +32,7 @@ func RegisterService(r resource.Registry) {
Type: ServiceV1Alpha1Type,
Proto: &pbcatalog.Service{},
Validate: ValidateService,
Scope: resource.ScopeNamespace,
})
}