1syntax = "proto3";
2
3package pbservice;
4
5option go_package = "github.com/hashicorp/consul/proto/pbservice";
6
7import "proto/pbcommon/common.proto";
8import "proto/pbservice/healthcheck.proto";
9import "proto/pbservice/service.proto";
10
11// This fake import path is replaced by the build script with a versioned path
12import "gogoproto/gogo.proto";
13
14option (gogoproto.goproto_unkeyed_all) = false;
15option (gogoproto.goproto_unrecognized_all) = false;
16option (gogoproto.goproto_getters_all) = false;
17option (gogoproto.goproto_sizecache_all) = false;
18
19// CheckServiceNode is used to provide the node, its service
20// definition, as well as a HealthCheck that is associated.
21message CheckServiceNode {
22  Node Node = 1;
23  NodeService Service = 2;
24  repeated HealthCheck Checks = 3;
25}
26
27// Node contains information about a node.
28//
29// mog annotation:
30//
31// target=github.com/hashicorp/consul/agent/structs.Node
32// output=node.gen.go
33// name=Structs
34message Node {
35  string ID = 1 [(gogoproto.casttype) = "github.com/hashicorp/consul/types.NodeID"];
36
37  string Node = 2;
38  string Address = 3;
39  string Datacenter = 4;
40  map<string, string> TaggedAddresses = 5;
41  map<string, string> Meta = 6;
42
43  // mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
44  common.RaftIndex RaftIndex = 7 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
45}
46
47// NodeService is a service provided by a node
48//
49// mog annotation:
50//
51// target=github.com/hashicorp/consul/agent/structs.NodeService
52// output=node.gen.go
53// name=Structs
54message NodeService {
55  // Kind is the kind of service this is. Different kinds of services may
56  // have differing validation, DNS behavior, etc. An empty kind will default
57  // to the Default kind. See ServiceKind for the full list of kinds.
58  string Kind = 1 [(gogoproto.casttype) = "github.com/hashicorp/consul/agent/structs.ServiceKind"];
59
60  string ID = 2;
61  string Service = 3;
62  repeated string Tags = 4;
63  string Address = 5;
64  // mog: func-to=MapStringServiceAddressToStructs func-from=NewMapStringServiceAddressFromStructs
65  map<string, ServiceAddress> TaggedAddresses = 15 [(gogoproto.nullable) = false];
66  map<string, string> Meta = 6;
67  // mog: func-to=int func-from=int32
68  int32 Port = 7;
69  string SocketPath = 17;
70
71  // mog: func-to=WeightsPtrToStructs func-from=NewWeightsPtrFromStructs
72  Weights Weights = 8;
73  bool EnableTagOverride = 9;
74
75  // Proxy is the configuration set for Kind = connect-proxy. It is mandatory in
76  // that case and an error to be set for any other kind. This config is part of
77  // a proxy service definition and is distinct from but shares some fields with
78  // the Connect.Proxy which configures a managed proxy as part of the actual
79  // service's definition. This duplication is ugly but seemed better than the
80  // alternative which was to re-use the same struct fields for both cases even
81  // though the semantics are different and the non-shred fields make no sense
82  // in the other case. ProxyConfig may be a more natural name here, but it's
83  // confusing for the UX because one of the fields in ConnectProxyConfig is
84  // also called just "Config"
85  ConnectProxyConfig Proxy = 11 [(gogoproto.nullable) = false];
86
87  // Connect are the Connect settings for a service. This is purposely NOT
88  // a pointer so that we never have to nil-check this.
89  ServiceConnect Connect = 12 [(gogoproto.nullable) = false];
90
91  // LocallyRegisteredAsSidecar is private as it is only used by a local agent
92  // state to track if the service was registered from a nested sidecar_service
93  // block. We need to track that so we can know whether we need to deregister
94  // it automatically too if it's removed from the service definition or if the
95  // parent service is deregistered. Relying only on ID would cause us to
96  // deregister regular services if they happen to be registered using the same
97  // ID scheme as our sidecars do by default. We could use meta but that gets
98  // unpleasant because we can't use the consul- prefix from an agent (reserved
99  // for use internally but in practice that means within the state store or in
100  // responses only), and it leaks the detail publicly which people might rely
101  // on which is a bit unpleasant for something that is meant to be config-file
102  // syntax sugar. Note this is not translated to ServiceNode and friends and
103  // may not be set on a NodeService that isn't the one the agent registered and
104  // keeps in it's local state. We never want this rendered in JSON as it's
105  // internal only. Right now our agent endpoints return api structs which don't
106  // include it but this is a safety net incase we change that or there is
107  // somewhere this is used in API output.
108  bool LocallyRegisteredAsSidecar = 13;
109
110  // mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs
111  common.EnterpriseMeta EnterpriseMeta = 16 [(gogoproto.nullable) = false];
112
113  // mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
114  common.RaftIndex RaftIndex = 14 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
115}
116