mirror of https://github.com/status-im/consul.git
Adjust type + field names for ComputedExportedServices (#20030)
Adjust type + field names for ComputedExportedServices The existing type and field names in `ComputedExportedServices` are confusing to work with. For example, the mechanics of looping through services and their consumers wind up being: ```go // The field name here doesn't reflect what is actually at each index of the list for _, service := range exportedServices.Consumers { for _, consumer := range service.Consumers { // The prefix matching the type here causes stutter when reading and // isn't consistent with naming conventions for tenancy in pbresource tenancy := consumer.ConsumerTenancy } } ```
This commit is contained in:
parent
21e2bb2a67
commit
8233303876
|
@ -80,15 +80,15 @@ func (b *exportedServicesBuilder) build() *pbmulticluster.ComputedExportedServic
|
|||
}
|
||||
|
||||
ces := &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: make([]*pbmulticluster.ComputedExportedService, 0, len(b.data)),
|
||||
Services: make([]*pbmulticluster.ComputedExportedService, 0, len(b.data)),
|
||||
}
|
||||
|
||||
for _, svc := range sortRefValue(b.data) {
|
||||
consumers := make([]*pbmulticluster.ComputedExportedServicesConsumer, 0, len(svc.peers)+len(svc.partitions))
|
||||
consumers := make([]*pbmulticluster.ComputedExportedServiceConsumer, 0, len(svc.peers)+len(svc.partitions))
|
||||
|
||||
for _, peer := range sortKeys(svc.peers) {
|
||||
consumers = append(consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
consumers = append(consumers, &pbmulticluster.ComputedExportedServiceConsumer{
|
||||
Tenancy: &pbmulticluster.ComputedExportedServiceConsumer_Peer{
|
||||
Peer: peer,
|
||||
},
|
||||
})
|
||||
|
@ -103,14 +103,14 @@ func (b *exportedServicesBuilder) build() *pbmulticluster.ComputedExportedServic
|
|||
continue
|
||||
}
|
||||
|
||||
consumers = append(consumers, &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
consumers = append(consumers, &pbmulticluster.ComputedExportedServiceConsumer{
|
||||
Tenancy: &pbmulticluster.ComputedExportedServiceConsumer_Partition{
|
||||
Partition: partition,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
ces.Consumers = append(ces.Consumers, &pbmulticluster.ComputedExportedService{
|
||||
ces.Services = append(ces.Services, &pbmulticluster.ComputedExportedService{
|
||||
TargetRef: svc.ref,
|
||||
Consumers: consumers,
|
||||
})
|
||||
|
|
|
@ -70,14 +70,14 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoExportedServices() {
|
|||
|
||||
suite.runTestCaseWithTenancies(func(tenancy *pbresource.Tenancy) {
|
||||
oldCESData := &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: []*pbmulticluster.ComputedExportedService{
|
||||
Services: []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
TargetRef: &pbresource.Reference{
|
||||
Type: pbcatalog.ServiceType,
|
||||
Tenancy: tenancy,
|
||||
Name: "svc0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("test-peer", "peer"),
|
||||
},
|
||||
},
|
||||
|
@ -85,7 +85,7 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoExportedServices() {
|
|||
}
|
||||
|
||||
if suite.isEnterprise {
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
oldCESData.Services[0].Consumers = append(oldCESData.Services[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
}
|
||||
|
||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||
|
@ -108,14 +108,14 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoMatchingServices() {
|
|||
|
||||
suite.runTestCaseWithTenancies(func(tenancy *pbresource.Tenancy) {
|
||||
oldCESData := &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: []*pbmulticluster.ComputedExportedService{
|
||||
Services: []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
TargetRef: &pbresource.Reference{
|
||||
Type: pbcatalog.ServiceType,
|
||||
Tenancy: tenancy,
|
||||
Name: "svc0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("test-peer", "peer"),
|
||||
},
|
||||
},
|
||||
|
@ -123,7 +123,7 @@ func (suite *controllerSuite) TestReconcile_DeleteOldCES_NoMatchingServices() {
|
|||
}
|
||||
|
||||
if suite.isEnterprise {
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
oldCESData.Services[0].Consumers = append(oldCESData.Services[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
}
|
||||
|
||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||
|
@ -171,14 +171,14 @@ func (suite *controllerSuite) TestReconcile_SkipWritingNewCES() {
|
|||
|
||||
suite.runTestCaseWithTenancies(func(tenancy *pbresource.Tenancy) {
|
||||
oldCESData := &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: []*pbmulticluster.ComputedExportedService{
|
||||
Services: []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
TargetRef: &pbresource.Reference{
|
||||
Type: pbcatalog.ServiceType,
|
||||
Tenancy: tenancy,
|
||||
Name: "svc-0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
},
|
||||
|
@ -186,7 +186,7 @@ func (suite *controllerSuite) TestReconcile_SkipWritingNewCES() {
|
|||
}
|
||||
|
||||
if suite.isEnterprise {
|
||||
oldCESData.Consumers[0].Consumers = append(oldCESData.Consumers[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
oldCESData.Services[0].Consumers = append(oldCESData.Services[0].Consumers, suite.constructConsumer("part-n", "partition"))
|
||||
}
|
||||
|
||||
oldCES := rtest.Resource(pbmulticluster.ComputedExportedServicesType, "global").
|
||||
|
@ -286,14 +286,14 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
var expectedCES *pbmulticluster.ComputedExportedServices
|
||||
if suite.isEnterprise {
|
||||
expectedCES = &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: []*pbmulticluster.ComputedExportedService{
|
||||
Services: []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
TargetRef: &pbresource.Reference{
|
||||
Type: pbcatalog.ServiceType,
|
||||
Tenancy: tenancy,
|
||||
Name: "svc-0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
suite.constructConsumer("part-1", "partition"),
|
||||
|
@ -306,7 +306,7 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
Tenancy: tenancy,
|
||||
Name: "svc-1",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
suite.constructConsumer("part-1", "partition"),
|
||||
suite.constructConsumer("part-n", "partition"),
|
||||
|
@ -318,7 +318,7 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
Tenancy: tenancy,
|
||||
Name: "svc-2",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
suite.constructConsumer("part-1", "partition"),
|
||||
suite.constructConsumer("part-n", "partition"),
|
||||
|
@ -328,14 +328,14 @@ func (suite *controllerSuite) TestReconcile_ComputeCES() {
|
|||
}
|
||||
} else {
|
||||
expectedCES = &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: []*pbmulticluster.ComputedExportedService{
|
||||
Services: []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
TargetRef: &pbresource.Reference{
|
||||
Type: pbcatalog.ServiceType,
|
||||
Tenancy: resource.DefaultNamespacedTenancy(),
|
||||
Name: "svc-0",
|
||||
},
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
|
@ -384,7 +384,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService := constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
}),
|
||||
|
@ -407,7 +407,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
|
@ -415,7 +415,7 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
|
@ -430,7 +430,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
|
@ -438,13 +438,13 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc3", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
|
@ -459,7 +459,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
|
@ -467,7 +467,7 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
|
@ -489,14 +489,14 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc0", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
|
@ -505,7 +505,7 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
|
@ -520,21 +520,21 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc0", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc4", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
|
@ -543,7 +543,7 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
|
@ -558,14 +558,14 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc0", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
|
@ -574,7 +574,7 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
|
@ -590,14 +590,14 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc0", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
|
@ -606,14 +606,14 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc5", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("peer-2", "peer"),
|
||||
},
|
||||
|
@ -628,7 +628,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
|
@ -636,13 +636,13 @@ func (suite *controllerSuite) TestController() {
|
|||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc2", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc5", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
|
@ -655,7 +655,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
},
|
||||
|
@ -673,7 +673,7 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc0", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
|
@ -686,13 +686,13 @@ func (suite *controllerSuite) TestController() {
|
|||
expectedComputedExportedService = constructComputedExportedServices(
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc0", &pbresource.Tenancy{Partition: tenancy.Partition, Namespace: "app", PeerName: resource.DefaultPeerName}),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-1", "peer"),
|
||||
},
|
||||
),
|
||||
constructComputedExportedService(
|
||||
constructSvcReference("svc1", tenancy),
|
||||
[]*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
[]*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
suite.constructConsumer("peer-0", "peer"),
|
||||
suite.constructConsumer("part-0", "partition"),
|
||||
},
|
||||
|
@ -763,10 +763,10 @@ func (suite *controllerSuite) writePartitionedExportedService(name string, tenan
|
|||
Write(suite.T(), suite.client)
|
||||
}
|
||||
|
||||
func (suite *controllerSuite) constructConsumer(name, consumerType string) *pbmulticluster.ComputedExportedServicesConsumer {
|
||||
func (suite *controllerSuite) constructConsumer(name, consumerType string) *pbmulticluster.ComputedExportedServiceConsumer {
|
||||
if consumerType == "peer" {
|
||||
return &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
return &pbmulticluster.ComputedExportedServiceConsumer{
|
||||
Tenancy: &pbmulticluster.ComputedExportedServiceConsumer_Peer{
|
||||
Peer: name,
|
||||
},
|
||||
}
|
||||
|
@ -776,15 +776,15 @@ func (suite *controllerSuite) constructConsumer(name, consumerType string) *pbmu
|
|||
return nil
|
||||
}
|
||||
|
||||
return &pbmulticluster.ComputedExportedServicesConsumer{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
return &pbmulticluster.ComputedExportedServiceConsumer{
|
||||
Tenancy: &pbmulticluster.ComputedExportedServiceConsumer_Partition{
|
||||
Partition: name,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func constructComputedExportedService(ref *pbresource.Reference, consumers []*pbmulticluster.ComputedExportedServicesConsumer) *pbmulticluster.ComputedExportedService {
|
||||
finalConsumers := make([]*pbmulticluster.ComputedExportedServicesConsumer, 0)
|
||||
func constructComputedExportedService(ref *pbresource.Reference, consumers []*pbmulticluster.ComputedExportedServiceConsumer) *pbmulticluster.ComputedExportedService {
|
||||
finalConsumers := make([]*pbmulticluster.ComputedExportedServiceConsumer, 0)
|
||||
for _, c := range consumers {
|
||||
if c == nil {
|
||||
continue
|
||||
|
@ -799,9 +799,9 @@ func constructComputedExportedService(ref *pbresource.Reference, consumers []*pb
|
|||
}
|
||||
}
|
||||
|
||||
func constructComputedExportedServices(consumers ...*pbmulticluster.ComputedExportedService) *pbmulticluster.ComputedExportedServices {
|
||||
func constructComputedExportedServices(services ...*pbmulticluster.ComputedExportedService) *pbmulticluster.ComputedExportedServices {
|
||||
return &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: consumers,
|
||||
Services: services,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ import (
|
|||
)
|
||||
|
||||
func computedExportedServicesWithPartition(partitionName string) *pbmulticluster.ComputedExportedServices {
|
||||
consumers := []*pbmulticluster.ComputedExportedService{
|
||||
services := []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{
|
||||
Tenancy: &pbmulticluster.ComputedExportedServiceConsumer_Partition{
|
||||
Partition: partitionName,
|
||||
},
|
||||
},
|
||||
|
@ -29,16 +29,16 @@ func computedExportedServicesWithPartition(partitionName string) *pbmulticluster
|
|||
},
|
||||
}
|
||||
return &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: consumers,
|
||||
Services: services,
|
||||
}
|
||||
}
|
||||
|
||||
func computedExportedServicesWithPeer(peerName string) *pbmulticluster.ComputedExportedServices {
|
||||
consumers := []*pbmulticluster.ComputedExportedService{
|
||||
services := []*pbmulticluster.ComputedExportedService{
|
||||
{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{
|
||||
Consumers: []*pbmulticluster.ComputedExportedServiceConsumer{
|
||||
{
|
||||
ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{
|
||||
Tenancy: &pbmulticluster.ComputedExportedServiceConsumer_Peer{
|
||||
Peer: peerName,
|
||||
},
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ func computedExportedServicesWithPeer(peerName string) *pbmulticluster.ComputedE
|
|||
},
|
||||
}
|
||||
return &pbmulticluster.ComputedExportedServices{
|
||||
Consumers: consumers,
|
||||
Services: services,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,11 @@ package types
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/go-multierror"
|
||||
|
||||
"github.com/hashicorp/consul/internal/resource"
|
||||
pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
)
|
||||
|
||||
func validateExportedServicesConsumer(consumer *pbmulticluster.ExportedServicesConsumer, indx int) error {
|
||||
|
@ -34,24 +36,24 @@ func ValidateComputedExportedServicesEnterprise(computedExportedServices *pbmult
|
|||
|
||||
var merr error
|
||||
|
||||
for indx, consumer := range computedExportedServices.GetConsumers() {
|
||||
for _, computedExportedServiceConsumer := range consumer.GetConsumers() {
|
||||
switch computedExportedServiceConsumer.GetConsumerTenancy().(type) {
|
||||
case *pbmulticluster.ComputedExportedServicesConsumer_Partition:
|
||||
for indx, service := range computedExportedServices.GetServices() {
|
||||
for _, consumer := range service.GetConsumers() {
|
||||
switch consumer.GetTenancy().(type) {
|
||||
case *pbmulticluster.ComputedExportedServiceConsumer_Partition:
|
||||
merr = multierror.Append(merr, resource.ErrInvalidListElement{
|
||||
Name: "partition",
|
||||
Index: indx,
|
||||
Wrapped: fmt.Errorf("can only be set in Enterprise"),
|
||||
})
|
||||
if computedExportedServiceConsumer.GetPartition() == "" {
|
||||
if consumer.GetPartition() == "" {
|
||||
merr = multierror.Append(merr, resource.ErrInvalidListElement{
|
||||
Name: "partition",
|
||||
Index: indx,
|
||||
Wrapped: fmt.Errorf("can not be empty"),
|
||||
})
|
||||
}
|
||||
case *pbmulticluster.ComputedExportedServicesConsumer_Peer:
|
||||
if computedExportedServiceConsumer.GetPeer() == "" {
|
||||
case *pbmulticluster.ComputedExportedServiceConsumer_Peer:
|
||||
if consumer.GetPeer() == "" {
|
||||
merr = multierror.Append(merr, resource.ErrInvalidListElement{
|
||||
Name: "peer",
|
||||
Index: indx,
|
||||
|
|
|
@ -28,11 +28,11 @@ func (msg *ComputedExportedService) UnmarshalBinary(b []byte) error {
|
|||
}
|
||||
|
||||
// MarshalBinary implements encoding.BinaryMarshaler
|
||||
func (msg *ComputedExportedServicesConsumer) MarshalBinary() ([]byte, error) {
|
||||
func (msg *ComputedExportedServiceConsumer) MarshalBinary() ([]byte, error) {
|
||||
return proto.Marshal(msg)
|
||||
}
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||
func (msg *ComputedExportedServicesConsumer) UnmarshalBinary(b []byte) error {
|
||||
func (msg *ComputedExportedServiceConsumer) UnmarshalBinary(b []byte) error {
|
||||
return proto.Unmarshal(b, msg)
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ type ComputedExportedServices struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Consumers []*ComputedExportedService `protobuf:"bytes,1,rep,name=consumers,proto3" json:"consumers,omitempty"`
|
||||
Services []*ComputedExportedService `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ComputedExportedServices) Reset() {
|
||||
|
@ -64,9 +64,9 @@ func (*ComputedExportedServices) Descriptor() ([]byte, []int) {
|
|||
return file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ComputedExportedServices) GetConsumers() []*ComputedExportedService {
|
||||
func (x *ComputedExportedServices) GetServices() []*ComputedExportedService {
|
||||
if x != nil {
|
||||
return x.Consumers
|
||||
return x.Services
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ type ComputedExportedService struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
TargetRef *pbresource.Reference `protobuf:"bytes,1,opt,name=target_ref,json=targetRef,proto3" json:"target_ref,omitempty"`
|
||||
Consumers []*ComputedExportedServicesConsumer `protobuf:"bytes,2,rep,name=consumers,proto3" json:"consumers,omitempty"`
|
||||
Consumers []*ComputedExportedServiceConsumer `protobuf:"bytes,2,rep,name=consumers,proto3" json:"consumers,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ComputedExportedService) Reset() {
|
||||
|
@ -119,29 +119,29 @@ func (x *ComputedExportedService) GetTargetRef() *pbresource.Reference {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *ComputedExportedService) GetConsumers() []*ComputedExportedServicesConsumer {
|
||||
func (x *ComputedExportedService) GetConsumers() []*ComputedExportedServiceConsumer {
|
||||
if x != nil {
|
||||
return x.Consumers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ComputedExportedServicesConsumer struct {
|
||||
type ComputedExportedServiceConsumer struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// no sameness group
|
||||
//
|
||||
// Types that are assignable to ConsumerTenancy:
|
||||
// Types that are assignable to Tenancy:
|
||||
//
|
||||
// *ComputedExportedServicesConsumer_Peer
|
||||
// *ComputedExportedServicesConsumer_Partition
|
||||
ConsumerTenancy isComputedExportedServicesConsumer_ConsumerTenancy `protobuf_oneof:"consumer_tenancy"`
|
||||
// *ComputedExportedServiceConsumer_Peer
|
||||
// *ComputedExportedServiceConsumer_Partition
|
||||
Tenancy isComputedExportedServiceConsumer_Tenancy `protobuf_oneof:"tenancy"`
|
||||
}
|
||||
|
||||
func (x *ComputedExportedServicesConsumer) Reset() {
|
||||
*x = ComputedExportedServicesConsumer{}
|
||||
func (x *ComputedExportedServiceConsumer) Reset() {
|
||||
*x = ComputedExportedServiceConsumer{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
|
@ -149,13 +149,13 @@ func (x *ComputedExportedServicesConsumer) Reset() {
|
|||
}
|
||||
}
|
||||
|
||||
func (x *ComputedExportedServicesConsumer) String() string {
|
||||
func (x *ComputedExportedServiceConsumer) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ComputedExportedServicesConsumer) ProtoMessage() {}
|
||||
func (*ComputedExportedServiceConsumer) ProtoMessage() {}
|
||||
|
||||
func (x *ComputedExportedServicesConsumer) ProtoReflect() protoreflect.Message {
|
||||
func (x *ComputedExportedServiceConsumer) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
|
@ -167,48 +167,47 @@ func (x *ComputedExportedServicesConsumer) ProtoReflect() protoreflect.Message {
|
|||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ComputedExportedServicesConsumer.ProtoReflect.Descriptor instead.
|
||||
func (*ComputedExportedServicesConsumer) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ComputedExportedServiceConsumer.ProtoReflect.Descriptor instead.
|
||||
func (*ComputedExportedServiceConsumer) Descriptor() ([]byte, []int) {
|
||||
return file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (m *ComputedExportedServicesConsumer) GetConsumerTenancy() isComputedExportedServicesConsumer_ConsumerTenancy {
|
||||
func (m *ComputedExportedServiceConsumer) GetTenancy() isComputedExportedServiceConsumer_Tenancy {
|
||||
if m != nil {
|
||||
return m.ConsumerTenancy
|
||||
return m.Tenancy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ComputedExportedServicesConsumer) GetPeer() string {
|
||||
if x, ok := x.GetConsumerTenancy().(*ComputedExportedServicesConsumer_Peer); ok {
|
||||
func (x *ComputedExportedServiceConsumer) GetPeer() string {
|
||||
if x, ok := x.GetTenancy().(*ComputedExportedServiceConsumer_Peer); ok {
|
||||
return x.Peer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ComputedExportedServicesConsumer) GetPartition() string {
|
||||
if x, ok := x.GetConsumerTenancy().(*ComputedExportedServicesConsumer_Partition); ok {
|
||||
func (x *ComputedExportedServiceConsumer) GetPartition() string {
|
||||
if x, ok := x.GetTenancy().(*ComputedExportedServiceConsumer_Partition); ok {
|
||||
return x.Partition
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isComputedExportedServicesConsumer_ConsumerTenancy interface {
|
||||
isComputedExportedServicesConsumer_ConsumerTenancy()
|
||||
type isComputedExportedServiceConsumer_Tenancy interface {
|
||||
isComputedExportedServiceConsumer_Tenancy()
|
||||
}
|
||||
|
||||
type ComputedExportedServicesConsumer_Peer struct {
|
||||
type ComputedExportedServiceConsumer_Peer struct {
|
||||
Peer string `protobuf:"bytes,3,opt,name=peer,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ComputedExportedServicesConsumer_Partition struct {
|
||||
type ComputedExportedServiceConsumer_Partition struct {
|
||||
Partition string `protobuf:"bytes,4,opt,name=partition,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ComputedExportedServicesConsumer_Peer) isComputedExportedServicesConsumer_ConsumerTenancy() {}
|
||||
func (*ComputedExportedServiceConsumer_Peer) isComputedExportedServiceConsumer_Tenancy() {}
|
||||
|
||||
func (*ComputedExportedServicesConsumer_Partition) isComputedExportedServicesConsumer_ConsumerTenancy() {
|
||||
}
|
||||
func (*ComputedExportedServiceConsumer_Partition) isComputedExportedServiceConsumer_Tenancy() {}
|
||||
|
||||
var File_pbmulticluster_v2beta1_computed_exported_services_proto protoreflect.FileDescriptor
|
||||
|
||||
|
@ -222,57 +221,56 @@ var file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDesc = []byt
|
|||
0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e,
|
||||
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19,
|
||||
0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75,
|
||||
0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x18, 0x43, 0x6f,
|
||||
0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7e, 0x0a, 0x18, 0x43, 0x6f, 0x6d,
|
||||
0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||
0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69,
|
||||
0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e,
|
||||
0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x02, 0x22, 0xc4, 0x01, 0x0a, 0x17, 0x43, 0x6f,
|
||||
0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
|
||||
0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x68, 0x61, 0x73, 0x68,
|
||||
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c,
|
||||
0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61,
|
||||
0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74,
|
||||
0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6d, 0x65, 0x72, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x02, 0x22, 0xc5, 0x01, 0x0a,
|
||||
0x17, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65,
|
||||
0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67,
|
||||
0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x68,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
||||
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x66, 0x12, 0x65, 0x0a,
|
||||
0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x47, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65,
|
||||
0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6d, 0x65, 0x72, 0x73, 0x22, 0x6c, 0x0a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64,
|
||||
0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
|
||||
0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x1e,
|
||||
0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x12,
|
||||
0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e,
|
||||
0x63, 0x79, 0x42, 0xd6, 0x02, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
|
||||
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74,
|
||||
0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31,
|
||||
0x42, 0x1d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74,
|
||||
0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
|
||||
0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61,
|
||||
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x6d, 0x75,
|
||||
0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74,
|
||||
0x61, 0x31, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x76,
|
||||
0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02, 0x25, 0x48,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
||||
0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x32, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x31, 0x48,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c,
|
||||
0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||
0xea, 0x02, 0x28, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f,
|
||||
0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f,
|
||||
0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x68, 0x61, 0x73, 0x68,
|
||||
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52,
|
||||
0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x66, 0x12, 0x64, 0x0a, 0x09, 0x63, 0x6f,
|
||||
0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e,
|
||||
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32,
|
||||
0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78,
|
||||
0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73,
|
||||
0x22, 0x62, 0x0a, 0x1f, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f,
|
||||
0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6d, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x48, 0x00, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x09, 0x70, 0x61, 0x72,
|
||||
0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09,
|
||||
0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x74, 0x65, 0x6e,
|
||||
0x61, 0x6e, 0x63, 0x79, 0x42, 0xd6, 0x02, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73,
|
||||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75,
|
||||
0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74,
|
||||
0x61, 0x31, 0x42, 0x1d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f,
|
||||
0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62,
|
||||
0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02,
|
||||
0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6c, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56,
|
||||
0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
|
||||
0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02,
|
||||
0x31, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56,
|
||||
0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
|
||||
0x74, 0x61, 0xea, 0x02, 0x28, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a,
|
||||
0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -291,13 +289,13 @@ var file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes = make
|
|||
var file_pbmulticluster_v2beta1_computed_exported_services_proto_goTypes = []interface{}{
|
||||
(*ComputedExportedServices)(nil), // 0: hashicorp.consul.multicluster.v2beta1.ComputedExportedServices
|
||||
(*ComputedExportedService)(nil), // 1: hashicorp.consul.multicluster.v2beta1.ComputedExportedService
|
||||
(*ComputedExportedServicesConsumer)(nil), // 2: hashicorp.consul.multicluster.v2beta1.ComputedExportedServicesConsumer
|
||||
(*ComputedExportedServiceConsumer)(nil), // 2: hashicorp.consul.multicluster.v2beta1.ComputedExportedServiceConsumer
|
||||
(*pbresource.Reference)(nil), // 3: hashicorp.consul.resource.Reference
|
||||
}
|
||||
var file_pbmulticluster_v2beta1_computed_exported_services_proto_depIdxs = []int32{
|
||||
1, // 0: hashicorp.consul.multicluster.v2beta1.ComputedExportedServices.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ComputedExportedService
|
||||
1, // 0: hashicorp.consul.multicluster.v2beta1.ComputedExportedServices.services:type_name -> hashicorp.consul.multicluster.v2beta1.ComputedExportedService
|
||||
3, // 1: hashicorp.consul.multicluster.v2beta1.ComputedExportedService.target_ref:type_name -> hashicorp.consul.resource.Reference
|
||||
2, // 2: hashicorp.consul.multicluster.v2beta1.ComputedExportedService.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ComputedExportedServicesConsumer
|
||||
2, // 2: hashicorp.consul.multicluster.v2beta1.ComputedExportedService.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ComputedExportedServiceConsumer
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
|
@ -336,7 +334,7 @@ func file_pbmulticluster_v2beta1_computed_exported_services_proto_init() {
|
|||
}
|
||||
}
|
||||
file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ComputedExportedServicesConsumer); i {
|
||||
switch v := v.(*ComputedExportedServiceConsumer); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -349,8 +347,8 @@ func file_pbmulticluster_v2beta1_computed_exported_services_proto_init() {
|
|||
}
|
||||
}
|
||||
file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2].OneofWrappers = []interface{}{
|
||||
(*ComputedExportedServicesConsumer_Peer)(nil),
|
||||
(*ComputedExportedServicesConsumer_Partition)(nil),
|
||||
(*ComputedExportedServiceConsumer_Peer)(nil),
|
||||
(*ComputedExportedServiceConsumer_Partition)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
|
|
@ -11,17 +11,17 @@ import "pbresource/resource.proto";
|
|||
message ComputedExportedServices {
|
||||
option (hashicorp.consul.resource.spec) = {scope: SCOPE_PARTITION};
|
||||
|
||||
repeated ComputedExportedService consumers = 1;
|
||||
repeated ComputedExportedService services = 1;
|
||||
}
|
||||
|
||||
message ComputedExportedService {
|
||||
hashicorp.consul.resource.Reference target_ref = 1;
|
||||
repeated ComputedExportedServicesConsumer consumers = 2;
|
||||
repeated ComputedExportedServiceConsumer consumers = 2;
|
||||
}
|
||||
|
||||
message ComputedExportedServicesConsumer {
|
||||
message ComputedExportedServiceConsumer {
|
||||
// no sameness group
|
||||
oneof consumer_tenancy {
|
||||
oneof tenancy {
|
||||
string peer = 3;
|
||||
string partition = 4;
|
||||
}
|
||||
|
|
|
@ -47,23 +47,23 @@ func (in *ComputedExportedService) DeepCopyInterface() interface{} {
|
|||
return in.DeepCopy()
|
||||
}
|
||||
|
||||
// DeepCopyInto supports using ComputedExportedServicesConsumer within kubernetes types, where deepcopy-gen is used.
|
||||
func (in *ComputedExportedServicesConsumer) DeepCopyInto(out *ComputedExportedServicesConsumer) {
|
||||
// DeepCopyInto supports using ComputedExportedServiceConsumer within kubernetes types, where deepcopy-gen is used.
|
||||
func (in *ComputedExportedServiceConsumer) DeepCopyInto(out *ComputedExportedServiceConsumer) {
|
||||
proto.Reset(out)
|
||||
proto.Merge(out, proto.Clone(in))
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServicesConsumer. Required by controller-gen.
|
||||
func (in *ComputedExportedServicesConsumer) DeepCopy() *ComputedExportedServicesConsumer {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServiceConsumer. Required by controller-gen.
|
||||
func (in *ComputedExportedServiceConsumer) DeepCopy() *ComputedExportedServiceConsumer {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ComputedExportedServicesConsumer)
|
||||
out := new(ComputedExportedServiceConsumer)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServicesConsumer. Required by controller-gen.
|
||||
func (in *ComputedExportedServicesConsumer) DeepCopyInterface() interface{} {
|
||||
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServiceConsumer. Required by controller-gen.
|
||||
func (in *ComputedExportedServiceConsumer) DeepCopyInterface() interface{} {
|
||||
return in.DeepCopy()
|
||||
}
|
||||
|
|
|
@ -27,14 +27,14 @@ func (this *ComputedExportedService) UnmarshalJSON(b []byte) error {
|
|||
return ComputedExportedServicesUnmarshaler.Unmarshal(b, this)
|
||||
}
|
||||
|
||||
// MarshalJSON is a custom marshaler for ComputedExportedServicesConsumer
|
||||
func (this *ComputedExportedServicesConsumer) MarshalJSON() ([]byte, error) {
|
||||
// MarshalJSON is a custom marshaler for ComputedExportedServiceConsumer
|
||||
func (this *ComputedExportedServiceConsumer) MarshalJSON() ([]byte, error) {
|
||||
str, err := ComputedExportedServicesMarshaler.Marshal(this)
|
||||
return []byte(str), err
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshaler for ComputedExportedServicesConsumer
|
||||
func (this *ComputedExportedServicesConsumer) UnmarshalJSON(b []byte) error {
|
||||
// UnmarshalJSON is a custom unmarshaler for ComputedExportedServiceConsumer
|
||||
func (this *ComputedExportedServiceConsumer) UnmarshalJSON(b []byte) error {
|
||||
return ComputedExportedServicesUnmarshaler.Unmarshal(b, this)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue