allow setting locality on services and nodes (#16581)
This commit is contained in:
parent
e625b7dc34
commit
0351f48bfd
|
@ -532,6 +532,7 @@ func LocalConfig(cfg *config.RuntimeConfig) local.Config {
|
|||
DiscardCheckOutput: cfg.DiscardCheckOutput,
|
||||
NodeID: cfg.NodeID,
|
||||
NodeName: cfg.NodeName,
|
||||
NodeLocality: cfg.StructLocality(),
|
||||
Partition: cfg.PartitionOrDefault(),
|
||||
TaggedAddresses: map[string]string{},
|
||||
}
|
||||
|
|
|
@ -304,6 +304,7 @@ func buildAgentService(s *structs.NodeService, dc string) api.AgentService {
|
|||
ModifyIndex: s.ModifyIndex,
|
||||
Weights: weights,
|
||||
Datacenter: dc,
|
||||
Locality: s.Locality.ToAPI(),
|
||||
}
|
||||
|
||||
if as.Tags == nil {
|
||||
|
|
|
@ -443,6 +443,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
|
|||
Tags: []string{"tag1"},
|
||||
Weights: nil, // nil weights...
|
||||
Port: 8100,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
|
||||
},
|
||||
// ... should be populated to avoid "IsSame" returning true during AE.
|
||||
|
|
|
@ -186,7 +186,7 @@ type Config struct {
|
|||
LeaveOnTerm *bool `mapstructure:"leave_on_terminate" json:"leave_on_terminate,omitempty"`
|
||||
LicensePath *string `mapstructure:"license_path" json:"license_path,omitempty"`
|
||||
Limits Limits `mapstructure:"limits" json:"-"`
|
||||
Locality Locality `mapstructure:"locality" json:"-"`
|
||||
Locality *Locality `mapstructure:"locality" json:"-"`
|
||||
LogLevel *string `mapstructure:"log_level" json:"log_level,omitempty"`
|
||||
LogJSON *bool `mapstructure:"log_json" json:"log_json,omitempty"`
|
||||
LogFile *string `mapstructure:"log_file" json:"log_file,omitempty"`
|
||||
|
|
|
@ -796,7 +796,7 @@ type RuntimeConfig struct {
|
|||
// hcl: leave_on_terminate = (true|false)
|
||||
LeaveOnTerm bool
|
||||
|
||||
Locality Locality
|
||||
Locality *Locality
|
||||
|
||||
// Logging configuration used to initialize agent logging.
|
||||
Logging logging.Config
|
||||
|
@ -1715,8 +1715,12 @@ func (c *RuntimeConfig) VersionWithMetadata() string {
|
|||
return version
|
||||
}
|
||||
|
||||
func (c *RuntimeConfig) StructLocality() structs.Locality {
|
||||
return structs.Locality{
|
||||
// StructLocality converts the RuntimeConfig Locality to a struct Locality.
|
||||
func (c *RuntimeConfig) StructLocality() *structs.Locality {
|
||||
if c.Locality == nil {
|
||||
return nil
|
||||
}
|
||||
return &structs.Locality{
|
||||
Region: stringVal(c.Locality.Region),
|
||||
Zone: stringVal(c.Locality.Zone),
|
||||
}
|
||||
|
|
|
@ -7092,7 +7092,7 @@ func TestRuntimeConfig_Sanitize(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
Locality: Locality{Region: strPtr("us-west-1"), Zone: strPtr("us-west-1a")},
|
||||
Locality: &Locality{Region: strPtr("us-west-1"), Zone: strPtr("us-west-1a")},
|
||||
}
|
||||
|
||||
b, err := json.MarshalIndent(rt.Sanitized(), "", " ")
|
||||
|
|
|
@ -371,6 +371,7 @@
|
|||
"EnterpriseMeta": {},
|
||||
"ID": "",
|
||||
"Kind": "",
|
||||
"Locality": null,
|
||||
"Meta": {},
|
||||
"Name": "foo",
|
||||
"Port": 0,
|
||||
|
|
|
@ -436,7 +436,7 @@ type Config struct {
|
|||
|
||||
PeeringTestAllowPeerRegistrations bool
|
||||
|
||||
Locality structs.Locality
|
||||
Locality *structs.Locality
|
||||
|
||||
// Embedded Consul Enterprise specific configuration
|
||||
*EnterpriseConfig
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/logging"
|
||||
"github.com/hashicorp/consul/proto/private/pbcommon"
|
||||
"github.com/hashicorp/consul/proto/private/pbpeering"
|
||||
"github.com/hashicorp/consul/proto/private/pbpeerstream"
|
||||
)
|
||||
|
@ -385,7 +386,7 @@ func (s *Server) establishStream(ctx context.Context,
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: peer.Partition,
|
||||
Datacenter: s.config.Datacenter,
|
||||
Locality: pbpeering.LocalityFromStruct(s.config.Locality),
|
||||
Locality: pbcommon.LocalityToProto(s.config.Locality),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/hashicorp/consul/agent/consul/state"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/proto/private/pbcommon"
|
||||
"github.com/hashicorp/consul/proto/private/pbpeering"
|
||||
"github.com/hashicorp/consul/sdk/freeport"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
|
@ -661,7 +662,7 @@ func TestLeader_Peering_RemoteInfo(t *testing.T) {
|
|||
t.Skip("too slow for testing.Short")
|
||||
}
|
||||
|
||||
acceptorLocality := structs.Locality{
|
||||
acceptorLocality := &structs.Locality{
|
||||
Region: "us-west-2",
|
||||
Zone: "us-west-2a",
|
||||
}
|
||||
|
@ -689,7 +690,7 @@ func TestLeader_Peering_RemoteInfo(t *testing.T) {
|
|||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
t.Cleanup(cancel)
|
||||
|
||||
dialerLocality := structs.Locality{
|
||||
dialerLocality := &structs.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
}
|
||||
|
@ -755,7 +756,7 @@ func TestLeader_Peering_RemoteInfo(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, "dc1", p.Peering.Remote.Datacenter)
|
||||
require.Contains(t, []string{"", "default"}, p.Peering.Remote.Partition)
|
||||
require.Equal(t, pbpeering.LocalityFromStruct(acceptorLocality), p.Peering.Remote.Locality)
|
||||
require.Equal(t, pbcommon.LocalityToProto(acceptorLocality), p.Peering.Remote.Locality)
|
||||
|
||||
// Retry fetching the until the peering is active in the acceptor.
|
||||
ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
|
@ -771,7 +772,7 @@ func TestLeader_Peering_RemoteInfo(t *testing.T) {
|
|||
require.NotNil(t, p)
|
||||
require.Equal(t, "dc2", p.Peering.Remote.Datacenter)
|
||||
require.Contains(t, []string{"", "default"}, p.Peering.Remote.Partition)
|
||||
require.Equal(t, pbpeering.LocalityFromStruct(dialerLocality), p.Peering.Remote.Locality)
|
||||
require.Equal(t, pbcommon.LocalityToProto(dialerLocality), p.Peering.Remote.Locality)
|
||||
}
|
||||
|
||||
// Test that the dialing peer attempts to reestablish connections when the accepting peer
|
||||
|
|
|
@ -197,6 +197,7 @@ func (s *Store) ensureRegistrationTxn(tx WriteTxn, idx uint64, preserveIndexes b
|
|||
TaggedAddresses: req.TaggedAddresses,
|
||||
Meta: req.NodeMeta,
|
||||
PeerName: req.PeerName,
|
||||
Locality: req.Locality,
|
||||
}
|
||||
if preserveIndexes {
|
||||
node.CreateIndex = req.CreateIndex
|
||||
|
|
|
@ -39,21 +39,21 @@ func TestStateStore_GetNodeID(t *testing.T) {
|
|||
|
||||
_, out, err := s.GetNodeID(types.NodeID("wrongId"), nil, "")
|
||||
if err == nil || out != nil || !strings.Contains(err.Error(), "node lookup by ID failed: index error: UUID (without hyphens) must be") {
|
||||
t.Errorf("want an error, nil value, err:=%q ; out:=%q", err.Error(), out)
|
||||
t.Errorf("want an error, nil value, err:=%q ; out:=%+v", err.Error(), out)
|
||||
}
|
||||
_, out, err = s.GetNodeID(types.NodeID("0123456789abcdefghijklmnopqrstuvwxyz"), nil, "")
|
||||
if err == nil || out != nil || !strings.Contains(err.Error(), "node lookup by ID failed: index error: invalid UUID") {
|
||||
t.Errorf("want an error, nil value, err:=%q ; out:=%q", err, out)
|
||||
t.Errorf("want an error, nil value, err:=%q ; out:=%+v", err, out)
|
||||
}
|
||||
|
||||
_, out, err = s.GetNodeID(types.NodeID("00a916bc-a357-4a19-b886-59419fcee50Z"), nil, "")
|
||||
if err == nil || out != nil || !strings.Contains(err.Error(), "node lookup by ID failed: index error: invalid UUID") {
|
||||
t.Errorf("want an error, nil value, err:=%q ; out:=%q", err, out)
|
||||
t.Errorf("want an error, nil value, err:=%q ; out:=%+v", err, out)
|
||||
}
|
||||
|
||||
_, out, err = s.GetNodeID(types.NodeID("00a916bc-a357-4a19-b886-59419fcee506"), nil, "")
|
||||
if err != nil || out != nil {
|
||||
t.Errorf("do not want any error nor returned value, err:=%q ; out:=%q", err, out)
|
||||
t.Errorf("do not want any error nor returned value, err:=%q ; out:=%+v", err, out)
|
||||
}
|
||||
|
||||
nodeID := types.NodeID("00a916bc-a357-4a19-b886-59419fceeaaa")
|
||||
|
@ -219,6 +219,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
TaggedAddresses: map[string]string{"hello": "world"},
|
||||
NodeMeta: map[string]string{"somekey": "somevalue"},
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
}
|
||||
if f != nil {
|
||||
f(req)
|
||||
|
@ -236,6 +237,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
Meta: map[string]string{"somekey": "somevalue"},
|
||||
RaftIndex: structs.RaftIndex{CreateIndex: 1, ModifyIndex: 1},
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
}
|
||||
|
||||
_, out, err := s.GetNode("node1", nil, peerName)
|
||||
|
@ -259,6 +261,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
RaftIndex: structs.RaftIndex{CreateIndex: 2, ModifyIndex: 2},
|
||||
EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -368,6 +371,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
Meta: map[string]string{strings.Repeat("a", 129): "somevalue"},
|
||||
Tags: []string{"primary"},
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
}
|
||||
})
|
||||
testutil.RequireErrorContains(t, s.EnsureRegistration(9, req), `Key is too long (limit: 128 characters)`)
|
||||
|
@ -384,6 +388,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
Tags: []string{"primary"},
|
||||
Weights: &structs.Weights{Passing: 1, Warning: 1},
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
}
|
||||
})
|
||||
require.NoError(t, s.EnsureRegistration(2, req))
|
||||
|
@ -404,6 +409,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
Tags: []string{"primary"},
|
||||
Weights: &structs.Weights{Passing: 1, Warning: 1},
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
}
|
||||
req.Check = &structs.HealthCheck{
|
||||
Node: "node1",
|
||||
|
@ -432,6 +438,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
|||
Tags: []string{"primary"},
|
||||
Weights: &structs.Weights{Passing: 1, Warning: 1},
|
||||
PeerName: peerName,
|
||||
Locality: &structs.Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
}
|
||||
req.Check = &structs.HealthCheck{
|
||||
Node: "node1",
|
||||
|
@ -939,7 +946,7 @@ func TestNodeRenamingNodes(t *testing.T) {
|
|||
}
|
||||
|
||||
if _, node, err := s.GetNodeID(nodeID1, nil, ""); err != nil || node == nil || node.ID != nodeID1 {
|
||||
t.Fatalf("err: %s, node:= %q", err, node)
|
||||
t.Fatalf("err: %s, node:= %+v", err, node)
|
||||
}
|
||||
|
||||
if _, node, err := s.GetNodeID(nodeID2, nil, ""); err != nil && node == nil || node.ID != nodeID2 {
|
||||
|
@ -1121,7 +1128,7 @@ func TestStateStore_EnsureNode(t *testing.T) {
|
|||
_, out, err = s.GetNode("node1", nil, "")
|
||||
require.NoError(t, err)
|
||||
if out != nil {
|
||||
t.Fatalf("Node should not exist anymore: %q", out)
|
||||
t.Fatalf("Node should not exist anymore: %+v", out)
|
||||
}
|
||||
|
||||
idx, out, err = s.GetNode("node1-renamed", nil, "")
|
||||
|
@ -1277,10 +1284,10 @@ func TestStateStore_EnsureNode(t *testing.T) {
|
|||
t.Fatalf("[DEPRECATED] err: %s", err)
|
||||
}
|
||||
if out.CreateIndex != 10 {
|
||||
t.Fatalf("[DEPRECATED] We expected to modify node previously added, but add index = %d for node %q", out.CreateIndex, out)
|
||||
t.Fatalf("[DEPRECATED] We expected to modify node previously added, but add index = %d for node %+v", out.CreateIndex, out)
|
||||
}
|
||||
if out.Address != "1.1.1.66" || out.ModifyIndex != 15 {
|
||||
t.Fatalf("[DEPRECATED] Node with newNodeID should have been updated, but was: %d with content := %q", out.CreateIndex, out)
|
||||
t.Fatalf("[DEPRECATED] Node with newNodeID should have been updated, but was: %d with content := %+v", out.CreateIndex, out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/hashicorp/consul/acl"
|
||||
"github.com/hashicorp/consul/agent/connect"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/proto/private/pbcommon"
|
||||
"github.com/hashicorp/consul/proto/private/pbpeering"
|
||||
"github.com/hashicorp/consul/proto/private/prototest"
|
||||
"github.com/hashicorp/consul/sdk/testutil"
|
||||
|
@ -1261,7 +1262,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1276,7 +1277,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1311,7 +1312,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1344,7 +1345,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1377,7 +1378,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1409,7 +1410,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1440,7 +1441,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1471,7 +1472,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
@ -1501,7 +1502,7 @@ func TestStore_PeeringWrite(t *testing.T) {
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: "part1",
|
||||
Datacenter: "datacenter1",
|
||||
Locality: &pbpeering.Locality{
|
||||
Locality: &pbcommon.Locality{
|
||||
Region: "us-west-1",
|
||||
Zone: "us-west-1a",
|
||||
},
|
||||
|
|
|
@ -59,6 +59,7 @@ type Config struct {
|
|||
DiscardCheckOutput bool
|
||||
NodeID types.NodeID
|
||||
NodeName string
|
||||
NodeLocality *structs.Locality
|
||||
Partition string // this defaults if empty
|
||||
TaggedAddresses map[string]string
|
||||
}
|
||||
|
@ -1073,6 +1074,7 @@ func (l *State) updateSyncState() error {
|
|||
// Check if node info needs syncing
|
||||
if svcNode == nil || svcNode.ID != l.config.NodeID ||
|
||||
!reflect.DeepEqual(svcNode.TaggedAddresses, l.config.TaggedAddresses) ||
|
||||
!reflect.DeepEqual(svcNode.Locality, l.config.NodeLocality) ||
|
||||
!reflect.DeepEqual(svcNode.Meta, l.metadata) {
|
||||
l.nodeInfoInSync = false
|
||||
}
|
||||
|
@ -1565,6 +1567,7 @@ func (l *State) syncNodeInfo() error {
|
|||
Node: l.config.NodeName,
|
||||
Address: l.config.AdvertiseAddr,
|
||||
TaggedAddresses: l.config.TaggedAddresses,
|
||||
Locality: l.config.NodeLocality,
|
||||
NodeMeta: l.metadata,
|
||||
EnterpriseMeta: l.agentEnterpriseMeta,
|
||||
WriteRequest: structs.WriteRequest{Token: at},
|
||||
|
|
|
@ -1974,6 +1974,10 @@ func TestAgentAntiEntropy_NodeInfo(t *testing.T) {
|
|||
node_id = "40e4a748-2192-161a-0510-9bf59fe950b5"
|
||||
node_meta {
|
||||
somekey = "somevalue"
|
||||
}
|
||||
locality {
|
||||
region = "us-west-1"
|
||||
zone = "us-west-1a"
|
||||
}`}
|
||||
if err := a.Start(t); err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -2008,10 +2012,12 @@ func TestAgentAntiEntropy_NodeInfo(t *testing.T) {
|
|||
id := services.NodeServices.Node.ID
|
||||
addrs := services.NodeServices.Node.TaggedAddresses
|
||||
meta := services.NodeServices.Node.Meta
|
||||
nodeLocality := services.NodeServices.Node.Locality
|
||||
delete(meta, structs.MetaSegmentKey) // Added later, not in config.
|
||||
require.Equal(t, a.Config.NodeID, id)
|
||||
require.Equal(t, a.Config.TaggedAddresses, addrs)
|
||||
assert.Equal(t, unNilMap(a.Config.NodeMeta), meta)
|
||||
require.Equal(t, a.Config.StructLocality(), nodeLocality)
|
||||
require.Equal(t, unNilMap(a.Config.NodeMeta), meta)
|
||||
|
||||
// Blow away the catalog version of the node info
|
||||
if err := a.RPC(context.Background(), "Catalog.Register", args, &out); err != nil {
|
||||
|
@ -2031,9 +2037,11 @@ func TestAgentAntiEntropy_NodeInfo(t *testing.T) {
|
|||
id := services.NodeServices.Node.ID
|
||||
addrs := services.NodeServices.Node.TaggedAddresses
|
||||
meta := services.NodeServices.Node.Meta
|
||||
nodeLocality := services.NodeServices.Node.Locality
|
||||
delete(meta, structs.MetaSegmentKey) // Added later, not in config.
|
||||
require.Equal(t, nodeID, id)
|
||||
require.Equal(t, a.Config.TaggedAddresses, addrs)
|
||||
require.Equal(t, a.Config.StructLocality(), nodeLocality)
|
||||
require.Equal(t, nodeMeta, meta)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/hashicorp/consul/agent/grpc-external/services/peerstream"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/lib"
|
||||
"github.com/hashicorp/consul/proto/private/pbcommon"
|
||||
"github.com/hashicorp/consul/proto/private/pbpeering"
|
||||
"github.com/hashicorp/consul/proto/private/pbpeerstream"
|
||||
)
|
||||
|
@ -87,7 +88,7 @@ type Config struct {
|
|||
Datacenter string
|
||||
ConnectEnabled bool
|
||||
PeeringEnabled bool
|
||||
Locality structs.Locality
|
||||
Locality *structs.Locality
|
||||
}
|
||||
|
||||
func NewServer(cfg Config) *Server {
|
||||
|
@ -447,7 +448,7 @@ func (s *Server) Establish(
|
|||
Remote: &pbpeering.RemoteInfo{
|
||||
Partition: tok.Remote.Partition,
|
||||
Datacenter: tok.Remote.Datacenter,
|
||||
Locality: pbpeering.LocalityFromStruct(tok.Remote.Locality),
|
||||
Locality: pbcommon.LocalityToProto(tok.Remote.Locality),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ type PeeringToken struct {
|
|||
type PeeringTokenRemote struct {
|
||||
Partition string
|
||||
Datacenter string
|
||||
Locality Locality
|
||||
Locality *Locality
|
||||
}
|
||||
|
||||
type IndexedExportedServiceList struct {
|
||||
|
|
|
@ -26,6 +26,7 @@ type ServiceDefinition struct {
|
|||
Weights *Weights
|
||||
Token string
|
||||
EnableTagOverride bool
|
||||
Locality *Locality
|
||||
|
||||
// Proxy is the configuration set for Kind = connect-proxy. It is mandatory in
|
||||
// that case and an error to be set for any other kind. This config is part of
|
||||
|
@ -76,6 +77,7 @@ func (s *ServiceDefinition) NodeService() *NodeService {
|
|||
Weights: s.Weights,
|
||||
EnableTagOverride: s.EnableTagOverride,
|
||||
EnterpriseMeta: s.EnterpriseMeta,
|
||||
Locality: s.Locality,
|
||||
}
|
||||
ns.EnterpriseMeta.Normalize()
|
||||
|
||||
|
|
|
@ -642,6 +642,10 @@ func (o *Node) DeepCopy() *Node {
|
|||
cp.Meta[k2] = v2
|
||||
}
|
||||
}
|
||||
if o.Locality != nil {
|
||||
cp.Locality = new(Locality)
|
||||
*cp.Locality = *o.Locality
|
||||
}
|
||||
return &cp
|
||||
}
|
||||
|
||||
|
@ -668,6 +672,10 @@ func (o *NodeService) DeepCopy() *NodeService {
|
|||
cp.Weights = new(Weights)
|
||||
*cp.Weights = *o.Weights
|
||||
}
|
||||
if o.Locality != nil {
|
||||
cp.Locality = new(Locality)
|
||||
*cp.Locality = *o.Locality
|
||||
}
|
||||
{
|
||||
retV := o.Proxy.DeepCopy()
|
||||
cp.Proxy = *retV
|
||||
|
@ -842,6 +850,10 @@ func (o *ServiceDefinition) DeepCopy() *ServiceDefinition {
|
|||
cp.Weights = new(Weights)
|
||||
*cp.Weights = *o.Weights
|
||||
}
|
||||
if o.Locality != nil {
|
||||
cp.Locality = new(Locality)
|
||||
*cp.Locality = *o.Locality
|
||||
}
|
||||
if o.Proxy != nil {
|
||||
cp.Proxy = o.Proxy.DeepCopy()
|
||||
}
|
||||
|
|
|
@ -462,6 +462,7 @@ type RegisterRequest struct {
|
|||
Service *NodeService
|
||||
Check *HealthCheck
|
||||
Checks HealthChecks
|
||||
Locality *Locality
|
||||
|
||||
// SkipNodeUpdate can be used when a register request is intended for
|
||||
// updating a service and/or checks, but doesn't want to overwrite any
|
||||
|
@ -506,7 +507,8 @@ func (r *RegisterRequest) ChangesNode(node *Node) bool {
|
|||
r.Address != node.Address ||
|
||||
r.Datacenter != node.Datacenter ||
|
||||
!reflect.DeepEqual(r.TaggedAddresses, node.TaggedAddresses) ||
|
||||
!reflect.DeepEqual(r.NodeMeta, node.Meta) {
|
||||
!reflect.DeepEqual(r.NodeMeta, node.Meta) ||
|
||||
!reflect.DeepEqual(r.Locality, node.Locality) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -875,6 +877,7 @@ type Node struct {
|
|||
PeerName string `json:",omitempty"`
|
||||
TaggedAddresses map[string]string
|
||||
Meta map[string]string
|
||||
Locality *Locality `json:",omitempty" bexpr:"-"`
|
||||
|
||||
RaftIndex `bexpr:"-"`
|
||||
}
|
||||
|
@ -1045,6 +1048,7 @@ type ServiceNode struct {
|
|||
ServiceEnableTagOverride bool
|
||||
ServiceProxy ConnectProxyConfig
|
||||
ServiceConnect ServiceConnect
|
||||
ServiceLocality *Locality `bexpr:"-"`
|
||||
|
||||
// If not empty, PeerName represents the peer that this ServiceNode was imported from.
|
||||
PeerName string `json:",omitempty"`
|
||||
|
@ -1103,6 +1107,7 @@ func (s *ServiceNode) PartialClone() *ServiceNode {
|
|||
ServiceEnableTagOverride: s.ServiceEnableTagOverride,
|
||||
ServiceProxy: s.ServiceProxy,
|
||||
ServiceConnect: s.ServiceConnect,
|
||||
ServiceLocality: s.ServiceLocality,
|
||||
RaftIndex: RaftIndex{
|
||||
CreateIndex: s.CreateIndex,
|
||||
ModifyIndex: s.ModifyIndex,
|
||||
|
@ -1130,6 +1135,7 @@ func (s *ServiceNode) ToNodeService() *NodeService {
|
|||
Connect: s.ServiceConnect,
|
||||
PeerName: s.PeerName,
|
||||
EnterpriseMeta: s.EnterpriseMeta,
|
||||
Locality: s.ServiceLocality,
|
||||
RaftIndex: RaftIndex{
|
||||
CreateIndex: s.CreateIndex,
|
||||
ModifyIndex: s.ModifyIndex,
|
||||
|
@ -1274,6 +1280,7 @@ type NodeService struct {
|
|||
SocketPath string `json:",omitempty"` // TODO This might be integrated into Address somehow, but not sure about the ergonomics. Only one of (address,port) or socketpath can be defined.
|
||||
Weights *Weights
|
||||
EnableTagOverride bool
|
||||
Locality *Locality `json:",omitempty" bexpr:"-"`
|
||||
|
||||
// Proxy is the configuration set for Kind = connect-proxy. It is mandatory in
|
||||
// that case and an error to be set for any other kind. This config is part of
|
||||
|
@ -1656,6 +1663,7 @@ func (s *NodeService) IsSame(other *NodeService) bool {
|
|||
!reflect.DeepEqual(s.TaggedAddresses, other.TaggedAddresses) ||
|
||||
!reflect.DeepEqual(s.Weights, other.Weights) ||
|
||||
!reflect.DeepEqual(s.Meta, other.Meta) ||
|
||||
!reflect.DeepEqual(s.Locality, other.Locality) ||
|
||||
s.EnableTagOverride != other.EnableTagOverride ||
|
||||
s.Kind != other.Kind ||
|
||||
!reflect.DeepEqual(s.Proxy, other.Proxy) ||
|
||||
|
@ -1731,6 +1739,7 @@ func (s *NodeService) ToServiceNode(node string) *ServiceNode {
|
|||
ServiceEnableTagOverride: s.EnableTagOverride,
|
||||
ServiceProxy: s.Proxy,
|
||||
ServiceConnect: s.Connect,
|
||||
ServiceLocality: s.Locality,
|
||||
EnterpriseMeta: s.EnterpriseMeta,
|
||||
PeerName: s.PeerName,
|
||||
RaftIndex: RaftIndex{
|
||||
|
@ -3034,3 +3043,15 @@ type Locality struct {
|
|||
// Zone is the zone the entity is running in.
|
||||
Zone string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// ToAPI converts a struct Locality to an API Locality.
|
||||
func (l *Locality) ToAPI() *api.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &api.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,8 @@ type AgentService struct {
|
|||
Namespace string `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
Partition string `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
// Datacenter is only ever returned and is ignored if presented.
|
||||
Datacenter string `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
Datacenter string `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
Locality *Locality `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
}
|
||||
|
||||
// AgentServiceChecksInfo returns information about a Service and its checks
|
||||
|
@ -291,6 +292,7 @@ type AgentServiceRegistration struct {
|
|||
Connect *AgentServiceConnect `json:",omitempty"`
|
||||
Namespace string `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
Partition string `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
Locality *Locality `json:",omitempty" bexpr:"-" hash:"ignore"`
|
||||
}
|
||||
|
||||
// ServiceRegisterOpts is used to pass extra options to the service register.
|
||||
|
|
|
@ -178,7 +178,7 @@ func TestAPI_AgentServiceAndReplaceChecks(t *testing.T) {
|
|||
|
||||
agent := c.Agent()
|
||||
s.WaitForSerfCheck(t)
|
||||
|
||||
locality := &Locality{Region: "us-west-1", Zone: "us-west-1a"}
|
||||
reg := &AgentServiceRegistration{
|
||||
Name: "foo",
|
||||
ID: "foo",
|
||||
|
@ -193,6 +193,7 @@ func TestAPI_AgentServiceAndReplaceChecks(t *testing.T) {
|
|||
Check: &AgentServiceCheck{
|
||||
TTL: "15s",
|
||||
},
|
||||
Locality: locality,
|
||||
}
|
||||
|
||||
regupdate := &AgentServiceRegistration{
|
||||
|
@ -205,7 +206,8 @@ func TestAPI_AgentServiceAndReplaceChecks(t *testing.T) {
|
|||
Port: 80,
|
||||
},
|
||||
},
|
||||
Port: 9000,
|
||||
Port: 9000,
|
||||
Locality: locality,
|
||||
}
|
||||
|
||||
if err := agent.ServiceRegister(reg); err != nil {
|
||||
|
@ -241,12 +243,14 @@ func TestAPI_AgentServiceAndReplaceChecks(t *testing.T) {
|
|||
require.NotNil(t, out)
|
||||
require.Equal(t, HealthPassing, state)
|
||||
require.Equal(t, 9000, out.Service.Port)
|
||||
require.Equal(t, locality, out.Service.Locality)
|
||||
|
||||
state, outs, err := agent.AgentHealthServiceByName("foo")
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, outs)
|
||||
require.Equal(t, HealthPassing, state)
|
||||
require.Equal(t, 9000, outs[0].Service.Port)
|
||||
require.Equal(t, locality, outs[0].Service.Locality)
|
||||
|
||||
if err := agent.ServiceDeregister("foo"); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
@ -330,6 +334,7 @@ func TestAPI_AgentServices(t *testing.T) {
|
|||
agent := c.Agent()
|
||||
s.WaitForSerfCheck(t)
|
||||
|
||||
locality := &Locality{Region: "us-west-1", Zone: "us-west-1a"}
|
||||
reg := &AgentServiceRegistration{
|
||||
Name: "foo",
|
||||
ID: "foo",
|
||||
|
@ -344,6 +349,7 @@ func TestAPI_AgentServices(t *testing.T) {
|
|||
Check: &AgentServiceCheck{
|
||||
TTL: "15s",
|
||||
},
|
||||
Locality: locality,
|
||||
}
|
||||
if err := agent.ServiceRegister(reg); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
@ -380,6 +386,7 @@ func TestAPI_AgentServices(t *testing.T) {
|
|||
require.NotNil(t, out)
|
||||
require.Equal(t, HealthCritical, state)
|
||||
require.Equal(t, 8000, out.Service.Port)
|
||||
require.Equal(t, locality, out.Service.Locality)
|
||||
|
||||
state, outs, err := agent.AgentHealthServiceByName("foo")
|
||||
require.Nil(t, err)
|
||||
|
|
|
@ -172,19 +172,21 @@ func testNodeServiceCheckRegistrations(t *testing.T, client *Client, datacenter
|
|||
Notes: "foo has ssh access",
|
||||
},
|
||||
},
|
||||
Locality: &Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
},
|
||||
"Service redis v1 on foo": {
|
||||
Datacenter: datacenter,
|
||||
Node: "foo",
|
||||
SkipNodeUpdate: true,
|
||||
Service: &AgentService{
|
||||
Kind: ServiceKindTypical,
|
||||
ID: "redisV1",
|
||||
Service: "redis",
|
||||
Tags: []string{"v1"},
|
||||
Meta: map[string]string{"version": "1"},
|
||||
Port: 1234,
|
||||
Address: "198.18.1.2",
|
||||
Kind: ServiceKindTypical,
|
||||
ID: "redisV1",
|
||||
Service: "redis",
|
||||
Tags: []string{"v1"},
|
||||
Meta: map[string]string{"version": "1"},
|
||||
Port: 1234,
|
||||
Address: "198.18.1.2",
|
||||
Locality: &Locality{Region: "us-west-1", Zone: "us-west-1a"},
|
||||
},
|
||||
Checks: HealthChecks{
|
||||
&HealthCheck{
|
||||
|
|
|
@ -19,8 +19,9 @@ type Node struct {
|
|||
Meta map[string]string
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
Partition string `json:",omitempty"`
|
||||
PeerName string `json:",omitempty"`
|
||||
Partition string `json:",omitempty"`
|
||||
PeerName string `json:",omitempty"`
|
||||
Locality *Locality `json:",omitempty"`
|
||||
}
|
||||
|
||||
type ServiceAddress struct {
|
||||
|
@ -45,6 +46,7 @@ type CatalogService struct {
|
|||
ServiceWeights Weights
|
||||
ServiceEnableTagOverride bool
|
||||
ServiceProxy *AgentServiceConnectProxyConfig
|
||||
ServiceLocality *Locality `json:",omitempty"`
|
||||
CreateIndex uint64
|
||||
Checks HealthChecks
|
||||
ModifyIndex uint64
|
||||
|
@ -74,6 +76,7 @@ type CatalogRegistration struct {
|
|||
Checks HealthChecks
|
||||
SkipNodeUpdate bool
|
||||
Partition string `json:",omitempty"`
|
||||
Locality *Locality
|
||||
}
|
||||
|
||||
type CatalogDeregistration struct {
|
||||
|
|
|
@ -326,11 +326,12 @@ func TestAPI_CatalogService_SingleTag(t *testing.T) {
|
|||
|
||||
agent := c.Agent()
|
||||
catalog := c.Catalog()
|
||||
|
||||
locality := &Locality{Region: "us-west-1", Zone: "us-west-1a"}
|
||||
reg := &AgentServiceRegistration{
|
||||
Name: "foo",
|
||||
ID: "foo1",
|
||||
Tags: []string{"bar"},
|
||||
Name: "foo",
|
||||
ID: "foo1",
|
||||
Tags: []string{"bar"},
|
||||
Locality: locality,
|
||||
}
|
||||
require.NoError(t, agent.ServiceRegister(reg))
|
||||
defer agent.ServiceDeregister("foo1")
|
||||
|
@ -341,6 +342,7 @@ func TestAPI_CatalogService_SingleTag(t *testing.T) {
|
|||
require.NotEqual(r, meta.LastIndex, 0)
|
||||
require.Len(r, services, 1)
|
||||
require.Equal(r, services[0].ServiceID, "foo1")
|
||||
require.Equal(r, locality, services[0].ServiceLocality)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ type PeeringRemoteInfo struct {
|
|||
Partition string
|
||||
// Datacenter is the remote peer's datacenter.
|
||||
Datacenter string
|
||||
Locality Locality
|
||||
Locality *Locality
|
||||
}
|
||||
|
||||
// Locality identifies where a given entity is running.
|
||||
|
|
|
@ -20,6 +20,20 @@ func EnvoyExtensionFromStructs(t *structs.EnvoyExtension, s *EnvoyExtension) {
|
|||
s.Required = t.Required
|
||||
s.Arguments = MapStringInterfaceToProtobufTypesStruct(t.Arguments)
|
||||
}
|
||||
func LocalityToStructs(s *Locality, t *structs.Locality) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
t.Region = s.Region
|
||||
t.Zone = s.Zone
|
||||
}
|
||||
func LocalityFromStructs(t *structs.Locality, s *Locality) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
s.Region = t.Region
|
||||
s.Zone = t.Zone
|
||||
}
|
||||
func QueryMetaToStructs(s *QueryMeta, t *structs.QueryMeta) {
|
||||
if s == nil {
|
||||
return
|
||||
|
|
|
@ -184,3 +184,33 @@ func (q *QueryMeta) GetBackend() structs.QueryBackend {
|
|||
func (q *QueryMeta) SetResultsFilteredByACLs(v bool) {
|
||||
q.ResultsFilteredByACLs = v
|
||||
}
|
||||
|
||||
// IsEmpty returns true if the Locality is unset or contains an empty region and zone.
|
||||
func (l *Locality) IsEmpty() bool {
|
||||
if l == nil {
|
||||
return true
|
||||
}
|
||||
return l.Region == "" && l.Zone == ""
|
||||
}
|
||||
|
||||
// LocalityFromProto converts a protobuf Locality to a struct Locality.
|
||||
func LocalityFromProto(l *Locality) *structs.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &structs.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
||||
// LocalityFromProto converts a struct Locality to a protobuf Locality.
|
||||
func LocalityToProto(l *structs.Locality) *Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,3 +86,13 @@ func (msg *EnvoyExtension) MarshalBinary() ([]byte, error) {
|
|||
func (msg *EnvoyExtension) UnmarshalBinary(b []byte) error {
|
||||
return proto.Unmarshal(b, msg)
|
||||
}
|
||||
|
||||
// MarshalBinary implements encoding.BinaryMarshaler
|
||||
func (msg *Locality) MarshalBinary() ([]byte, error) {
|
||||
return proto.Marshal(msg)
|
||||
}
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||
func (msg *Locality) UnmarshalBinary(b []byte) error {
|
||||
return proto.Unmarshal(b, msg)
|
||||
}
|
||||
|
|
|
@ -660,6 +660,68 @@ func (x *EnvoyExtension) GetArguments() *structpb.Struct {
|
|||
return nil
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
//
|
||||
// target=github.com/hashicorp/consul/agent/structs.Locality
|
||||
// output=common.gen.go
|
||||
// name=Structs
|
||||
type Locality struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Region is region the zone belongs to.
|
||||
Region string `protobuf:"bytes,1,opt,name=Region,proto3" json:"Region,omitempty"`
|
||||
// Zone is the zone the entity is running in.
|
||||
Zone string `protobuf:"bytes,2,opt,name=Zone,proto3" json:"Zone,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Locality) Reset() {
|
||||
*x = Locality{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_private_pbcommon_common_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Locality) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Locality) ProtoMessage() {}
|
||||
|
||||
func (x *Locality) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_private_pbcommon_common_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Locality.ProtoReflect.Descriptor instead.
|
||||
func (*Locality) Descriptor() ([]byte, []int) {
|
||||
return file_private_pbcommon_common_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *Locality) GetRegion() string {
|
||||
if x != nil {
|
||||
return x.Region
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Locality) GetZone() string {
|
||||
if x != nil {
|
||||
return x.Zone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_private_pbcommon_common_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_private_pbcommon_common_proto_rawDesc = []byte{
|
||||
|
@ -745,24 +807,28 @@ var file_private_pbcommon_common_proto_rawDesc = []byte{
|
|||
0x09, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x09, 0x41, 0x72, 0x67, 0x75, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x42, 0x8b, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73,
|
||||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x42, 0x0b, 0x43,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 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, 0x2f,
|
||||
0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x62, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0xa2, 0x02, 0x04, 0x48, 0x43, 0x49, 0x43, 0xaa, 0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||
0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xca, 0x02, 0x20, 0x48, 0x61, 0x73,
|
||||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x49, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5c, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xe2, 0x02, 0x2c,
|
||||
0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5c, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x23, 0x48,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x3a, 0x3a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x3a, 0x3a, 0x43, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x22, 0x36, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x5a, 0x6f, 0x6e, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x5a, 0x6f, 0x6e, 0x65, 0x42, 0x8b, 0x02, 0x0a,
|
||||
0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 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, 0x2f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2f,
|
||||
0x70, 0x62, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xa2, 0x02, 0x04, 0x48, 0x43, 0x49, 0x43, 0xaa,
|
||||
0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73,
|
||||
0x75, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0xca, 0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5c, 0x43,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xe2, 0x02, 0x2c, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
||||
0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
|
||||
0x6c, 0x5c, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x23, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6c, 0x3a, 0x3a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -777,7 +843,7 @@ func file_private_pbcommon_common_proto_rawDescGZIP() []byte {
|
|||
return file_private_pbcommon_common_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_private_pbcommon_common_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_private_pbcommon_common_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_private_pbcommon_common_proto_goTypes = []interface{}{
|
||||
(*RaftIndex)(nil), // 0: hashicorp.consul.internal.common.RaftIndex
|
||||
(*TargetDatacenter)(nil), // 1: hashicorp.consul.internal.common.TargetDatacenter
|
||||
|
@ -787,21 +853,22 @@ var file_private_pbcommon_common_proto_goTypes = []interface{}{
|
|||
(*QueryMeta)(nil), // 5: hashicorp.consul.internal.common.QueryMeta
|
||||
(*EnterpriseMeta)(nil), // 6: hashicorp.consul.internal.common.EnterpriseMeta
|
||||
(*EnvoyExtension)(nil), // 7: hashicorp.consul.internal.common.EnvoyExtension
|
||||
(*durationpb.Duration)(nil), // 8: google.protobuf.Duration
|
||||
(*structpb.Struct)(nil), // 9: google.protobuf.Struct
|
||||
(*Locality)(nil), // 8: hashicorp.consul.internal.common.Locality
|
||||
(*durationpb.Duration)(nil), // 9: google.protobuf.Duration
|
||||
(*structpb.Struct)(nil), // 10: google.protobuf.Struct
|
||||
}
|
||||
var file_private_pbcommon_common_proto_depIdxs = []int32{
|
||||
8, // 0: hashicorp.consul.internal.common.QueryOptions.MaxQueryTime:type_name -> google.protobuf.Duration
|
||||
8, // 1: hashicorp.consul.internal.common.QueryOptions.MaxStaleDuration:type_name -> google.protobuf.Duration
|
||||
8, // 2: hashicorp.consul.internal.common.QueryOptions.MaxAge:type_name -> google.protobuf.Duration
|
||||
8, // 3: hashicorp.consul.internal.common.QueryOptions.StaleIfError:type_name -> google.protobuf.Duration
|
||||
8, // 4: hashicorp.consul.internal.common.QueryMeta.LastContact:type_name -> google.protobuf.Duration
|
||||
9, // 5: hashicorp.consul.internal.common.EnvoyExtension.Arguments:type_name -> google.protobuf.Struct
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
9, // 0: hashicorp.consul.internal.common.QueryOptions.MaxQueryTime:type_name -> google.protobuf.Duration
|
||||
9, // 1: hashicorp.consul.internal.common.QueryOptions.MaxStaleDuration:type_name -> google.protobuf.Duration
|
||||
9, // 2: hashicorp.consul.internal.common.QueryOptions.MaxAge:type_name -> google.protobuf.Duration
|
||||
9, // 3: hashicorp.consul.internal.common.QueryOptions.StaleIfError:type_name -> google.protobuf.Duration
|
||||
9, // 4: hashicorp.consul.internal.common.QueryMeta.LastContact:type_name -> google.protobuf.Duration
|
||||
10, // 5: hashicorp.consul.internal.common.EnvoyExtension.Arguments:type_name -> google.protobuf.Struct
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_private_pbcommon_common_proto_init() }
|
||||
|
@ -906,6 +973,18 @@ func file_private_pbcommon_common_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_private_pbcommon_common_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Locality); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -913,7 +992,7 @@ func file_private_pbcommon_common_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_private_pbcommon_common_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -183,3 +183,16 @@ message EnvoyExtension {
|
|||
// mog: func-to=ProtobufTypesStructToMapStringInterface func-from=MapStringInterfaceToProtobufTypesStruct
|
||||
google.protobuf.Struct Arguments = 3;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
//
|
||||
// target=github.com/hashicorp/consul/agent/structs.Locality
|
||||
// output=common.gen.go
|
||||
// name=Structs
|
||||
message Locality {
|
||||
// Region is region the zone belongs to.
|
||||
string Region = 1;
|
||||
|
||||
// Zone is the zone the entity is running in.
|
||||
string Zone = 2;
|
||||
}
|
||||
|
|
|
@ -62,20 +62,6 @@ func GenerateTokenResponseFromAPI(t *api.PeeringGenerateTokenResponse, s *Genera
|
|||
}
|
||||
s.PeeringToken = t.PeeringToken
|
||||
}
|
||||
func LocalityToAPI(s *Locality, t *api.Locality) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
t.Region = s.Region
|
||||
t.Zone = s.Zone
|
||||
}
|
||||
func LocalityFromAPI(t *api.Locality, s *Locality) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
s.Region = t.Region
|
||||
s.Zone = t.Zone
|
||||
}
|
||||
func PeeringToAPI(s *Peering, t *api.Peering) {
|
||||
if s == nil {
|
||||
return
|
||||
|
@ -126,9 +112,7 @@ func RemoteInfoToAPI(s *RemoteInfo, t *api.PeeringRemoteInfo) {
|
|||
}
|
||||
t.Partition = s.Partition
|
||||
t.Datacenter = s.Datacenter
|
||||
if s.Locality != nil {
|
||||
LocalityToAPI(s.Locality, &t.Locality)
|
||||
}
|
||||
t.Locality = LocalityToAPI(s.Locality)
|
||||
}
|
||||
func RemoteInfoFromAPI(t *api.PeeringRemoteInfo, s *RemoteInfo) {
|
||||
if s == nil {
|
||||
|
@ -136,9 +120,5 @@ func RemoteInfoFromAPI(t *api.PeeringRemoteInfo, s *RemoteInfo) {
|
|||
}
|
||||
s.Partition = t.Partition
|
||||
s.Datacenter = t.Datacenter
|
||||
{
|
||||
var x Locality
|
||||
LocalityFromAPI(&t.Locality, &x)
|
||||
s.Locality = &x
|
||||
}
|
||||
s.Locality = LocalityFromAPI(t.Locality)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/hashicorp/consul/agent/structs"
|
||||
"github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/lib"
|
||||
"github.com/hashicorp/consul/proto/private/pbcommon"
|
||||
)
|
||||
|
||||
// RequestDatacenter implements structs.RPCInfo
|
||||
|
@ -279,13 +280,6 @@ func (r *RemoteInfo) IsEmpty() bool {
|
|||
return r.Partition == "" && r.Datacenter == "" && r.Locality.IsEmpty()
|
||||
}
|
||||
|
||||
func (l *Locality) IsEmpty() bool {
|
||||
if l == nil {
|
||||
return true
|
||||
}
|
||||
return l.Region == "" && l.Zone == ""
|
||||
}
|
||||
|
||||
// convenience
|
||||
func NewGenerateTokenRequestFromAPI(req *api.PeeringGenerateTokenRequest) *GenerateTokenRequest {
|
||||
if req == nil {
|
||||
|
@ -332,8 +326,49 @@ func (o *PeeringTrustBundle) DeepCopy() *PeeringTrustBundle {
|
|||
return cp
|
||||
}
|
||||
|
||||
func LocalityFromStruct(l structs.Locality) *Locality {
|
||||
return &Locality{
|
||||
// TODO: handle this with mog
|
||||
// LocalityToStructs converts a protobuf Locality to a struct Locality.
|
||||
func LocalityToStructs(l *pbcommon.Locality) *structs.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &structs.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle this with mog
|
||||
// LocalityFromStructs converts a struct Locality to a protobuf Locality.
|
||||
func LocalityFromStructs(l *structs.Locality) *pbcommon.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &pbcommon.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle this with mog
|
||||
// LocalityToAPI converts a protobuf Locality to an API Locality.
|
||||
func LocalityToAPI(l *pbcommon.Locality) *api.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &api.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle this with mog
|
||||
// LocalityFromProto converts an API Locality to a protobuf Locality.
|
||||
func LocalityFromAPI(l *api.Locality) *pbcommon.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &pbcommon.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
|
|
|
@ -107,16 +107,6 @@ func (msg *RemoteInfo) UnmarshalBinary(b []byte) error {
|
|||
return proto.Unmarshal(b, msg)
|
||||
}
|
||||
|
||||
// MarshalBinary implements encoding.BinaryMarshaler
|
||||
func (msg *Locality) MarshalBinary() ([]byte, error) {
|
||||
return proto.Marshal(msg)
|
||||
}
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||
func (msg *Locality) UnmarshalBinary(b []byte) error {
|
||||
return proto.Unmarshal(b, msg)
|
||||
}
|
||||
|
||||
// MarshalBinary implements encoding.BinaryMarshaler
|
||||
func (msg *StreamStatus) MarshalBinary() ([]byte, error) {
|
||||
return proto.Marshal(msg)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@ package hashicorp.consul.internal.peering;
|
|||
|
||||
import "annotations/ratelimit/ratelimit.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "private/pbcommon/common.proto";
|
||||
|
||||
// PeeringService handles operations for establishing peering relationships
|
||||
// between disparate Consul clusters.
|
||||
|
@ -239,20 +240,8 @@ message RemoteInfo {
|
|||
string Datacenter = 2;
|
||||
|
||||
// Locality identifies where the peer is running.
|
||||
Locality Locality = 3;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
//
|
||||
// target=github.com/hashicorp/consul/api.Locality
|
||||
// output=peering.gen.go
|
||||
// name=API
|
||||
message Locality {
|
||||
// Region is region the zone belongs to.
|
||||
string Region = 1;
|
||||
|
||||
// Zone is the zone the entity is running in.
|
||||
string Zone = 2;
|
||||
// mog: func-to=LocalityToAPI func-from=LocalityFromAPI
|
||||
common.Locality Locality = 3;
|
||||
}
|
||||
|
||||
// StreamStatus represents information about an active peering stream.
|
||||
|
|
|
@ -276,3 +276,25 @@ func NewServiceDefinitionPtrFromStructs(t *structs.ServiceDefinition) *ServiceDe
|
|||
ServiceDefinitionFromStructs(t, sd)
|
||||
return sd
|
||||
}
|
||||
|
||||
// TODO: handle this with mog
|
||||
func LocalityToStructs(l *pbcommon.Locality) *structs.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &structs.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle this with mog
|
||||
func LocalityFromStructs(l *structs.Locality) *pbcommon.Locality {
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
return &pbcommon.Locality{
|
||||
Region: l.Region,
|
||||
Zone: l.Zone,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ func NodeToStructs(s *Node, t *structs.Node) {
|
|||
t.PeerName = s.PeerName
|
||||
t.TaggedAddresses = s.TaggedAddresses
|
||||
t.Meta = s.Meta
|
||||
t.Locality = LocalityToStructs(s.Locality)
|
||||
t.RaftIndex = RaftIndexToStructs(s.RaftIndex)
|
||||
}
|
||||
func NodeFromStructs(t *structs.Node, s *Node) {
|
||||
|
@ -30,6 +31,7 @@ func NodeFromStructs(t *structs.Node, s *Node) {
|
|||
s.PeerName = t.PeerName
|
||||
s.TaggedAddresses = t.TaggedAddresses
|
||||
s.Meta = t.Meta
|
||||
s.Locality = LocalityFromStructs(t.Locality)
|
||||
s.RaftIndex = NewRaftIndexFromStructs(t.RaftIndex)
|
||||
}
|
||||
func NodeServiceToStructs(s *NodeService, t *structs.NodeService) {
|
||||
|
@ -47,6 +49,7 @@ func NodeServiceToStructs(s *NodeService, t *structs.NodeService) {
|
|||
t.SocketPath = s.SocketPath
|
||||
t.Weights = WeightsPtrToStructs(s.Weights)
|
||||
t.EnableTagOverride = s.EnableTagOverride
|
||||
t.Locality = LocalityToStructs(s.Locality)
|
||||
if s.Proxy != nil {
|
||||
ConnectProxyConfigToStructs(s.Proxy, &t.Proxy)
|
||||
}
|
||||
|
@ -73,6 +76,7 @@ func NodeServiceFromStructs(t *structs.NodeService, s *NodeService) {
|
|||
s.SocketPath = t.SocketPath
|
||||
s.Weights = NewWeightsPtrFromStructs(t.Weights)
|
||||
s.EnableTagOverride = t.EnableTagOverride
|
||||
s.Locality = LocalityFromStructs(t.Locality)
|
||||
{
|
||||
var x ConnectProxyConfig
|
||||
ConnectProxyConfigFromStructs(&t.Proxy, &x)
|
||||
|
|
|
@ -165,6 +165,9 @@ type Node struct {
|
|||
Meta map[string]string `protobuf:"bytes,6,rep,name=Meta,proto3" json:"Meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
// mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
|
||||
RaftIndex *pbcommon.RaftIndex `protobuf:"bytes,7,opt,name=RaftIndex,proto3" json:"RaftIndex,omitempty"`
|
||||
// Locality identifies where the node is running.
|
||||
// mog: func-to=LocalityToStructs func-from=LocalityFromStructs
|
||||
Locality *pbcommon.Locality `protobuf:"bytes,10,opt,name=Locality,proto3" json:"Locality,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Node) Reset() {
|
||||
|
@ -262,6 +265,13 @@ func (x *Node) GetRaftIndex() *pbcommon.RaftIndex {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *Node) GetLocality() *pbcommon.Locality {
|
||||
if x != nil {
|
||||
return x.Locality
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NodeService is a service provided by a node
|
||||
//
|
||||
// mog annotation:
|
||||
|
@ -329,6 +339,9 @@ type NodeService struct {
|
|||
PeerName string `protobuf:"bytes,18,opt,name=PeerName,proto3" json:"PeerName,omitempty"`
|
||||
// mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
|
||||
RaftIndex *pbcommon.RaftIndex `protobuf:"bytes,14,opt,name=RaftIndex,proto3" json:"RaftIndex,omitempty"`
|
||||
// Locality identifies where the service is running.
|
||||
// mog: func-to=LocalityToStructs func-from=LocalityFromStructs
|
||||
Locality *pbcommon.Locality `protobuf:"bytes,19,opt,name=Locality,proto3" json:"Locality,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeService) Reset() {
|
||||
|
@ -482,6 +495,13 @@ func (x *NodeService) GetRaftIndex() *pbcommon.RaftIndex {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *NodeService) GetLocality() *pbcommon.Locality {
|
||||
if x != nil {
|
||||
return x.Locality
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_private_pbservice_node_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_private_pbservice_node_proto_rawDesc = []byte{
|
||||
|
@ -517,7 +537,7 @@ var file_private_pbservice_node_proto_rawDesc = []byte{
|
|||
0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
||||
0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52,
|
||||
0x06, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x22, 0x95, 0x04, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x06, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x22, 0xdd, 0x04, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f,
|
||||
|
@ -543,70 +563,79 @@ var file_private_pbservice_node_proto_rawDesc = []byte{
|
|||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x61,
|
||||
0x66, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x09, 0x52, 0x61, 0x66, 0x74, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x1a, 0x42, 0x0a, 0x14, 0x54, 0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
|
||||
0xa9, 0x08, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4b,
|
||||
0x69, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x54, 0x61, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x54, 0x61, 0x67,
|
||||
0x73, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x6d, 0x0a, 0x0f, 0x54,
|
||||
0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x0f,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x65, 0x78, 0x12, 0x46, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x0a,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x54, 0x61, 0x67, 0x67, 0x65,
|
||||
0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x04, 0x4d, 0x65,
|
||||
0x74, 0x61, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
|
||||
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x52, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a,
|
||||
0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x44, 0x0a, 0x07,
|
||||
0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
|
||||
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x52, 0x07, 0x57, 0x65, 0x69, 0x67, 0x68,
|
||||
0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x61, 0x67, 0x4f,
|
||||
0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x45,
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x61, 0x67, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65,
|
||||
0x12, 0x4b, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x35, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
||||
0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x78, 0x79,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x4b, 0x0a,
|
||||
0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31,
|
||||
0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
|
||||
0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
0x74, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x3e, 0x0a, 0x1a, 0x4c, 0x6f,
|
||||
0x63, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x41,
|
||||
0x73, 0x53, 0x69, 0x64, 0x65, 0x63, 0x61, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a,
|
||||
0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65,
|
||||
0x64, 0x41, 0x73, 0x53, 0x69, 0x64, 0x65, 0x63, 0x61, 0x72, 0x12, 0x58, 0x0a, 0x0e, 0x45, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x18, 0x10, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x30, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x52, 0x0e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x49, 0x0a, 0x09, 0x52, 0x61, 0x66, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0e, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x61, 0x66, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x52, 0x09, 0x52, 0x61, 0x66, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x75, 0x0a, 0x14, 0x54,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79,
|
||||
0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x1a, 0x42, 0x0a, 0x14, 0x54, 0x61,
|
||||
0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x37,
|
||||
0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf1, 0x08, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49,
|
||||
0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x61, 0x67, 0x73, 0x18, 0x04, 0x20,
|
||||
0x03, 0x28, 0x09, 0x52, 0x04, 0x54, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x12, 0x6d, 0x0a, 0x0f, 0x54, 0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x68,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
||||
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x61, 0x67,
|
||||
0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x52, 0x0f, 0x54, 0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x65, 0x73, 0x12, 0x4c, 0x0a, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x38, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
|
||||
0x50, 0x6f, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61,
|
||||
0x74, 0x68, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74,
|
||||
0x50, 0x61, 0x74, 0x68, 0x12, 0x44, 0x0a, 0x07, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
||||
0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
|
||||
0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74,
|
||||
0x73, 0x52, 0x07, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x45, 0x6e,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x54, 0x61, 0x67, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18,
|
||||
0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x61, 0x67,
|
||||
0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x4b, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78,
|
||||
0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||
0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x6e,
|
||||
0x65, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x05,
|
||||
0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x4b, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
|
||||
0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
|
||||
0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x12, 0x3e, 0x0a, 0x1a, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x67,
|
||||
0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x41, 0x73, 0x53, 0x69, 0x64, 0x65, 0x63, 0x61, 0x72,
|
||||
0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x52,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x41, 0x73, 0x53, 0x69, 0x64, 0x65, 0x63,
|
||||
0x61, 0x72, 0x12, 0x58, 0x0a, 0x0e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x68, 0x61, 0x73,
|
||||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x0e, 0x45, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x50, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x50, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x49, 0x0a, 0x09, 0x52, 0x61, 0x66, 0x74,
|
||||
0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x68, 0x61,
|
||||
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52,
|
||||
0x61, 0x66, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x09, 0x52, 0x61, 0x66, 0x74, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x12, 0x46, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18,
|
||||
0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
||||
0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
|
||||
0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74,
|
||||
0x79, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x1a, 0x75, 0x0a, 0x14, 0x54,
|
||||
0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x47, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
|
||||
|
@ -662,11 +691,12 @@ var file_private_pbservice_node_proto_goTypes = []interface{}{
|
|||
nil, // 7: hashicorp.consul.internal.service.NodeService.MetaEntry
|
||||
(*HealthCheck)(nil), // 8: hashicorp.consul.internal.service.HealthCheck
|
||||
(*pbcommon.RaftIndex)(nil), // 9: hashicorp.consul.internal.common.RaftIndex
|
||||
(*Weights)(nil), // 10: hashicorp.consul.internal.service.Weights
|
||||
(*ConnectProxyConfig)(nil), // 11: hashicorp.consul.internal.service.ConnectProxyConfig
|
||||
(*ServiceConnect)(nil), // 12: hashicorp.consul.internal.service.ServiceConnect
|
||||
(*pbcommon.EnterpriseMeta)(nil), // 13: hashicorp.consul.internal.common.EnterpriseMeta
|
||||
(*ServiceAddress)(nil), // 14: hashicorp.consul.internal.service.ServiceAddress
|
||||
(*pbcommon.Locality)(nil), // 10: hashicorp.consul.internal.common.Locality
|
||||
(*Weights)(nil), // 11: hashicorp.consul.internal.service.Weights
|
||||
(*ConnectProxyConfig)(nil), // 12: hashicorp.consul.internal.service.ConnectProxyConfig
|
||||
(*ServiceConnect)(nil), // 13: hashicorp.consul.internal.service.ServiceConnect
|
||||
(*pbcommon.EnterpriseMeta)(nil), // 14: hashicorp.consul.internal.common.EnterpriseMeta
|
||||
(*ServiceAddress)(nil), // 15: hashicorp.consul.internal.service.ServiceAddress
|
||||
}
|
||||
var file_private_pbservice_node_proto_depIdxs = []int32{
|
||||
1, // 0: hashicorp.consul.internal.service.IndexedCheckServiceNodes.Nodes:type_name -> hashicorp.consul.internal.service.CheckServiceNode
|
||||
|
@ -676,19 +706,21 @@ var file_private_pbservice_node_proto_depIdxs = []int32{
|
|||
4, // 4: hashicorp.consul.internal.service.Node.TaggedAddresses:type_name -> hashicorp.consul.internal.service.Node.TaggedAddressesEntry
|
||||
5, // 5: hashicorp.consul.internal.service.Node.Meta:type_name -> hashicorp.consul.internal.service.Node.MetaEntry
|
||||
9, // 6: hashicorp.consul.internal.service.Node.RaftIndex:type_name -> hashicorp.consul.internal.common.RaftIndex
|
||||
6, // 7: hashicorp.consul.internal.service.NodeService.TaggedAddresses:type_name -> hashicorp.consul.internal.service.NodeService.TaggedAddressesEntry
|
||||
7, // 8: hashicorp.consul.internal.service.NodeService.Meta:type_name -> hashicorp.consul.internal.service.NodeService.MetaEntry
|
||||
10, // 9: hashicorp.consul.internal.service.NodeService.Weights:type_name -> hashicorp.consul.internal.service.Weights
|
||||
11, // 10: hashicorp.consul.internal.service.NodeService.Proxy:type_name -> hashicorp.consul.internal.service.ConnectProxyConfig
|
||||
12, // 11: hashicorp.consul.internal.service.NodeService.Connect:type_name -> hashicorp.consul.internal.service.ServiceConnect
|
||||
13, // 12: hashicorp.consul.internal.service.NodeService.EnterpriseMeta:type_name -> hashicorp.consul.internal.common.EnterpriseMeta
|
||||
9, // 13: hashicorp.consul.internal.service.NodeService.RaftIndex:type_name -> hashicorp.consul.internal.common.RaftIndex
|
||||
14, // 14: hashicorp.consul.internal.service.NodeService.TaggedAddressesEntry.value:type_name -> hashicorp.consul.internal.service.ServiceAddress
|
||||
15, // [15:15] is the sub-list for method output_type
|
||||
15, // [15:15] is the sub-list for method input_type
|
||||
15, // [15:15] is the sub-list for extension type_name
|
||||
15, // [15:15] is the sub-list for extension extendee
|
||||
0, // [0:15] is the sub-list for field type_name
|
||||
10, // 7: hashicorp.consul.internal.service.Node.Locality:type_name -> hashicorp.consul.internal.common.Locality
|
||||
6, // 8: hashicorp.consul.internal.service.NodeService.TaggedAddresses:type_name -> hashicorp.consul.internal.service.NodeService.TaggedAddressesEntry
|
||||
7, // 9: hashicorp.consul.internal.service.NodeService.Meta:type_name -> hashicorp.consul.internal.service.NodeService.MetaEntry
|
||||
11, // 10: hashicorp.consul.internal.service.NodeService.Weights:type_name -> hashicorp.consul.internal.service.Weights
|
||||
12, // 11: hashicorp.consul.internal.service.NodeService.Proxy:type_name -> hashicorp.consul.internal.service.ConnectProxyConfig
|
||||
13, // 12: hashicorp.consul.internal.service.NodeService.Connect:type_name -> hashicorp.consul.internal.service.ServiceConnect
|
||||
14, // 13: hashicorp.consul.internal.service.NodeService.EnterpriseMeta:type_name -> hashicorp.consul.internal.common.EnterpriseMeta
|
||||
9, // 14: hashicorp.consul.internal.service.NodeService.RaftIndex:type_name -> hashicorp.consul.internal.common.RaftIndex
|
||||
10, // 15: hashicorp.consul.internal.service.NodeService.Locality:type_name -> hashicorp.consul.internal.common.Locality
|
||||
15, // 16: hashicorp.consul.internal.service.NodeService.TaggedAddressesEntry.value:type_name -> hashicorp.consul.internal.service.ServiceAddress
|
||||
17, // [17:17] is the sub-list for method output_type
|
||||
17, // [17:17] is the sub-list for method input_type
|
||||
17, // [17:17] is the sub-list for extension type_name
|
||||
17, // [17:17] is the sub-list for extension extendee
|
||||
0, // [0:17] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_private_pbservice_node_proto_init() }
|
||||
|
|
|
@ -41,6 +41,9 @@ message Node {
|
|||
|
||||
// mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
|
||||
common.RaftIndex RaftIndex = 7;
|
||||
// Locality identifies where the node is running.
|
||||
// mog: func-to=LocalityToStructs func-from=LocalityFromStructs
|
||||
common.Locality Locality = 10;
|
||||
}
|
||||
|
||||
// NodeService is a service provided by a node
|
||||
|
@ -114,4 +117,8 @@ message NodeService {
|
|||
|
||||
// mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
|
||||
common.RaftIndex RaftIndex = 14;
|
||||
|
||||
// Locality identifies where the service is running.
|
||||
// mog: func-to=LocalityToStructs func-from=LocalityFromStructs
|
||||
common.Locality Locality = 19;
|
||||
}
|
||||
|
|
|
@ -192,6 +192,7 @@ func ServiceDefinitionToStructs(s *ServiceDefinition, t *structs.ServiceDefiniti
|
|||
t.Weights = WeightsPtrToStructs(s.Weights)
|
||||
t.Token = s.Token
|
||||
t.EnableTagOverride = s.EnableTagOverride
|
||||
t.Locality = LocalityToStructs(s.Locality)
|
||||
t.Proxy = ConnectProxyConfigPtrToStructs(s.Proxy)
|
||||
t.EnterpriseMeta = EnterpriseMetaToStructs(s.EnterpriseMeta)
|
||||
t.Connect = ServiceConnectPtrToStructs(s.Connect)
|
||||
|
@ -218,6 +219,7 @@ func ServiceDefinitionFromStructs(t *structs.ServiceDefinition, s *ServiceDefini
|
|||
s.Weights = NewWeightsPtrFromStructs(t.Weights)
|
||||
s.Token = t.Token
|
||||
s.EnableTagOverride = t.EnableTagOverride
|
||||
s.Locality = LocalityFromStructs(t.Locality)
|
||||
s.Proxy = NewConnectProxyConfigPtrFromStructs(t.Proxy)
|
||||
s.EnterpriseMeta = NewEnterpriseMetaFromStructs(t.EnterpriseMeta)
|
||||
s.Connect = NewServiceConnectPtrFromStructs(t.Connect)
|
||||
|
|
|
@ -953,6 +953,9 @@ type ServiceDefinition struct {
|
|||
EnterpriseMeta *pbcommon.EnterpriseMeta `protobuf:"bytes,17,opt,name=EnterpriseMeta,proto3" json:"EnterpriseMeta,omitempty"`
|
||||
// mog: func-to=ServiceConnectPtrToStructs func-from=NewServiceConnectPtrFromStructs
|
||||
Connect *ServiceConnect `protobuf:"bytes,15,opt,name=Connect,proto3" json:"Connect,omitempty"`
|
||||
// Locality identifies where the service is running.
|
||||
// mog: func-to=LocalityToStructs func-from=LocalityFromStructs
|
||||
Locality *pbcommon.Locality `protobuf:"bytes,19,opt,name=Locality,proto3" json:"Locality,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ServiceDefinition) Reset() {
|
||||
|
@ -1106,6 +1109,13 @@ func (x *ServiceDefinition) GetConnect() *ServiceConnect {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *ServiceDefinition) GetLocality() *pbcommon.Locality {
|
||||
if x != nil {
|
||||
return x.Locality
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Type to hold an address and port of a service
|
||||
type ServiceAddress struct {
|
||||
state protoimpl.MessageState
|
||||
|
@ -1389,7 +1399,7 @@ var file_private_pbservice_service_proto_rawDesc = []byte{
|
|||
0x72, 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4a, 0x53, 0x4f, 0x4e,
|
||||
0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x65, 0x78, 0x74, 0x46, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x54, 0x65, 0x78, 0x74,
|
||||
0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0xae, 0x08, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0xf6, 0x08, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4b, 0x69, 0x6e, 0x64,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44,
|
||||
|
@ -1445,44 +1455,48 @@ var file_private_pbservice_service_proto_rawDesc = []byte{
|
|||
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x07,
|
||||
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x1a, 0x75, 0x0a, 0x14, 0x54, 0x61, 0x67, 0x67, 0x65,
|
||||
0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x12, 0x47, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x31, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x37,
|
||||
0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3e, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x3d, 0x0a, 0x07, 0x57, 0x65, 0x69, 0x67, 0x68,
|
||||
0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x07, 0x50, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x57,
|
||||
0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x92, 0x02, 0x0a, 0x25, 0x63, 0x6f, 0x6d, 0x2e, 0x68,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
||||
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x33, 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, 0x2f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x62, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x04, 0x48, 0x43, 0x49, 0x53, 0xaa, 0x02, 0x21, 0x48,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
||||
0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0xca, 0x02, 0x21, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5c, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x2d, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x24, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x46, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c,
|
||||
0x69, 0x74, 0x79, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68,
|
||||
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x63,
|
||||
0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x1a,
|
||||
0x75, 0x0a, 0x14, 0x54, 0x61, 0x67, 0x67, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x47, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
|
||||
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
|
||||
0x3e, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x50,
|
||||
0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x22,
|
||||
0x3d, 0x0a, 0x07, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61,
|
||||
0x73, 0x73, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x50, 0x61, 0x73,
|
||||
0x73, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x92,
|
||||
0x02, 0x0a, 0x25, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 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, 0x2f, 0x70, 0x72, 0x69, 0x76,
|
||||
0x61, 0x74, 0x65, 0x2f, 0x70, 0x62, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x04,
|
||||
0x48, 0x43, 0x49, 0x53, 0xaa, 0x02, 0x21, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x21, 0x48, 0x61, 0x73, 0x68, 0x69,
|
||||
0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x49, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x2d, 0x48,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c,
|
||||
0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x24, 0x48,
|
||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x3a, 0x3a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1517,6 +1531,7 @@ var file_private_pbservice_service_proto_goTypes = []interface{}{
|
|||
(*pbcommon.EnvoyExtension)(nil), // 15: hashicorp.consul.internal.common.EnvoyExtension
|
||||
(*CheckType)(nil), // 16: hashicorp.consul.internal.service.CheckType
|
||||
(*pbcommon.EnterpriseMeta)(nil), // 17: hashicorp.consul.internal.common.EnterpriseMeta
|
||||
(*pbcommon.Locality)(nil), // 18: hashicorp.consul.internal.common.Locality
|
||||
}
|
||||
var file_private_pbservice_service_proto_depIdxs = []int32{
|
||||
14, // 0: hashicorp.consul.internal.service.ConnectProxyConfig.Config:type_name -> google.protobuf.Struct
|
||||
|
@ -1539,12 +1554,13 @@ var file_private_pbservice_service_proto_depIdxs = []int32{
|
|||
0, // 17: hashicorp.consul.internal.service.ServiceDefinition.Proxy:type_name -> hashicorp.consul.internal.service.ConnectProxyConfig
|
||||
17, // 18: hashicorp.consul.internal.service.ServiceDefinition.EnterpriseMeta:type_name -> hashicorp.consul.internal.common.EnterpriseMeta
|
||||
2, // 19: hashicorp.consul.internal.service.ServiceDefinition.Connect:type_name -> hashicorp.consul.internal.service.ServiceConnect
|
||||
10, // 20: hashicorp.consul.internal.service.ServiceDefinition.TaggedAddressesEntry.value:type_name -> hashicorp.consul.internal.service.ServiceAddress
|
||||
21, // [21:21] is the sub-list for method output_type
|
||||
21, // [21:21] is the sub-list for method input_type
|
||||
21, // [21:21] is the sub-list for extension type_name
|
||||
21, // [21:21] is the sub-list for extension extendee
|
||||
0, // [0:21] is the sub-list for field type_name
|
||||
18, // 20: hashicorp.consul.internal.service.ServiceDefinition.Locality:type_name -> hashicorp.consul.internal.common.Locality
|
||||
10, // 21: hashicorp.consul.internal.service.ServiceDefinition.TaggedAddressesEntry.value:type_name -> hashicorp.consul.internal.service.ServiceAddress
|
||||
22, // [22:22] is the sub-list for method output_type
|
||||
22, // [22:22] is the sub-list for method input_type
|
||||
22, // [22:22] is the sub-list for extension type_name
|
||||
22, // [22:22] is the sub-list for extension extendee
|
||||
0, // [0:22] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_private_pbservice_service_proto_init() }
|
||||
|
|
|
@ -307,6 +307,10 @@ message ServiceDefinition {
|
|||
|
||||
// mog: func-to=ServiceConnectPtrToStructs func-from=NewServiceConnectPtrFromStructs
|
||||
ServiceConnect Connect = 15;
|
||||
|
||||
// Locality identifies where the service is running.
|
||||
// mog: func-to=LocalityToStructs func-from=LocalityFromStructs
|
||||
common.Locality Locality = 19;
|
||||
}
|
||||
|
||||
// Type to hold an address and port of a service
|
||||
|
|
|
@ -72,11 +72,18 @@ type TestNetworkSegment struct {
|
|||
Advertise string `json:"advertise"`
|
||||
}
|
||||
|
||||
// Locality is used as the TestServerConfig's Locality.
|
||||
type Locality struct {
|
||||
Region string `json:"region"`
|
||||
Zone string `json:"zone"`
|
||||
}
|
||||
|
||||
// TestServerConfig is the main server configuration struct.
|
||||
type TestServerConfig struct {
|
||||
NodeName string `json:"node_name"`
|
||||
NodeID string `json:"node_id"`
|
||||
NodeMeta map[string]string `json:"node_meta,omitempty"`
|
||||
NodeLocality *Locality `json:"locality,omitempty"`
|
||||
Performance *TestPerformanceConfig `json:"performance,omitempty"`
|
||||
Bootstrap bool `json:"bootstrap,omitempty"`
|
||||
Server bool `json:"server,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue