diff --git a/agent/agent_endpoint_test.go b/agent/agent_endpoint_test.go index 95a829de29..6450f7acda 100644 --- a/agent/agent_endpoint_test.go +++ b/agent/agent_endpoint_test.go @@ -635,7 +635,7 @@ func TestAgent_Service(t *testing.T) { req, _ := http.NewRequest("GET", tt.url, nil) // Inject the root token for tests that don't care about ACL - var token = "root" + token := "root" if tt.tokenRules != "" { // Create new token and use that. token = testCreateToken(t, a, tt.tokenRules) @@ -2131,7 +2131,6 @@ func TestAgent_ForceLeave(t *testing.T) { r.Fatalf("got status %q want %q", got, want) } }) - } func TestOpenMetricsMimeTypeHeaders(t *testing.T) { @@ -2185,7 +2184,7 @@ func TestAgent_ForceLeave_ACLDeny(t *testing.T) { t.Run("operator write token", func(t *testing.T) { // Create an ACL with operator read permissions. - var rules = ` + rules := ` operator = "write" ` opToken := testCreateToken(t, a, rules) @@ -2226,7 +2225,6 @@ func TestAgent_ForceLeavePrune(t *testing.T) { if member.Status != serf.StatusFailed { r.Fatalf("got status %q want %q", member.Status, serf.StatusFailed) } - } } }) @@ -2246,7 +2244,6 @@ func TestAgent_ForceLeavePrune(t *testing.T) { r.Fatalf("want one member, got %v", m) } }) - } func TestAgent_RegisterCheck(t *testing.T) { @@ -2646,7 +2643,6 @@ func TestAgent_RegisterCheck_ACLDeny(t *testing.T) { require.NoError(r, err) }) }) - } func TestAgent_DeregisterCheck(t *testing.T) { @@ -3335,6 +3331,7 @@ func testAgent_RegisterService_TranslateKeys(t *testing.T, extraHCL string) { { "destination_type": "service", "destination_namespace": "default", + "destination_partition": "default", "destination_name": "db", "local_bind_address": "` + tt.ip + `", "local_bind_port": 1234, @@ -3363,6 +3360,7 @@ func testAgent_RegisterService_TranslateKeys(t *testing.T, extraHCL string) { { "destination_type": "service", "destination_namespace": "default", + "destination_partition": "default", "destination_name": "db", "local_bind_address": "` + tt.ip + `", "local_bind_port": 1234, @@ -3420,6 +3418,7 @@ func testAgent_RegisterService_TranslateKeys(t *testing.T, extraHCL string) { DestinationType: structs.UpstreamDestTypeService, DestinationName: "db", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindAddress: tt.ip, LocalBindPort: 1234, Config: map[string]interface{}{ @@ -3463,6 +3462,7 @@ func testAgent_RegisterService_TranslateKeys(t *testing.T, extraHCL string) { DestinationType: structs.UpstreamDestTypeService, DestinationName: "db", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindAddress: tt.ip, LocalBindPort: 1234, Config: map[string]interface{}{ @@ -3662,6 +3662,10 @@ func testAgent_RegisterService_UnmanagedConnectProxy(t *testing.T, extraHCL stri args.Proxy.Upstreams[i].DestinationNamespace = structs.DefaultEnterpriseMetaInDefaultPartition().NamespaceOrEmpty() } + if args.Proxy.Upstreams[i].DestinationPartition == "" { + args.Proxy.Upstreams[i].DestinationPartition = + structs.DefaultEnterpriseMetaInDefaultPartition().PartitionOrEmpty() + } } require.Equal(t, args.Proxy, svc.Proxy.ToAPI()) diff --git a/agent/config/builder.go b/agent/config/builder.go index daae2c2f06..4b9fabad59 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -366,7 +366,7 @@ func (b *builder) build() (rt RuntimeConfig, err error) { // process/merge some complex values // - var dnsServiceTTL = map[string]time.Duration{} + dnsServiceTTL := map[string]time.Duration{} for k, v := range c.DNS.ServiceTTL { dnsServiceTTL[k] = b.durationVal(fmt.Sprintf("dns_config.service_ttl[%q]", k), &v) } @@ -1181,10 +1181,9 @@ func validateBasicName(field, value string, allowEmpty bool) error { // validate performs semantic validation of the runtime configuration. func (b *builder) validate(rt RuntimeConfig) error { - // validContentPath defines a regexp for a valid content path name. - var validContentPath = regexp.MustCompile(`^[A-Za-z0-9/_-]+$`) - var hasVersion = regexp.MustCompile(`^/v\d+/$`) + validContentPath := regexp.MustCompile(`^[A-Za-z0-9/_-]+$`) + hasVersion := regexp.MustCompile(`^/v\d+/$`) // ---------------------------------------------------------------- // check required params we cannot recover from first // @@ -1651,7 +1650,6 @@ func (b *builder) serviceVal(v *ServiceDefinition) *structs.ServiceDefinition { b.err = multierror.Append( fmt.Errorf("service %s cannot have both socket path %s and address/port", stringVal(v.Name), stringVal(v.SocketPath)), b.err) - } return &structs.ServiceDefinition{ @@ -1718,6 +1716,7 @@ func (b *builder) upstreamsVal(v []Upstream) structs.Upstreams { ups[i] = structs.Upstream{ DestinationType: stringVal(u.DestinationType), DestinationNamespace: stringVal(u.DestinationNamespace), + DestinationPartition: stringVal(u.DestinationPartition), DestinationName: stringVal(u.DestinationName), Datacenter: stringVal(u.Datacenter), LocalBindAddress: stringVal(u.LocalBindAddress), @@ -2369,7 +2368,6 @@ func validateAutoConfigAuthorizer(rt RuntimeConfig) error { // build out the validator to ensure that the given configuration was valid null := hclog.NewNullLogger() validator, err := ssoauth.NewValidator(null, &authz.AuthMethod) - if err != nil { return fmt.Errorf("auto_config.authorization.static has invalid configuration: %v", err) } diff --git a/agent/config/config.go b/agent/config/config.go index 60b7dbbf64..e20bf1580f 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -511,6 +511,7 @@ type Upstream struct { // on service definitions in various places. DestinationType *string `mapstructure:"destination_type"` DestinationNamespace *string `mapstructure:"destination_namespace"` + DestinationPartition *string `mapstructure:"destination_partition"` DestinationName *string `mapstructure:"destination_name"` // Datacenter that the service discovery request should be run against. Note diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index 829b653d69..636a520f43 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -5656,6 +5656,7 @@ func TestLoad_FullConfig(t *testing.T) { { DestinationType: "service", // Default should be explicitly filled DestinationName: "KPtAj2cb", + DestinationPartition: defaultEntMeta.PartitionOrEmpty(), DestinationNamespace: defaultEntMeta.NamespaceOrEmpty(), LocalBindPort: 4051, Config: map[string]interface{}{ @@ -5665,6 +5666,7 @@ func TestLoad_FullConfig(t *testing.T) { { DestinationType: "prepared_query", DestinationNamespace: "9nakw0td", + DestinationPartition: "part-9nakw0td", DestinationName: "KSd8HsRl", LocalBindPort: 11884, LocalBindAddress: "127.24.88.0", @@ -5672,6 +5674,7 @@ func TestLoad_FullConfig(t *testing.T) { { DestinationType: "prepared_query", DestinationNamespace: "9nakw0td", + DestinationPartition: "part-9nakw0td", DestinationName: "placeholder", LocalBindSocketPath: "/foo/bar/upstream", LocalBindSocketMode: "0600", diff --git a/agent/config/testdata/full-config.hcl b/agent/config/testdata/full-config.hcl index 0f113d59ae..2f387ee499 100644 --- a/agent/config/testdata/full-config.hcl +++ b/agent/config/testdata/full-config.hcl @@ -576,6 +576,7 @@ services = [ { destination_type = "prepared_query" destination_namespace = "9nakw0td" + destination_partition = "part-9nakw0td" destination_name = "KSd8HsRl" local_bind_port = 11884 local_bind_address = "127.24.88.0" @@ -583,6 +584,7 @@ services = [ { destination_type = "prepared_query" destination_namespace = "9nakw0td" + destination_partition = "part-9nakw0td" destination_name = "placeholder" local_bind_socket_path = "/foo/bar/upstream" local_bind_socket_mode = "0600" diff --git a/agent/config/testdata/full-config.json b/agent/config/testdata/full-config.json index 2392eb8ebb..70369860fe 100644 --- a/agent/config/testdata/full-config.json +++ b/agent/config/testdata/full-config.json @@ -589,6 +589,7 @@ { "destination_name": "KSd8HsRl", "destination_namespace": "9nakw0td", + "destination_partition": "part-9nakw0td", "destination_type": "prepared_query", "local_bind_address": "127.24.88.0", "local_bind_port": 11884 @@ -596,6 +597,7 @@ { "destination_name": "placeholder", "destination_namespace": "9nakw0td", + "destination_partition": "part-9nakw0td", "destination_type": "prepared_query", "local_bind_socket_path": "/foo/bar/upstream", "local_bind_socket_mode": "0600" diff --git a/agent/consul/discovery_chain_endpoint.go b/agent/consul/discovery_chain_endpoint.go index 3db3045354..7cd8e39425 100644 --- a/agent/consul/discovery_chain_endpoint.go +++ b/agent/consul/discovery_chain_endpoint.go @@ -55,6 +55,7 @@ func (c *DiscoveryChain) Get(args *structs.DiscoveryChainRequest, reply *structs req := discoverychain.CompileRequest{ ServiceName: args.Name, EvaluateInNamespace: entMeta.NamespaceOrDefault(), + EvaluateInPartition: entMeta.PartitionOrDefault(), EvaluateInDatacenter: evalDC, UseInDatacenter: c.srv.config.Datacenter, OverrideMeshGateway: args.OverrideMeshGateway, diff --git a/agent/consul/discoverychain/compile.go b/agent/consul/discoverychain/compile.go index 22afea41c7..4df4447212 100644 --- a/agent/consul/discoverychain/compile.go +++ b/agent/consul/discoverychain/compile.go @@ -15,6 +15,7 @@ import ( type CompileRequest struct { ServiceName string EvaluateInNamespace string + EvaluateInPartition string EvaluateInDatacenter string EvaluateInTrustDomain string UseInDatacenter string // where the results will be used from @@ -906,11 +907,9 @@ RESOLVE_AGAIN: // TODO (mesh-gateway)- maybe allow using a gateway within a datacenter at some point if target.Datacenter == c.useInDatacenter { target.MeshGateway.Mode = structs.MeshGatewayModeDefault - } else if target.External { // Bypass mesh gateways if it is an external service. target.MeshGateway.Mode = structs.MeshGatewayModeDefault - } else { // Default mesh gateway settings if serviceDefault := c.entries.GetService(targetID); serviceDefault != nil { diff --git a/agent/proxycfg/connect_proxy.go b/agent/proxycfg/connect_proxy.go index b69a4f720f..d20e7ad7ff 100644 --- a/agent/proxycfg/connect_proxy.go +++ b/agent/proxycfg/connect_proxy.go @@ -162,6 +162,7 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e case structs.UpstreamDestTypeService: fallthrough + // TODO (partition): pass Partition to DiscoveryChainRequest? case "": // Treat unset as the default Service type err = s.cache.Notify(ctx, cachetype.CompiledDiscoveryChainName, &structs.DiscoveryChainRequest{ Datacenter: s.source.Datacenter, diff --git a/agent/proxycfg/ingress_gateway.go b/agent/proxycfg/ingress_gateway.go index d8cbeac926..14fc0b638a 100644 --- a/agent/proxycfg/ingress_gateway.go +++ b/agent/proxycfg/ingress_gateway.go @@ -103,6 +103,7 @@ func (s *handlerIngressGateway) handleUpdate(ctx context.Context, u cache.Update id: u.Identifier(), name: u.DestinationName, namespace: u.DestinationNamespace, + partition: u.DestinationPartition, datacenter: s.source.Datacenter, } up := &handlerUpstreams{handlerState: s.handlerState} @@ -146,6 +147,7 @@ func makeUpstream(g *structs.GatewayService) structs.Upstream { upstream := structs.Upstream{ DestinationName: g.Service.Name, DestinationNamespace: g.Service.NamespaceOrDefault(), + DestinationPartition: g.Gateway.PartitionOrDefault(), LocalBindPort: g.Port, IngressHosts: g.Hosts, // Pass the protocol that was configured on the ingress listener in order diff --git a/agent/proxycfg/state_test.go b/agent/proxycfg/state_test.go index 45e4040fb6..55186ac07f 100644 --- a/agent/proxycfg/state_test.go +++ b/agent/proxycfg/state_test.go @@ -969,6 +969,7 @@ func TestState_WatchesAndUpdates(t *testing.T) { require.Equal(t, snap.IngressGateway.Upstreams[key], structs.Upstreams{ { DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "api", LocalBindPort: 9999, Config: map[string]interface{}{ diff --git a/agent/proxycfg/upstreams.go b/agent/proxycfg/upstreams.go index 310290c25e..feb6a0d1bb 100644 --- a/agent/proxycfg/upstreams.go +++ b/agent/proxycfg/upstreams.go @@ -345,6 +345,7 @@ type discoveryChainWatchOpts struct { id string name string namespace string + partition string datacenter string cfg reducedUpstreamConfig meshGateway structs.MeshGatewayConfig diff --git a/agent/service_manager.go b/agent/service_manager.go index 7223e98ac3..29c538e88e 100644 --- a/agent/service_manager.go +++ b/agent/service_manager.go @@ -398,6 +398,7 @@ func mergeServiceConfig(defaults *structs.ServiceConfigResponse, service *struct remoteUpstreams[us.Upstream] = structs.Upstream{ DestinationNamespace: us.Upstream.NamespaceOrDefault(), + DestinationPartition: us.Upstream.PartitionOrDefault(), DestinationName: us.Upstream.ID, Config: us.Config, MeshGateway: parsed.MeshGateway, diff --git a/agent/service_manager_test.go b/agent/service_manager_test.go index 14ead2a8ab..e630acf136 100644 --- a/agent/service_manager_test.go +++ b/agent/service_manager_test.go @@ -117,6 +117,7 @@ func TestServiceManager_RegisterSidecar(t *testing.T) { { DestinationName: "redis", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindPort: 5000, }, }, @@ -147,6 +148,7 @@ func TestServiceManager_RegisterSidecar(t *testing.T) { { DestinationName: "redis", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindPort: 5000, Config: map[string]interface{}{ "protocol": "tcp", @@ -348,6 +350,7 @@ func TestServiceManager_PersistService_API(t *testing.T) { { DestinationName: "redis", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindPort: 5000, }, }, @@ -375,6 +378,7 @@ func TestServiceManager_PersistService_API(t *testing.T) { { DestinationName: "redis", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindPort: 5000, Config: map[string]interface{}{ "protocol": "tcp", @@ -567,6 +571,7 @@ func TestServiceManager_PersistService_ConfigFiles(t *testing.T) { upstreams = [{ destination_name = "redis" destination_namespace = "default" + destination_partition = "default" local_bind_port = 5000 }] } @@ -612,6 +617,7 @@ func TestServiceManager_PersistService_ConfigFiles(t *testing.T) { DestinationType: "service", DestinationName: "redis", DestinationNamespace: "default", + DestinationPartition: "default", LocalBindPort: 5000, Config: map[string]interface{}{ "protocol": "tcp", @@ -909,6 +915,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", }, }, @@ -924,6 +931,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", Config: map[string]interface{}{ "passive_health_check": map[string]interface{}{ @@ -970,6 +978,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zip", LocalBindPort: 8080, Config: map[string]interface{}{ @@ -994,6 +1003,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zip", LocalBindPort: 8080, Config: map[string]interface{}{ @@ -1002,6 +1012,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { }, structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", Config: map[string]interface{}{ "protocol": "grpc", @@ -1038,6 +1049,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zip", LocalBindPort: 8080, Config: map[string]interface{}{ @@ -1058,6 +1070,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zip", LocalBindPort: 8080, Config: map[string]interface{}{ @@ -1098,6 +1111,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", }, }, @@ -1116,6 +1130,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", Config: map[string]interface{}{}, MeshGateway: structs.MeshGatewayConfig{ @@ -1156,6 +1171,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", MeshGateway: structs.MeshGatewayConfig{ Mode: structs.MeshGatewayModeNone, @@ -1177,6 +1193,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) { Upstreams: structs.Upstreams{ structs.Upstream{ DestinationNamespace: "default", + DestinationPartition: "default", DestinationName: "zap", Config: map[string]interface{}{}, MeshGateway: structs.MeshGatewayConfig{ diff --git a/agent/structs/config_entry_discoverychain.go b/agent/structs/config_entry_discoverychain.go index 7681032354..77171edcc3 100644 --- a/agent/structs/config_entry_discoverychain.go +++ b/agent/structs/config_entry_discoverychain.go @@ -1343,6 +1343,7 @@ type DiscoveryChainRequest struct { Name string EvaluateInDatacenter string EvaluateInNamespace string + EvaluateInPartition string // NOTE: Partition is not represented here by design. Do not add it. @@ -1386,6 +1387,7 @@ func (r *DiscoveryChainRequest) CacheInfo() cache.RequestInfo { Name string EvaluateInDatacenter string EvaluateInNamespace string + EvaluateInPartition string OverrideMeshGateway MeshGatewayConfig OverrideProtocol string OverrideConnectTimeout time.Duration @@ -1394,6 +1396,7 @@ func (r *DiscoveryChainRequest) CacheInfo() cache.RequestInfo { Name: r.Name, EvaluateInDatacenter: r.EvaluateInDatacenter, EvaluateInNamespace: r.EvaluateInNamespace, + EvaluateInPartition: r.EvaluateInPartition, OverrideMeshGateway: r.OverrideMeshGateway, OverrideProtocol: r.OverrideProtocol, OverrideConnectTimeout: r.OverrideConnectTimeout, diff --git a/agent/structs/connect_proxy_config.go b/agent/structs/connect_proxy_config.go index f3d7cc0536..d8ad467977 100644 --- a/agent/structs/connect_proxy_config.go +++ b/agent/structs/connect_proxy_config.go @@ -246,7 +246,6 @@ func (t *ConnectProxyConfig) UnmarshalJSON(data []byte) (err error) { } return nil - } func (c *ConnectProxyConfig) MarshalJSON() ([]byte, error) { @@ -343,6 +342,7 @@ type Upstream struct { // on service definitions in various places. DestinationType string `alias:"destination_type"` DestinationNamespace string `json:",omitempty" alias:"destination_namespace"` + DestinationPartition string `json:",omitempty" alias:"destination_partition"` DestinationName string `alias:"destination_name"` // Datacenter that the service discovery request should be run against. Note @@ -385,6 +385,7 @@ func (t *Upstream) UnmarshalJSON(data []byte) (err error) { type Alias Upstream aux := &struct { DestinationTypeSnake string `json:"destination_type"` + DestinationPartitionSnake string `json:"destination_partition"` DestinationNamespaceSnake string `json:"destination_namespace"` DestinationNameSnake string `json:"destination_name"` @@ -409,6 +410,9 @@ func (t *Upstream) UnmarshalJSON(data []byte) (err error) { if t.DestinationNamespace == "" { t.DestinationNamespace = aux.DestinationNamespaceSnake } + if t.DestinationPartition == "" { + t.DestinationPartition = aux.DestinationPartitionSnake + } if t.DestinationName == "" { t.DestinationName = aux.DestinationNameSnake } @@ -465,6 +469,7 @@ func (u *Upstream) ToAPI() api.Upstream { return api.Upstream{ DestinationType: api.UpstreamDestType(u.DestinationType), DestinationNamespace: u.DestinationNamespace, + DestinationPartition: u.DestinationPartition, DestinationName: u.DestinationName, Datacenter: u.Datacenter, LocalBindAddress: u.LocalBindAddress, @@ -485,6 +490,7 @@ func (u *Upstream) ToAPI() api.Upstream { func (u *Upstream) ToKey() UpstreamKey { return UpstreamKey{ DestinationType: u.DestinationType, + DestinationPartition: u.DestinationPartition, DestinationNamespace: u.DestinationNamespace, DestinationName: u.DestinationName, Datacenter: u.Datacenter, @@ -514,15 +520,17 @@ func (u Upstream) UpstreamAddressToString() string { type UpstreamKey struct { DestinationType string DestinationName string + DestinationPartition string DestinationNamespace string Datacenter string } func (k UpstreamKey) String() string { return fmt.Sprintf( - "[type=%q, name=%q, namespace=%q, datacenter=%q]", + "[type=%q, name=%q, partition=%q, namespace=%q, datacenter=%q]", k.DestinationType, k.DestinationName, + k.DestinationPartition, k.DestinationNamespace, k.Datacenter, ) @@ -537,6 +545,7 @@ func (u *Upstream) String() string { func UpstreamFromAPI(u api.Upstream) Upstream { return Upstream{ DestinationType: string(u.DestinationType), + DestinationPartition: u.DestinationPartition, DestinationNamespace: u.DestinationNamespace, DestinationName: u.DestinationName, Datacenter: u.Datacenter, diff --git a/agent/structs/service_definition.go b/agent/structs/service_definition.go index 07a769d9ce..d6e2aaa75c 100644 --- a/agent/structs/service_definition.go +++ b/agent/structs/service_definition.go @@ -91,6 +91,9 @@ func (s *ServiceDefinition) NodeService() *NodeService { if ns.Proxy.Upstreams[i].DestinationNamespace == "" { ns.Proxy.Upstreams[i].DestinationNamespace = ns.EnterpriseMeta.NamespaceOrEmpty() } + if ns.Proxy.Upstreams[i].DestinationPartition == "" { + ns.Proxy.Upstreams[i].DestinationPartition = ns.EnterpriseMeta.PartitionOrEmpty() + } } ns.Proxy.Expose = s.Proxy.Expose } diff --git a/agent/structs/structs_filtering_test.go b/agent/structs/structs_filtering_test.go index 10a9ab1a72..6dc886e38a 100644 --- a/agent/structs/structs_filtering_test.go +++ b/agent/structs/structs_filtering_test.go @@ -161,6 +161,11 @@ var expectedFieldConfigUpstreams bexpr.FieldConfigurations = bexpr.FieldConfigur CoerceFn: bexpr.CoerceString, SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches}, }, + "DestinationPartition": &bexpr.FieldConfiguration{ + StructFieldName: "DestinationPartition", + CoerceFn: bexpr.CoerceString, + SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches}, + }, "DestinationName": &bexpr.FieldConfiguration{ StructFieldName: "DestinationName", CoerceFn: bexpr.CoerceString, diff --git a/agent/structs/testing_connect_proxy_config.go b/agent/structs/testing_connect_proxy_config.go index 527ffea58f..12124ba9af 100644 --- a/agent/structs/testing_connect_proxy_config.go +++ b/agent/structs/testing_connect_proxy_config.go @@ -55,6 +55,9 @@ func TestAddDefaultsToUpstreams(t testing.T, upstreams []Upstream, entMeta Enter if ups[i].DestinationNamespace == "" { ups[i].DestinationNamespace = entMeta.NamespaceOrEmpty() } + if ups[i].DestinationPartition == "" { + ups[i].DestinationPartition = entMeta.PartitionOrEmpty() + } } return ups } diff --git a/agent/xds/clusters.go b/agent/xds/clusters.go index c07b275c00..1df48173a4 100644 --- a/agent/xds/clusters.go +++ b/agent/xds/clusters.go @@ -537,11 +537,10 @@ func (s *ResourceGenerator) makeUpstreamClusterForPreparedQuery(upstream structs spiffeID := connect.SpiffeIDService{ Host: cfgSnap.Roots.TrustDomain, + Partition: upstream.DestinationPartition, Namespace: upstream.DestinationNamespace, Datacenter: dc, Service: upstream.DestinationName, - - // TODO(partitions) Store partition } // Enable TLS upstream with the configured client certificate. diff --git a/agent/xds/listeners.go b/agent/xds/listeners.go index 4e528cf733..f97b50628f 100644 --- a/agent/xds/listeners.go +++ b/agent/xds/listeners.go @@ -185,6 +185,7 @@ func (s *ResourceGenerator) listenersFromSnapshotConnectProxy(cfgSnap *proxycfg. u := structs.Upstream{ DestinationName: sn.Name, DestinationNamespace: sn.NamespaceOrDefault(), + DestinationPartition: sn.PartitionOrDefault(), } filterChain, err := s.makeUpstreamFilterChainForDiscoveryChain( @@ -738,9 +739,7 @@ func injectHTTPFilterOnFilterChains( ) } - var ( - hcm envoy_http_v3.HttpConnectionManager - ) + var hcm envoy_http_v3.HttpConnectionManager tc, ok := hcmFilter.ConfigType.(*envoy_listener_v3.Filter_TypedConfig) if !ok { return fmt.Errorf( diff --git a/api/agent.go b/api/agent.go index 4cc15a9773..6c6343048a 100644 --- a/api/agent.go +++ b/api/agent.go @@ -278,9 +278,9 @@ type AgentServiceRegistration struct { // ServiceRegisterOpts is used to pass extra options to the service register. type ServiceRegisterOpts struct { - //Missing healthchecks will be deleted from the agent. - //Using this parameter allows to idempotently register a service and its checks without - //having to manually deregister checks. + // Missing healthchecks will be deleted from the agent. + // Using this parameter allows to idempotently register a service and its checks without + // having to manually deregister checks. ReplaceExistingChecks bool // ctx is an optional context pass through to the underlying HTTP @@ -409,9 +409,9 @@ type ConnectProxyConfig struct { // Upstream is the response structure for a proxy upstream configuration. type Upstream struct { - DestinationType UpstreamDestType `json:",omitempty"` - // DestinationPartition string `json:",omitempty"` // TODO(partitions)? - DestinationNamespace string `json:",omitempty"` + DestinationType UpstreamDestType `json:",omitempty"` + DestinationPartition string `json:",omitempty"` + DestinationNamespace string `json:",omitempty"` DestinationName string Datacenter string `json:",omitempty"` LocalBindAddress string `json:",omitempty"` @@ -963,8 +963,8 @@ func (a *Agent) ForceLeave(node string) error { return nil } -//ForceLeavePrune is used to have an a failed agent removed -//from the list of members +// ForceLeavePrune is used to have an a failed agent removed +// from the list of members func (a *Agent) ForceLeavePrune(node string) error { r := a.c.newRequest("PUT", "/v1/agent/force-leave/"+node) r.params.Set("prune", "1") @@ -1112,6 +1112,7 @@ func (a *Agent) Monitor(loglevel string, stopCh <-chan struct{}, q *QueryOptions func (a *Agent) MonitorJSON(loglevel string, stopCh <-chan struct{}, q *QueryOptions) (chan string, error) { return a.monitor(loglevel, true, stopCh, q) } + func (a *Agent) monitor(loglevel string, logJSON bool, stopCh <-chan struct{}, q *QueryOptions) (chan string, error) { r := a.c.newRequest("GET", "/v1/agent/monitor") r.setQueryOptions(q) diff --git a/connect/proxy/config.go b/connect/proxy/config.go index 7696553f5f..80f9f4da0a 100644 --- a/connect/proxy/config.go +++ b/connect/proxy/config.go @@ -106,6 +106,9 @@ func (uc *UpstreamConfig) applyDefaults() { if uc.DestinationNamespace == "" { uc.DestinationNamespace = "default" } + if uc.DestinationPartition == "" { + uc.DestinationPartition = "default" + } if uc.LocalBindAddress == "" && uc.LocalBindSocketPath == "" { uc.LocalBindAddress = "127.0.0.1" } @@ -120,8 +123,8 @@ func (uc *UpstreamConfig) String() string { "%s:%d", uc.LocalBindAddress, uc.LocalBindPort) } - return fmt.Sprintf("%s->%s:%s/%s", addr, - uc.DestinationType, uc.DestinationNamespace, uc.DestinationName) + return fmt.Sprintf("%s->%s:%s/%s/%s", addr, + uc.DestinationType, uc.DestinationPartition, uc.DestinationNamespace, uc.DestinationName) } // UpstreamResolverFuncFromClient returns a closure that captures a consul @@ -140,6 +143,7 @@ func UpstreamResolverFuncFromClient(client *api.Client) func(cfg UpstreamConfig) return &connect.ConsulResolver{ Client: client, Namespace: cfg.DestinationNamespace, + Partition: cfg.DestinationPartition, Name: cfg.DestinationName, Type: typ, Datacenter: cfg.Datacenter, diff --git a/connect/proxy/config_test.go b/connect/proxy/config_test.go index ba2974d5da..067a9048e8 100644 --- a/connect/proxy/config_test.go +++ b/connect/proxy/config_test.go @@ -23,12 +23,14 @@ func TestUpstreamResolverFuncFromClient(t *testing.T) { name: "service", cfg: UpstreamConfig{ DestinationNamespace: "foo", + DestinationPartition: "default", DestinationName: "web", Datacenter: "ny1", DestinationType: "service", }, want: &connect.ConsulResolver{ Namespace: "foo", + Partition: "default", Name: "web", Datacenter: "ny1", Type: connect.ConsulResolverTypeService, @@ -38,6 +40,7 @@ func TestUpstreamResolverFuncFromClient(t *testing.T) { name: "prepared_query", cfg: UpstreamConfig{ DestinationNamespace: "foo", + DestinationPartition: "default", DestinationName: "web", Datacenter: "ny1", DestinationType: "prepared_query", @@ -45,6 +48,7 @@ func TestUpstreamResolverFuncFromClient(t *testing.T) { want: &connect.ConsulResolver{ Namespace: "foo", Name: "web", + Partition: "default", Datacenter: "ny1", Type: connect.ConsulResolverTypePreparedQuery, }, @@ -53,11 +57,13 @@ func TestUpstreamResolverFuncFromClient(t *testing.T) { name: "unknown behaves like service", cfg: UpstreamConfig{ DestinationNamespace: "foo", + DestinationPartition: "default", DestinationName: "web", Datacenter: "ny1", DestinationType: "junk", }, want: &connect.ConsulResolver{ + Partition: "default", Namespace: "foo", Name: "web", Datacenter: "ny1", @@ -130,6 +136,7 @@ func TestAgentConfigWatcherSidecarProxy(t *testing.T) { { DestinationName: "db", DestinationNamespace: "default", + DestinationPartition: "default", DestinationType: "service", LocalBindPort: 9191, LocalBindAddress: "127.0.0.1", @@ -159,6 +166,7 @@ func TestAgentConfigWatcherSidecarProxy(t *testing.T) { expectCfg.Upstreams = append(expectCfg.Upstreams, UpstreamConfig{ DestinationName: "cache", DestinationNamespace: "default", + DestinationPartition: "default", DestinationType: "service", LocalBindPort: 9292, LocalBindAddress: "127.10.10.10", diff --git a/connect/resolver.go b/connect/resolver.go index 73f83de586..54ca272674 100644 --- a/connect/resolver.go +++ b/connect/resolver.go @@ -66,6 +66,9 @@ type ConsulResolver struct { // Namespace of the query target. Namespace string + // Partition of the query target. + Partition string + // Name of the query target. Name string diff --git a/proto/pbservice/service.gen.go b/proto/pbservice/service.gen.go index 1a8c3e9c1a..c2fdb74bf2 100644 --- a/proto/pbservice/service.gen.go +++ b/proto/pbservice/service.gen.go @@ -144,6 +144,7 @@ func UpstreamToStructs(s Upstream) structs.Upstream { var t structs.Upstream t.DestinationType = s.DestinationType t.DestinationNamespace = s.DestinationNamespace + t.DestinationPartition = s.DestinationPartition t.DestinationName = s.DestinationName t.Datacenter = s.Datacenter t.LocalBindAddress = s.LocalBindAddress @@ -159,6 +160,7 @@ func NewUpstreamFromStructs(t structs.Upstream) Upstream { var s Upstream s.DestinationType = t.DestinationType s.DestinationNamespace = t.DestinationNamespace + s.DestinationPartition = t.DestinationPartition s.DestinationName = t.DestinationName s.Datacenter = t.Datacenter s.LocalBindAddress = t.LocalBindAddress diff --git a/proto/pbservice/service.pb.go b/proto/pbservice/service.pb.go index 55b313a4c7..9bd4b381ca 100644 --- a/proto/pbservice/service.pb.go +++ b/proto/pbservice/service.pb.go @@ -157,8 +157,9 @@ type Upstream struct { // instance registration or whether it was generated from a config entry. CentrallyConfigured bool `protobuf:"varint,9,opt,name=CentrallyConfigured,proto3" json:"CentrallyConfigured,omitempty"` // LocalBindSocketPath is the socket to create to connect to the upstream service - LocalBindSocketPath string `protobuf:"bytes,10,opt,name=LocalBindSocketPath,proto3" json:"LocalBindSocketPath,omitempty"` - LocalBindSocketMode string `protobuf:"bytes,11,opt,name=LocalBindSocketMode,proto3" json:"LocalBindSocketMode,omitempty"` + LocalBindSocketPath string `protobuf:"bytes,10,opt,name=LocalBindSocketPath,proto3" json:"LocalBindSocketPath,omitempty"` + LocalBindSocketMode string `protobuf:"bytes,11,opt,name=LocalBindSocketMode,proto3" json:"LocalBindSocketMode,omitempty"` + DestinationPartition string `protobuf:"bytes,12,opt,name=DestinationPartition,proto3" json:"DestinationPartition,omitempty"` } func (m *Upstream) Reset() { *m = Upstream{} } @@ -619,82 +620,83 @@ func init() { func init() { proto.RegisterFile("proto/pbservice/service.proto", fileDescriptor_cbb99233b75fb80b) } var fileDescriptor_cbb99233b75fb80b = []byte{ - // 1200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xcf, 0x6e, 0x1b, 0xb7, - 0x13, 0xc7, 0xb5, 0xfa, 0x63, 0x49, 0xe3, 0xfc, 0x1c, 0x9b, 0xd1, 0xcf, 0xdd, 0xba, 0x89, 0xec, - 0x08, 0x45, 0x60, 0xb4, 0x86, 0x94, 0xd8, 0x48, 0xdd, 0x04, 0x48, 0x81, 0xda, 0x72, 0x8b, 0x20, - 0x71, 0xa2, 0xae, 0x55, 0x04, 0x2d, 0xd0, 0x03, 0xb5, 0xa2, 0x57, 0x0b, 0x4b, 0x4b, 0x61, 0x49, - 0xb9, 0xd1, 0x5b, 0xf4, 0xd6, 0x5e, 0x7b, 0xe8, 0xbd, 0x8f, 0xe1, 0x63, 0x8e, 0x3d, 0x19, 0xad, - 0xfd, 0x16, 0x3e, 0x15, 0x1c, 0x72, 0xd7, 0xab, 0xd5, 0xd6, 0x48, 0x7b, 0x12, 0x39, 0xdf, 0x99, - 0x21, 0x97, 0xfc, 0xcc, 0x50, 0x70, 0x6f, 0x1c, 0x72, 0xc9, 0x5b, 0xe3, 0x9e, 0x60, 0xe1, 0xa9, - 0xef, 0xb2, 0x96, 0xf9, 0x6d, 0xa2, 0x9d, 0x54, 0x63, 0x61, 0xed, 0xae, 0xc7, 0xb9, 0x37, 0x64, - 0x2d, 0x14, 0x7a, 0x93, 0xe3, 0x96, 0x90, 0xe1, 0xc4, 0x95, 0xda, 0x71, 0xed, 0xa3, 0x28, 0x8f, - 0xcb, 0x47, 0x23, 0x1e, 0xb4, 0xf4, 0x8f, 0x11, 0xef, 0xa7, 0x17, 0x19, 0x30, 0x3a, 0x94, 0x03, - 0x77, 0xc0, 0xdc, 0x13, 0xe3, 0x52, 0xf3, 0xb8, 0xc7, 0xb5, 0x9b, 0x1a, 0x69, 0x6b, 0xe3, 0xb7, - 0x12, 0x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e, 0x4e, 0xa0, 0x85, 0x99, 0x58, 0xe3, 0x4c, 0x5e, - 0x40, 0xf1, 0x90, 0xf7, 0x99, 0x5d, 0x55, 0x67, 0xb7, 0xb7, 0x7b, 0x75, 0xbe, 0xbe, 0xe3, 0xf9, - 0x72, 0x30, 0xe9, 0x35, 0x5d, 0x3e, 0x6a, 0x0d, 0xa8, 0x18, 0xf8, 0x2e, 0x0f, 0xc7, 0x2d, 0x97, - 0x07, 0x62, 0x32, 0x6c, 0x51, 0x8f, 0x05, 0xd2, 0x50, 0x26, 0x9a, 0x78, 0xff, 0x2a, 0xdc, 0xc1, - 0x24, 0xe4, 0x08, 0x96, 0xbb, 0x21, 0x0d, 0xc4, 0x98, 0x86, 0x2c, 0xd0, 0x74, 0xd8, 0x80, 0xbb, - 0xb9, 0x9f, 0xd8, 0x4d, 0xda, 0x65, 0x66, 0x5f, 0x73, 0x09, 0x14, 0x58, 0xc9, 0x2b, 0x3a, 0xe2, - 0xee, 0x09, 0x93, 0x1d, 0x2a, 0x07, 0xf6, 0xa2, 0x06, 0x2b, 0x5b, 0x6d, 0xfc, 0x5c, 0x84, 0x4a, - 0x74, 0xc8, 0x64, 0x13, 0x6e, 0x27, 0x48, 0xea, 0x4e, 0xc7, 0x11, 0x96, 0x69, 0x73, 0x8a, 0x47, - 0x85, 0xa8, 0x18, 0x53, 0x97, 0x65, 0xf0, 0x18, 0x6b, 0xa9, 0xec, 0x08, 0x7d, 0x61, 0x2e, 0x3b, - 0xd2, 0x5e, 0x07, 0x68, 0x53, 0x49, 0x5d, 0x16, 0x48, 0x16, 0x22, 0x81, 0x55, 0x27, 0x61, 0x89, - 0x39, 0xdd, 0xf3, 0x83, 0x7e, 0x84, 0x75, 0x09, 0xbd, 0xe6, 0xec, 0xe4, 0x63, 0xf8, 0x5f, 0x6c, - 0x43, 0xa0, 0x17, 0x10, 0xe8, 0x59, 0x63, 0x82, 0xe6, 0xf2, 0xbf, 0xa1, 0x39, 0x05, 0x65, 0xe5, - 0xbf, 0x41, 0xf9, 0x10, 0xee, 0xec, 0xb3, 0x40, 0x86, 0x74, 0x38, 0x34, 0x5e, 0x93, 0x90, 0xf5, - 0x11, 0xb6, 0x8a, 0x93, 0x25, 0xc5, 0xa5, 0xad, 0xf6, 0x9f, 0xb8, 0x6a, 0x48, 0x94, 0xf6, 0xac, - 0x94, 0x11, 0x81, 0x40, 0x2f, 0x66, 0x46, 0x28, 0xa9, 0x11, 0xc0, 0x92, 0xc1, 0xc5, 0xf4, 0x31, - 0xb2, 0x0a, 0x0b, 0xaf, 0xa8, 0xf4, 0x4f, 0x35, 0x15, 0x15, 0xc7, 0xcc, 0x48, 0x1b, 0x96, 0x8e, - 0xfc, 0x3e, 0x73, 0x69, 0x68, 0x02, 0xf0, 0x5e, 0x67, 0x0f, 0xc2, 0x28, 0x6d, 0x76, 0xec, 0x07, - 0xbe, 0xba, 0x68, 0x27, 0x15, 0xd3, 0xf8, 0x0e, 0x6e, 0x25, 0x2b, 0x50, 0xad, 0xb6, 0xaf, 0xda, - 0xac, 0x88, 0x56, 0xd3, 0x33, 0xf2, 0x08, 0x4a, 0xea, 0x8b, 0x84, 0x9d, 0xc7, 0xee, 0xf1, 0xff, - 0xb9, 0x0a, 0x56, 0xaa, 0x39, 0x66, 0xed, 0xd9, 0xf8, 0xdd, 0x02, 0xb8, 0xd6, 0x48, 0x03, 0x6e, - 0xbd, 0xf4, 0x85, 0x64, 0x01, 0x0b, 0x91, 0x08, 0x0b, 0x89, 0x98, 0xb1, 0x11, 0x02, 0x45, 0x3c, - 0x52, 0x0d, 0x34, 0x8e, 0x63, 0x94, 0xd4, 0x04, 0x03, 0x0b, 0x09, 0x94, 0x22, 0x23, 0x59, 0x83, - 0x4a, 0x47, 0x41, 0xe3, 0xf2, 0xa1, 0x41, 0x37, 0x9e, 0xab, 0x12, 0xe8, 0xd0, 0x50, 0xb0, 0xfe, - 0x57, 0x21, 0x1f, 0xe1, 0xf7, 0x20, 0xb7, 0x15, 0x27, 0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x4b, 0xe6, 0xac, 0x26, 0x02, 0x1b, 0x5f, 0xc4, 0xfd, 0x3f, - 0xc2, 0x3f, 0x51, 0x18, 0xd6, 0x6c, 0x61, 0x44, 0xe4, 0xe5, 0xaf, 0xc9, 0x6b, 0x3c, 0x8b, 0x6f, - 0x5e, 0x05, 0x76, 0xa8, 0x10, 0x7e, 0xe0, 0x99, 0xee, 0x11, 0x4d, 0x95, 0xf2, 0x86, 0x86, 0x81, - 0x52, 0x74, 0x6c, 0x34, 0xdd, 0x3b, 0x3c, 0xfb, 0xab, 0x9e, 0x3b, 0xbb, 0xa8, 0x5b, 0xef, 0x2e, - 0xea, 0xd6, 0x9f, 0x17, 0x75, 0xeb, 0xa7, 0xcb, 0x7a, 0xee, 0x97, 0xcb, 0x7a, 0xee, 0xdd, 0x65, - 0x3d, 0xf7, 0xc7, 0x65, 0x3d, 0xf7, 0xfd, 0xa7, 0x37, 0x35, 0x87, 0xd4, 0xff, 0xf6, 0xde, 0x02, - 0x1a, 0x76, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x70, 0xa5, 0x21, 0xd2, 0x36, 0x0c, 0x00, 0x00, + // 1212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xcd, 0x6e, 0x1b, 0x37, + 0x10, 0xc7, 0xb5, 0xfa, 0xb0, 0x24, 0xda, 0xf5, 0x07, 0xad, 0xba, 0x5b, 0x37, 0x91, 0x1d, 0xa1, + 0x08, 0x8c, 0xd6, 0x90, 0x12, 0x1b, 0xa9, 0x9b, 0x00, 0x29, 0x50, 0x5b, 0x6e, 0x11, 0x24, 0x4e, + 0xd4, 0xb5, 0x8a, 0xa0, 0x05, 0x7a, 0xa0, 0x56, 0xf4, 0x6a, 0x61, 0x69, 0x29, 0x90, 0x94, 0x1b, + 0xbd, 0x45, 0x8f, 0xbd, 0xf6, 0xd0, 0x7b, 0x1f, 0x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0xcb, 0xba, 0xf5, 0xf7, 0x65, + 0xdd, 0xfa, 0xe5, 0xaa, 0x9e, 0xfb, 0xf5, 0xaa, 0x9e, 0x7b, 0x7b, 0x55, 0xcf, 0xfd, 0x75, 0x55, + 0xcf, 0xfd, 0xf8, 0xf9, 0x6d, 0xcd, 0x21, 0xf1, 0x5f, 0xbf, 0x37, 0x07, 0x86, 0xdd, 0x7f, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x93, 0xfb, 0xcc, 0xfb, 0x6a, 0x0c, 0x00, 0x00, } func (m *ConnectProxyConfig) Marshal() (dAtA []byte, err error) { @@ -836,6 +838,13 @@ func (m *Upstream) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DestinationPartition) > 0 { + i -= len(m.DestinationPartition) + copy(dAtA[i:], m.DestinationPartition) + i = encodeVarintService(dAtA, i, uint64(len(m.DestinationPartition))) + i-- + dAtA[i] = 0x62 + } if len(m.LocalBindSocketMode) > 0 { i -= len(m.LocalBindSocketMode) copy(dAtA[i:], m.LocalBindSocketMode) @@ -1523,6 +1532,10 @@ func (m *Upstream) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } + l = len(m.DestinationPartition) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } return n } @@ -2494,6 +2507,38 @@ func (m *Upstream) Unmarshal(dAtA []byte) error { } m.LocalBindSocketMode = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationPartition", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationPartition = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/proto/pbservice/service.proto b/proto/pbservice/service.proto index e8e050115d..5faf9fe92a 100644 --- a/proto/pbservice/service.proto +++ b/proto/pbservice/service.proto @@ -134,6 +134,7 @@ message Upstream { // LocalBindSocketPath is the socket to create to connect to the upstream service string LocalBindSocketPath = 10; string LocalBindSocketMode = 11; + string DestinationPartition = 12; } // ServiceConnect are the shared Connect settings between all service