mirror of https://github.com/status-im/consul.git
Move enterprise multicluster types to Register function (#19913)
* Move enterprise types to Register function * Fix function name * Address comments
This commit is contained in:
parent
173fe11c2b
commit
90010587f0
|
@ -21,7 +21,6 @@ var (
|
|||
// to the given type registry
|
||||
func RegisterTypes(r resource.Registry) {
|
||||
types.Register(r)
|
||||
types.RegisterEnterprise(r)
|
||||
}
|
||||
|
||||
// RegisterControllers registers controllers for the multicluster types with
|
||||
|
|
|
@ -72,22 +72,14 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoExportedServices() {
|
|||
Name: "svc0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "test-peer",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("test-peer", "peer"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if suite.isEnterprise {
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-n",
|
||||
},
|
||||
})
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("peer-n", "partition"))
|
||||
}
|
||||
|
||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||
|
@ -118,22 +110,14 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoMatchingServices() {
|
|||
Name: "svc0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "test-peer",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("test-peer", "peer"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if suite.isEnterprise {
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-n",
|
||||
},
|
||||
})
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
}
|
||||
|
||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||
|
@ -189,22 +173,14 @@ func (suite *controllerSuite) TestReconcile_SkipWritingNewCES() {
|
|||
Name: "svc-0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-1",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if suite.isEnterprise {
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-n",
|
||||
},
|
||||
})
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
}
|
||||
|
||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||
|
@ -312,26 +288,10 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
Name: "svc-0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-1",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-2",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-1",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-n",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
suite.constructConsumer("part-1", "partition"),
|
||||
suite.constructConsumer("part-n", "partition"),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -341,21 +301,9 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
Name: "svc-1",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-2",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-1",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-n",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
suite.constructConsumer("part-1", "partition"),
|
||||
suite.constructConsumer("part-n", "partition"),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -365,21 +313,9 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
Name: "svc-2",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-2",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-1",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Partition: "part-n",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
suite.constructConsumer("part-1", "partition"),
|
||||
suite.constructConsumer("part-n", "partition"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -394,16 +330,8 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
Name: "svc-0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-1",
|
||||
},
|
||||
},
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Peer: "peer-2",
|
||||
},
|
||||
},
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -18,4 +18,6 @@ func Register(r resource.Registry) {
|
|||
RegisterNamespaceExportedServices(r)
|
||||
RegisterPartitionExportedServices(r)
|
||||
RegisterComputedExportedServices(r)
|
||||
|
||||
RegisterEnterpriseTypes(r)
|
||||
}
|
||||
|
|
|
@ -7,5 +7,6 @@ package types
|
|||
|
||||
import "github.com/hashicorp/consul/internal/resource"
|
||||
|
||||
func RegisterEnterprise(r resource.Registry) {
|
||||
func RegisterEnterpriseTypes(r resource.Registry) {
|
||||
// no-op in CE
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue