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
|
// to the given type registry
|
||||||
func RegisterTypes(r resource.Registry) {
|
func RegisterTypes(r resource.Registry) {
|
||||||
types.Register(r)
|
types.Register(r)
|
||||||
types.RegisterEnterprise(r)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterControllers registers controllers for the multicluster types with
|
// RegisterControllers registers controllers for the multicluster types with
|
||||||
|
|
|
@ -72,22 +72,14 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoExportedServices() {
|
||||||
Name: "svc0",
|
Name: "svc0",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("test-peer", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
|
||||||
Peer: "test-peer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if suite.isEnterprise {
|
if suite.isEnterprise {
|
||||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("peer-n", "partition"))
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-n",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||||
|
@ -118,22 +110,14 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoMatchingServices() {
|
||||||
Name: "svc0",
|
Name: "svc0",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("test-peer", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
|
||||||
Peer: "test-peer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if suite.isEnterprise {
|
if suite.isEnterprise {
|
||||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-n",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||||
|
@ -189,22 +173,14 @@ func (suite *controllerSuite) TestReconcile_SkipWritingNewCES() {
|
||||||
Name: "svc-0",
|
Name: "svc-0",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("peer-1", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
|
||||||
Peer: "peer-1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if suite.isEnterprise {
|
if suite.isEnterprise {
|
||||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-n",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||||
|
@ -312,26 +288,10 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
||||||
Name: "svc-0",
|
Name: "svc-0",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("peer-1", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
suite.constructConsumer("peer-2", "peer"),
|
||||||
Peer: "peer-1",
|
suite.constructConsumer("part-1", "partition"),
|
||||||
},
|
suite.constructConsumer("part-n", "partition"),
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
|
||||||
Peer: "peer-2",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -341,21 +301,9 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
||||||
Name: "svc-1",
|
Name: "svc-1",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("peer-2", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
suite.constructConsumer("part-1", "partition"),
|
||||||
Peer: "peer-2",
|
suite.constructConsumer("part-n", "partition"),
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -365,21 +313,9 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
||||||
Name: "svc-2",
|
Name: "svc-2",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("peer-2", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
suite.constructConsumer("part-1", "partition"),
|
||||||
Peer: "peer-2",
|
suite.constructConsumer("part-n", "partition"),
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
|
||||||
Partition: "part-n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -394,16 +330,8 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
||||||
Name: "svc-0",
|
Name: "svc-0",
|
||||||
},
|
},
|
||||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||||
{
|
suite.constructConsumer("peer-1", "peer"),
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
suite.constructConsumer("peer-2", "peer"),
|
||||||
Peer: "peer-1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
|
||||||
Peer: "peer-2",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,4 +18,6 @@ func Register(r resource.Registry) {
|
||||||
RegisterNamespaceExportedServices(r)
|
RegisterNamespaceExportedServices(r)
|
||||||
RegisterPartitionExportedServices(r)
|
RegisterPartitionExportedServices(r)
|
||||||
RegisterComputedExportedServices(r)
|
RegisterComputedExportedServices(r)
|
||||||
|
|
||||||
|
RegisterEnterpriseTypes(r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,6 @@ package types
|
||||||
|
|
||||||
import "github.com/hashicorp/consul/internal/resource"
|
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