agent/structs: add a bunch more EnterpriseMeta helper functions to help with partitioning (#10669)

This commit is contained in:
R.B. Boyer 2021-07-22 13:20:45 -05:00 committed by GitHub
parent c6859b3fb0
commit 188e8dc51f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 511 additions and 471 deletions

View File

@ -201,7 +201,7 @@ func (a *Agent) filterMembers(token string, members *[]serf.Member) error {
} }
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.DefaultEnterpriseMeta().FillAuthzContext(&authzContext) structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
// Filter out members based on the node policy. // Filter out members based on the node policy.
m := *members m := *members
for i := 0; i < len(m); i++ { for i := 0; i < len(m); i++ {
@ -271,7 +271,7 @@ func (a *Agent) filterChecksWithAuthorizer(authz acl.Authorizer, checks *map[str
continue continue
} }
} else { } else {
structs.DefaultEnterpriseMeta().FillAuthzContext(&authzContext) structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if authz.NodeRead(a.config.NodeName, &authzContext) == acl.Allow { if authz.NodeRead(a.config.NodeName, &authzContext) == acl.Allow {
continue continue
} }

View File

@ -116,7 +116,7 @@ func (a *TestACLAgent) ResolveTokenAndDefaultMeta(secretID string, entMeta *stru
if identity != nil { if identity != nil {
entMeta.Merge(identity.EnterpriseMetadata()) entMeta.Merge(identity.EnterpriseMetadata())
} else { } else {
entMeta.Merge(structs.DefaultEnterpriseMeta()) entMeta.Merge(structs.DefaultEnterpriseMetaInDefaultPartition())
} }
// Use the meta to fill in the ACL authorization context // Use the meta to fill in the ACL authorization context

View File

@ -1684,7 +1684,7 @@ OUTER:
// reapServicesInternal does a single pass, looking for services to reap. // reapServicesInternal does a single pass, looking for services to reap.
func (a *Agent) reapServicesInternal() { func (a *Agent) reapServicesInternal() {
reaped := make(map[structs.ServiceID]bool) reaped := make(map[structs.ServiceID]bool)
for checkID, cs := range a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()) { for checkID, cs := range a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()) {
serviceID := cs.Check.CompoundServiceID() serviceID := cs.Check.CompoundServiceID()
// There's nothing to do if there's no service. // There's nothing to do if there's no service.
@ -2014,7 +2014,7 @@ func (a *Agent) addServiceInternal(req addServiceInternalRequest) error {
// Agent.Start does not have a snapshot, and we don't want to query // Agent.Start does not have a snapshot, and we don't want to query
// State.Checks each time. // State.Checks each time.
if req.checkStateSnapshot == nil { if req.checkStateSnapshot == nil {
req.checkStateSnapshot = a.State.Checks(structs.WildcardEnterpriseMeta()) req.checkStateSnapshot = a.State.Checks(structs.WildcardEnterpriseMetaInDefaultPartition())
} }
// Create an associated health check // Create an associated health check
@ -3307,7 +3307,7 @@ func (a *Agent) loadServices(conf *config.RuntimeConfig, snap map[structs.CheckI
// unloadServices will deregister all services. // unloadServices will deregister all services.
func (a *Agent) unloadServices() error { func (a *Agent) unloadServices() error {
for id := range a.State.Services(structs.WildcardEnterpriseMeta()) { for id := range a.State.Services(structs.WildcardEnterpriseMetaInDefaultPartition()) {
if err := a.removeServiceLocked(id, false); err != nil { if err := a.removeServiceLocked(id, false); err != nil {
return fmt.Errorf("Failed deregistering service '%s': %v", id, err) return fmt.Errorf("Failed deregistering service '%s': %v", id, err)
} }
@ -3421,7 +3421,7 @@ func (a *Agent) loadChecks(conf *config.RuntimeConfig, snap map[structs.CheckID]
// unloadChecks will deregister all checks known to the local agent. // unloadChecks will deregister all checks known to the local agent.
func (a *Agent) unloadChecks() error { func (a *Agent) unloadChecks() error {
for id := range a.State.Checks(structs.WildcardEnterpriseMeta()) { for id := range a.State.Checks(structs.WildcardEnterpriseMetaInDefaultPartition()) {
if err := a.removeCheckLocked(id, false); err != nil { if err := a.removeCheckLocked(id, false); err != nil {
return fmt.Errorf("Failed deregistering check '%s': %s", id, err) return fmt.Errorf("Failed deregistering check '%s': %s", id, err)
} }
@ -3433,7 +3433,7 @@ func (a *Agent) unloadChecks() error {
// checks. This is done before we reload our checks, so that we can properly // checks. This is done before we reload our checks, so that we can properly
// restore into the same state. // restore into the same state.
func (a *Agent) snapshotCheckState() map[structs.CheckID]*structs.HealthCheck { func (a *Agent) snapshotCheckState() map[structs.CheckID]*structs.HealthCheck {
return a.State.Checks(structs.WildcardEnterpriseMeta()) return a.State.Checks(structs.WildcardEnterpriseMetaInDefaultPartition())
} }
// loadMetadata loads node metadata fields from the agent config and // loadMetadata loads node metadata fields from the agent config and

View File

@ -380,7 +380,7 @@ func TestAgent_Service(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// Define an updated version. Be careful to copy it. // Define an updated version. Be careful to copy it.
@ -408,7 +408,7 @@ func TestAgent_Service(t *testing.T) {
Tags: []string{}, Tags: []string{},
Datacenter: "dc1", Datacenter: "dc1",
} }
fillAgentServiceEnterpriseMeta(expectedResponse, structs.DefaultEnterpriseMeta()) fillAgentServiceEnterpriseMeta(expectedResponse, structs.DefaultEnterpriseMetaInDefaultPartition())
// Copy and modify // Copy and modify
updatedResponse := *expectedResponse updatedResponse := *expectedResponse
@ -435,7 +435,7 @@ func TestAgent_Service(t *testing.T) {
Tags: []string{}, Tags: []string{},
Datacenter: "dc1", Datacenter: "dc1",
} }
fillAgentServiceEnterpriseMeta(expectWebResponse, structs.DefaultEnterpriseMeta()) fillAgentServiceEnterpriseMeta(expectWebResponse, structs.DefaultEnterpriseMetaInDefaultPartition())
tests := []struct { tests := []struct {
name string name string
@ -2973,7 +2973,7 @@ func testAgent_RegisterService(t *testing.T, extraHCL string) {
} }
// Ensure we have a check mapping // Ensure we have a check mapping
checks := a.State.Checks(structs.WildcardEnterpriseMeta()) checks := a.State.Checks(structs.WildcardEnterpriseMetaInDefaultPartition())
if len(checks) != 3 { if len(checks) != 3 {
t.Fatalf("bad: %v", checks) t.Fatalf("bad: %v", checks)
} }
@ -3063,7 +3063,7 @@ func testAgent_RegisterService_ReRegister(t *testing.T, extraHCL string) {
_, err = a.srv.AgentRegisterService(nil, req) _, err = a.srv.AgentRegisterService(nil, req)
require.NoError(t, err) require.NoError(t, err)
checks := a.State.Checks(structs.DefaultEnterpriseMeta()) checks := a.State.Checks(structs.DefaultEnterpriseMetaInDefaultPartition())
require.Equal(t, 3, len(checks)) require.Equal(t, 3, len(checks))
checkIDs := []string{} checkIDs := []string{}
@ -3142,7 +3142,7 @@ func testAgent_RegisterService_ReRegister_ReplaceExistingChecks(t *testing.T, ex
_, err = a.srv.AgentRegisterService(nil, req) _, err = a.srv.AgentRegisterService(nil, req)
require.NoError(t, err) require.NoError(t, err)
checks := a.State.Checks(structs.DefaultEnterpriseMeta()) checks := a.State.Checks(structs.DefaultEnterpriseMetaInDefaultPartition())
require.Len(t, checks, 2) require.Len(t, checks, 2)
checkIDs := []string{} checkIDs := []string{}
@ -3319,7 +3319,7 @@ func testAgent_RegisterService_TranslateKeys(t *testing.T, extraHCL string) {
// there worked by inspecting the registered sidecar below. // there worked by inspecting the registered sidecar below.
SidecarService: nil, SidecarService: nil,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
got := a.State.Service(structs.NewServiceID("test", nil)) got := a.State.Service(structs.NewServiceID("test", nil))
@ -3356,7 +3356,7 @@ func testAgent_RegisterService_TranslateKeys(t *testing.T, extraHCL string) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
gotSidecar := a.State.Service(structs.NewServiceID("test-sidecar-proxy", nil)) gotSidecar := a.State.Service(structs.NewServiceID("test-sidecar-proxy", nil))
hasNoCorrectTCPCheck := true hasNoCorrectTCPCheck := true
@ -3567,7 +3567,7 @@ func testDefaultSidecar(svc string, port int, fns ...func(*structs.NodeService))
LocalServiceAddress: "127.0.0.1", LocalServiceAddress: "127.0.0.1",
LocalServicePort: port, LocalServicePort: port,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
for _, fn := range fns { for _, fn := range fns {
fn(ns) fn(ns)
@ -3925,7 +3925,7 @@ func testAgent_RegisterServiceDeregisterService_Sidecar(t *testing.T, extraHCL s
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
// After we deregister the web service above, the fake sidecar with // After we deregister the web service above, the fake sidecar with
// clashing ID SHOULD NOT have been removed since it wasn't part of the // clashing ID SHOULD NOT have been removed since it wasn't part of the
@ -3972,7 +3972,7 @@ func testAgent_RegisterServiceDeregisterService_Sidecar(t *testing.T, extraHCL s
LocalServiceAddress: "127.0.0.1", LocalServiceAddress: "127.0.0.1",
LocalServicePort: 1111, LocalServicePort: 1111,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
{ {

View File

@ -422,7 +422,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
Tags: []string{"tag1"}, Tags: []string{"tag1"},
Weights: nil, // nil weights... Weights: nil, // nil weights...
Port: 8100, Port: 8100,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
// ... should be populated to avoid "IsSame" returning true during AE. // ... should be populated to avoid "IsSame" returning true during AE.
func(ns *structs.NodeService) { func(ns *structs.NodeService) {
@ -450,7 +450,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
ServiceName: "svcname1", ServiceName: "svcname1",
ServiceTags: []string{"tag1"}, ServiceTags: []string{"tag1"},
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -465,7 +465,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
}, },
Tags: []string{"tag2"}, Tags: []string{"tag2"},
Port: 8200, Port: 8200,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
nil, // No change expected nil, // No change expected
[]*structs.CheckType{ []*structs.CheckType{
@ -498,7 +498,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
ServiceName: "svcname2", ServiceName: "svcname2",
ServiceTags: []string{"tag2"}, ServiceTags: []string{"tag2"},
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
"check-noname": { "check-noname": {
Node: "node1", Node: "node1",
@ -509,7 +509,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
ServiceName: "svcname2", ServiceName: "svcname2",
ServiceTags: []string{"tag2"}, ServiceTags: []string{"tag2"},
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
"service:svcid2:3": { "service:svcid2:3": {
Node: "node1", Node: "node1",
@ -520,7 +520,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
ServiceName: "svcname2", ServiceName: "svcname2",
ServiceTags: []string{"tag2"}, ServiceTags: []string{"tag2"},
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
"service:svcid2:4": { "service:svcid2:4": {
Node: "node1", Node: "node1",
@ -531,7 +531,7 @@ func testAgent_AddService(t *testing.T, extraHCL string) {
ServiceName: "svcname2", ServiceName: "svcname2",
ServiceTags: []string{"tag2"}, ServiceTags: []string{"tag2"},
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -696,11 +696,11 @@ func test_createAlias(t *testing.T, agent *TestAgent, chk *structs.CheckType, ex
return func(r *retry.R) { return func(r *retry.R) {
t.Helper() t.Helper()
found := false found := false
for _, c := range agent.State.CheckStates(structs.WildcardEnterpriseMeta()) { for _, c := range agent.State.CheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()) {
if c.Check.CheckID == chk.CheckID { if c.Check.CheckID == chk.CheckID {
found = true found = true
assert.Equal(t, expectedResult, c.Check.Status, "Check state should be %s, was %s in %#v", expectedResult, c.Check.Status, c.Check) assert.Equal(t, expectedResult, c.Check.Status, "Check state should be %s, was %s in %#v", expectedResult, c.Check.Status, c.Check)
srvID := structs.NewServiceID(srv.ID, structs.WildcardEnterpriseMeta()) srvID := structs.NewServiceID(srv.ID, structs.WildcardEnterpriseMetaInDefaultPartition())
if err := agent.Agent.State.RemoveService(srvID); err != nil { if err := agent.Agent.State.RemoveService(srvID); err != nil {
fmt.Println("[DEBUG] Fail to remove service", srvID, ", err:=", err) fmt.Println("[DEBUG] Fail to remove service", srvID, ", err:=", err)
} }
@ -766,7 +766,7 @@ func TestAgent_CheckAliasRPC(t *testing.T) {
err := a.RPC("Catalog.NodeServices", &args, &out) err := a.RPC("Catalog.NodeServices", &args, &out)
assert.NoError(r, err) assert.NoError(r, err)
foundService := false foundService := false
lookup := structs.NewServiceID("svcid1", structs.WildcardEnterpriseMeta()) lookup := structs.NewServiceID("svcid1", structs.WildcardEnterpriseMetaInDefaultPartition())
for _, srv := range out.NodeServices.Services { for _, srv := range out.NodeServices.Services {
if lookup.Matches(srv.CompoundServiceID()) { if lookup.Matches(srv.CompoundServiceID()) {
foundService = true foundService = true
@ -804,7 +804,7 @@ func TestAgent_CheckAliasRPC(t *testing.T) {
for i := 0; i < 50; i++ { for i := 0; i < 50; i++ {
unlockIndexOnNode() unlockIndexOnNode()
allNonWarning := true allNonWarning := true
for _, chk := range a.State.Checks(structs.WildcardEnterpriseMeta()) { for _, chk := range a.State.Checks(structs.WildcardEnterpriseMetaInDefaultPartition()) {
if chk.Status == api.HealthWarning { if chk.Status == api.HealthWarning {
allNonWarning = false allNonWarning = false
} }
@ -1217,7 +1217,7 @@ func testAgent_RemoveServiceRemovesAllChecks(t *testing.T, extraHCL string) {
node_name = "node1" node_name = "node1"
`+extraHCL) `+extraHCL)
defer a.Shutdown() defer a.Shutdown()
svc := &structs.NodeService{ID: "redis", Service: "redis", Port: 8000, EnterpriseMeta: *structs.DefaultEnterpriseMeta()} svc := &structs.NodeService{ID: "redis", Service: "redis", Port: 8000, EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition()}
chk1 := &structs.CheckType{CheckID: "chk1", Name: "chk1", TTL: time.Minute} chk1 := &structs.CheckType{CheckID: "chk1", Name: "chk1", TTL: time.Minute}
chk2 := &structs.CheckType{CheckID: "chk2", Name: "chk2", TTL: 2 * time.Minute} chk2 := &structs.CheckType{CheckID: "chk2", Name: "chk2", TTL: 2 * time.Minute}
hchk1 := &structs.HealthCheck{ hchk1 := &structs.HealthCheck{
@ -1228,7 +1228,7 @@ func testAgent_RemoveServiceRemovesAllChecks(t *testing.T, extraHCL string) {
ServiceID: "redis", ServiceID: "redis",
ServiceName: "redis", ServiceName: "redis",
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
hchk2 := &structs.HealthCheck{Node: "node1", hchk2 := &structs.HealthCheck{Node: "node1",
CheckID: "chk2", CheckID: "chk2",
@ -1237,7 +1237,7 @@ func testAgent_RemoveServiceRemovesAllChecks(t *testing.T, extraHCL string) {
ServiceID: "redis", ServiceID: "redis",
ServiceName: "redis", ServiceName: "redis",
Type: "ttl", Type: "ttl",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// register service with chk1 // register service with chk1
@ -2321,7 +2321,7 @@ func testAgent_persistedService_compat(t *testing.T, extraHCL string) {
Port: 8000, Port: 8000,
TaggedAddresses: map[string]structs.ServiceAddress{}, TaggedAddresses: map[string]structs.ServiceAddress{},
Weights: &structs.Weights{Passing: 1, Warning: 1}, Weights: &structs.Weights{Passing: 1, Warning: 1},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// Encode the NodeService directly. This is what previous versions // Encode the NodeService directly. This is what previous versions
@ -2607,7 +2607,7 @@ func TestAgent_PurgeCheckOnDuplicate(t *testing.T) {
CheckID: "mem", CheckID: "mem",
Name: "memory check", Name: "memory check",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// First persist the check // First persist the check
@ -2648,7 +2648,7 @@ func TestAgent_PurgeCheckOnDuplicate(t *testing.T) {
Name: "memory check", Name: "memory check",
Status: api.HealthCritical, Status: api.HealthCritical,
Notes: "my cool notes", Notes: "my cool notes",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.Equal(t, expected, result) require.Equal(t, expected, result)
} }
@ -2679,7 +2679,7 @@ func TestAgent_DeregisterPersistedSidecarAfterRestart(t *testing.T) {
}, },
Tags: []string{"tag2"}, Tags: []string{"tag2"},
Port: 8200, Port: 8200,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Connect: structs.ServiceConnect{ Connect: structs.ServiceConnect{
SidecarService: &structs.ServiceDefinition{}, SidecarService: &structs.ServiceDefinition{},
@ -3051,7 +3051,7 @@ func testAgent_unloadServices(t *testing.T, extraHCL string) {
if err := a.unloadServices(); err != nil { if err := a.unloadServices(); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
if len(a.State.Services(structs.WildcardEnterpriseMeta())) != 0 { if len(a.State.Services(structs.WildcardEnterpriseMetaInDefaultPartition())) != 0 {
t.Fatalf("should have unloaded services") t.Fatalf("should have unloaded services")
} }
} }
@ -3160,7 +3160,7 @@ func TestAgent_Service_Reap(t *testing.T) {
// Make sure it's there and there's no critical check yet. // Make sure it's there and there's no critical check yet.
requireServiceExists(t, a, "redis") requireServiceExists(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 0, "should not have critical checks") require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 0, "should not have critical checks")
// Wait for the check TTL to fail but before the check is reaped. // Wait for the check TTL to fail but before the check is reaped.
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
@ -3172,17 +3172,17 @@ func TestAgent_Service_Reap(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
requireServiceExists(t, a, "redis") requireServiceExists(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 0, "should not have critical checks") require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 0, "should not have critical checks")
// Wait for the check TTL to fail again. // Wait for the check TTL to fail again.
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
requireServiceExists(t, a, "redis") requireServiceExists(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 1, "should have 1 critical check") require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 1, "should have 1 critical check")
// Wait for the reap. // Wait for the reap.
time.Sleep(400 * time.Millisecond) time.Sleep(400 * time.Millisecond)
requireServiceMissing(t, a, "redis") requireServiceMissing(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 0, "should not have critical checks") require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 0, "should not have critical checks")
} }
func TestAgent_Service_NoReap(t *testing.T) { func TestAgent_Service_NoReap(t *testing.T) {
@ -3217,17 +3217,17 @@ func TestAgent_Service_NoReap(t *testing.T) {
// Make sure it's there and there's no critical check yet. // Make sure it's there and there's no critical check yet.
requireServiceExists(t, a, "redis") requireServiceExists(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 0) require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 0)
// Wait for the check TTL to fail. // Wait for the check TTL to fail.
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
requireServiceExists(t, a, "redis") requireServiceExists(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 1) require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 1)
// Wait a while and make sure it doesn't reap. // Wait a while and make sure it doesn't reap.
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
requireServiceExists(t, a, "redis") requireServiceExists(t, a, "redis")
require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMeta()), 1) require.Len(t, a.State.CriticalCheckStates(structs.WildcardEnterpriseMetaInDefaultPartition()), 1)
} }
func TestAgent_AddService_restoresSnapshot(t *testing.T) { func TestAgent_AddService_restoresSnapshot(t *testing.T) {

View File

@ -31,7 +31,7 @@ func newLeaf(t *testing.T, agentName, datacenter string, ca *structs.CARoot, idx
ValidBefore: cert.NotAfter, ValidBefore: cert.NotAfter,
Agent: agentID.Agent, Agent: agentID.Agent,
AgentURI: agentID.URI().String(), AgentURI: agentID.URI().String(),
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
RaftIndex: structs.RaftIndex{ RaftIndex: structs.RaftIndex{
CreateIndex: idx, CreateIndex: idx,
ModifyIndex: idx, ModifyIndex: idx,

View File

@ -108,7 +108,7 @@ func (c *CheckAlias) runLocal(stopCh chan struct{}) {
} }
updateStatus := func() { updateStatus := func() {
checks := c.Notify.Checks(structs.WildcardEnterpriseMeta()) checks := c.Notify.Checks(structs.WildcardEnterpriseMetaInDefaultPartition())
checksList := make([]*structs.HealthCheck, 0, len(checks)) checksList := make([]*structs.HealthCheck, 0, len(checks))
for _, chk := range checks { for _, chk := range checks {
checksList = append(checksList, chk) checksList = append(checksList, chk)

View File

@ -2273,7 +2273,7 @@ func (b *builder) autoConfigAuthorizerVal(raw AutoConfigAuthorizationRaw) AutoCo
val.AuthMethod = structs.ACLAuthMethod{ val.AuthMethod = structs.ACLAuthMethod{
Name: "Auto Config Authorizer", Name: "Auto Config Authorizer",
Type: "jwt", Type: "jwt",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Config: map[string]interface{}{ Config: map[string]interface{}{
"JWTSupportedAlgs": raw.Static.JWTSupportedAlgs, "JWTSupportedAlgs": raw.Static.JWTSupportedAlgs,
"BoundAudiences": raw.Static.BoundAudiences, "BoundAudiences": raw.Static.BoundAudiences,

View File

@ -8,5 +8,5 @@ import "github.com/hashicorp/consul/agent/structs"
type EnterpriseMeta struct{} type EnterpriseMeta struct{}
func (_ *EnterpriseMeta) ToStructs() structs.EnterpriseMeta { func (_ *EnterpriseMeta) ToStructs() structs.EnterpriseMeta {
return *structs.DefaultEnterpriseMeta() return *structs.DefaultEnterpriseMetaInDefaultPartition()
} }

View File

@ -74,7 +74,7 @@ func TestLoad_IntegrationWithFlags(t *testing.T) {
} }
} }
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
// ------------------------------------------------------------ // ------------------------------------------------------------
// cmd line flags // cmd line flags
@ -5184,7 +5184,7 @@ func TestLoad_FullConfig(t *testing.T) {
return n return n
} }
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
expected := &RuntimeConfig{ expected := &RuntimeConfig{
// non-user configurable values // non-user configurable values
ACLDisabledTTL: 120 * time.Second, ACLDisabledTTL: 120 * time.Second,
@ -5378,7 +5378,7 @@ func TestLoad_FullConfig(t *testing.T) {
AuthMethod: structs.ACLAuthMethod{ AuthMethod: structs.ACLAuthMethod{
Name: "Auto Config Authorizer", Name: "Auto Config Authorizer",
Type: "jwt", Type: "jwt",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Config: map[string]interface{}{ Config: map[string]interface{}{
"JWTValidationPubKeys": []string{"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERVchfCZng4mmdvQz1+sJHRN40snC\nYt8NjYOnbnScEXMkyoUmASr88gb7jaVAVt3RYASAbgBjB2Z+EUizWkx5Tg==\n-----END PUBLIC KEY-----"}, "JWTValidationPubKeys": []string{"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERVchfCZng4mmdvQz1+sJHRN40snC\nYt8NjYOnbnScEXMkyoUmASr88gb7jaVAVt3RYASAbgBjB2Z+EUizWkx5Tg==\n-----END PUBLIC KEY-----"},
"ClaimMappings": map[string]string{ "ClaimMappings": map[string]string{

View File

@ -292,11 +292,11 @@ func TestConfig_Apply_TerminatingGateway(t *testing.T) {
CAFile: "/etc/web/ca.crt", CAFile: "/etc/web/ca.crt",
CertFile: "/etc/web/client.crt", CertFile: "/etc/web/client.crt",
KeyFile: "/etc/web/tls.key", KeyFile: "/etc/web/tls.key",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "api", Name: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
require.Equal(t, expect, got.Services) require.Equal(t, expect, got.Services)
@ -361,12 +361,12 @@ func TestConfig_Apply_IngressGateway(t *testing.T) {
Services: []structs.IngressService{ Services: []structs.IngressService{
{ {
Name: "web", Name: "web",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.Equal(t, expect, got) require.Equal(t, expect, got)
} }

View File

@ -141,7 +141,7 @@ func (id *missingIdentity) IsLocal() bool {
} }
func (id *missingIdentity) EnterpriseMetadata() *structs.EnterpriseMeta { func (id *missingIdentity) EnterpriseMetadata() *structs.EnterpriseMeta {
return structs.DefaultEnterpriseMeta() return structs.DefaultEnterpriseMetaInDefaultPartition()
} }
func minTTL(a time.Duration, b time.Duration) time.Duration { func minTTL(a time.Duration, b time.Duration) time.Duration {
@ -1417,7 +1417,7 @@ func (f *aclFilter) filterNodeServices(services **structs.NodeServices) {
} }
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if !f.allowNode((*services).Node.Node, &authzContext) { if !f.allowNode((*services).Node.Node, &authzContext) {
*services = nil *services = nil
return return
@ -1441,7 +1441,7 @@ func (f *aclFilter) filterNodeServiceList(services **structs.NodeServiceList) {
} }
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if !f.allowNode((*services).Node.Node, &authzContext) { if !f.allowNode((*services).Node.Node, &authzContext) {
*services = nil *services = nil
return return
@ -1538,7 +1538,7 @@ func (f *aclFilter) filterSessions(sessions *structs.Sessions) {
func (f *aclFilter) filterCoordinates(coords *structs.Coordinates) { func (f *aclFilter) filterCoordinates(coords *structs.Coordinates) {
c := *coords c := *coords
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
for i := 0; i < len(c); i++ { for i := 0; i < len(c); i++ {
node := c[i].Node node := c[i].Node
@ -1579,7 +1579,7 @@ func (f *aclFilter) filterNodeDump(dump *structs.NodeDump) {
info := nd[i] info := nd[i]
// Filter nodes // Filter nodes
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if node := info.Node; !f.allowNode(node, &authzContext) { if node := info.Node; !f.allowNode(node, &authzContext) {
f.logger.Debug("dropping node from result due to ACLs", "node", node) f.logger.Debug("dropping node from result due to ACLs", "node", node)
nd = append(nd[:i], nd[i+1:]...) nd = append(nd[:i], nd[i+1:]...)
@ -1647,7 +1647,7 @@ func (f *aclFilter) filterNodes(nodes *structs.Nodes) {
n := *nodes n := *nodes
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
for i := 0; i < len(n); i++ { for i := 0; i < len(n); i++ {
node := n[i].Node node := n[i].Node
@ -1670,7 +1670,7 @@ func (f *aclFilter) filterNodes(nodes *structs.Nodes) {
func (f *aclFilter) redactPreparedQueryTokens(query **structs.PreparedQuery) { func (f *aclFilter) redactPreparedQueryTokens(query **structs.PreparedQuery) {
// Management tokens can see everything with no filtering. // Management tokens can see everything with no filtering.
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.DefaultEnterpriseMeta().FillAuthzContext(&authzContext) structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if f.authorizer.ACLWrite(&authzContext) == acl.Allow { if f.authorizer.ACLWrite(&authzContext) == acl.Allow {
return return
} }
@ -1696,7 +1696,7 @@ func (f *aclFilter) redactPreparedQueryTokens(query **structs.PreparedQuery) {
// if the user doesn't have a management token. // if the user doesn't have a management token.
func (f *aclFilter) filterPreparedQueries(queries *structs.PreparedQueries) { func (f *aclFilter) filterPreparedQueries(queries *structs.PreparedQueries) {
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.DefaultEnterpriseMeta().FillAuthzContext(&authzContext) structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
// Management tokens can see everything with no filtering. // Management tokens can see everything with no filtering.
// TODO is this check even necessary - this looks like a search replace from // TODO is this check even necessary - this looks like a search replace from
// the 1.4 ACL rewrite. The global-management token will provide unrestricted query privileges // the 1.4 ACL rewrite. The global-management token will provide unrestricted query privileges

View File

@ -104,7 +104,7 @@ func (c *Client) ResolveTokenAndDefaultMeta(token string, entMeta *structs.Enter
if identity != nil { if identity != nil {
entMeta.Merge(identity.EnterpriseMetadata()) entMeta.Merge(identity.EnterpriseMetadata())
} else { } else {
entMeta.Merge(structs.DefaultEnterpriseMeta()) entMeta.Merge(structs.DefaultEnterpriseMetaInDefaultPartition())
} }
// Use the meta to fill in the ACL authorization context // Use the meta to fill in the ACL authorization context

View File

@ -244,7 +244,7 @@ func (a *ACL) BootstrapTokens(args *structs.DCSpecificRequest, reply *structs.AC
Local: false, Local: false,
// DEPRECATED (ACL-Legacy-Compat) - This is used so that the bootstrap token is still visible via the v1 acl APIs // DEPRECATED (ACL-Legacy-Compat) - This is used so that the bootstrap token is still visible via the v1 acl APIs
Type: structs.ACLTokenTypeManagement, Type: structs.ACLTokenTypeManagement,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
ResetIndex: specifiedIndex, ResetIndex: specifiedIndex,
} }
@ -256,7 +256,7 @@ func (a *ACL) BootstrapTokens(args *structs.DCSpecificRequest, reply *structs.AC
return err return err
} }
if _, token, err := state.ACLTokenGetByAccessor(nil, accessor, structs.DefaultEnterpriseMeta()); err == nil { if _, token, err := state.ACLTokenGetByAccessor(nil, accessor, structs.DefaultEnterpriseMetaInDefaultPartition()); err == nil {
*reply = *token *reply = *token
} }

View File

@ -4991,7 +4991,7 @@ func TestACLEndpoint_Login_with_MaxTokenTTL(t *testing.T) {
got.SecretID = "" got.SecretID = ""
got.Hash = nil got.Hash = nil
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
expect := &structs.ACLToken{ expect := &structs.ACLToken{
AuthMethod: method.Name, AuthMethod: method.Name,
Description: `token created via login: {"pod":"pod1"}`, Description: `token created via login: {"pod":"pod1"}`,
@ -5102,7 +5102,7 @@ func TestACLEndpoint_Login_with_TokenLocality(t *testing.T) {
got.SecretID = "" got.SecretID = ""
got.Hash = nil got.Hash = nil
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
expect := &structs.ACLToken{ expect := &structs.ACLToken{
AuthMethod: method.Name, AuthMethod: method.Name,
Description: `token created via login: {"pod":"pod1"}`, Description: `token created via login: {"pod":"pod1"}`,

View File

@ -111,7 +111,7 @@ func (s *Server) canUpgradeToNewACLs(isLeader bool) bool {
// Check to see if we already upgraded the last time we ran by seeing if we // Check to see if we already upgraded the last time we ran by seeing if we
// have a copy of any global management policy stored locally. This should // have a copy of any global management policy stored locally. This should
// always be true because policies always replicate. // always be true because policies always replicate.
_, mgmtPolicy, err := s.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMeta()) _, mgmtPolicy, err := s.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
s.logger.Warn("Failed to get the builtin global-management policy to check for a completed ACL upgrade; skipping this optimization", "error", err) s.logger.Warn("Failed to get the builtin global-management policy to check for a completed ACL upgrade; skipping this optimization", "error", err)
} else if mgmtPolicy != nil { } else if mgmtPolicy != nil {
@ -252,7 +252,7 @@ func (s *Server) ResolveTokenIdentityAndDefaultMeta(token string, entMeta *struc
if identity != nil { if identity != nil {
entMeta.Merge(identity.EnterpriseMetadata()) entMeta.Merge(identity.EnterpriseMetadata())
} else { } else {
entMeta.Merge(structs.DefaultEnterpriseMeta()) entMeta.Merge(structs.DefaultEnterpriseMetaInDefaultPartition())
} }
// Use the meta to fill in the ACL authorization context // Use the meta to fill in the ACL authorization context

View File

@ -209,7 +209,7 @@ func (ac *AutoConfig) updateACLsInConfig(opts AutoConfigOptions, resp *pbautocon
Datacenter: ac.config.Datacenter, Datacenter: ac.config.Datacenter,
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
token, err := ac.backend.CreateACLToken(&template) token, err := ac.backend.CreateACLToken(&template)

View File

@ -138,7 +138,7 @@ func TestAutoConfigInitialConfiguration(t *testing.T) {
c.AutoConfigAuthzAuthMethod = structs.ACLAuthMethod{ c.AutoConfigAuthzAuthMethod = structs.ACLAuthMethod{
Name: "Auth Config Authorizer", Name: "Auth Config Authorizer",
Type: "jwt", Type: "jwt",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Config: map[string]interface{}{ Config: map[string]interface{}{
"BoundAudiences": []string{"consul"}, "BoundAudiences": []string{"consul"},
"BoundIssuer": "consul", "BoundIssuer": "consul",
@ -584,7 +584,7 @@ func TestAutoConfig_updateTLSCertificatesInConfig(t *testing.T) {
CertPEM: "not-currently-decoded", CertPEM: "not-currently-decoded",
ValidAfter: now, ValidAfter: now,
ValidBefore: later, ValidBefore: later,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
RaftIndex: structs.RaftIndex{ RaftIndex: structs.RaftIndex{
ModifyIndex: 10, ModifyIndex: 10,
CreateIndex: 10, CreateIndex: 10,
@ -797,7 +797,7 @@ func TestAutoConfig_updateACLsInConfig(t *testing.T) {
Datacenter: testDC, Datacenter: testDC,
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
testToken := &structs.ACLToken{ testToken := &structs.ACLToken{
@ -811,7 +811,7 @@ func TestAutoConfig_updateACLsInConfig(t *testing.T) {
Datacenter: testDC, Datacenter: testDC,
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
if tcase.expectACLToken { if tcase.expectACLToken {

View File

@ -479,7 +479,7 @@ func (c *ConfigEntry) ResolveServiceConfig(args *structs.ServiceConfigRequest, r
cfgMap := make(map[string]interface{}) cfgMap := make(map[string]interface{})
upstreamDefaults.MergeInto(cfgMap) upstreamDefaults.MergeInto(cfgMap)
wildcard := structs.NewServiceID(structs.WildcardSpecifier, structs.WildcardEnterpriseMeta()) wildcard := structs.NewServiceID(structs.WildcardSpecifier, structs.WildcardEnterpriseMetaInDefaultPartition())
usConfigs[wildcard] = cfgMap usConfigs[wildcard] = cfgMap
} }
} }

View File

@ -1020,9 +1020,9 @@ func TestConfigEntry_ResolveServiceConfig_Upstreams(t *testing.T) {
} }
t.Parallel() t.Parallel()
mysql := structs.NewServiceID("mysql", structs.DefaultEnterpriseMeta()) mysql := structs.NewServiceID("mysql", structs.DefaultEnterpriseMetaInDefaultPartition())
cache := structs.NewServiceID("cache", structs.DefaultEnterpriseMeta()) cache := structs.NewServiceID("cache", structs.DefaultEnterpriseMetaInDefaultPartition())
wildcard := structs.NewServiceID(structs.WildcardSpecifier, structs.WildcardEnterpriseMeta()) wildcard := structs.NewServiceID(structs.WildcardSpecifier, structs.WildcardEnterpriseMetaInDefaultPartition())
tt := []struct { tt := []struct {
name string name string
@ -1117,7 +1117,7 @@ func TestConfigEntry_ResolveServiceConfig_Upstreams(t *testing.T) {
{ {
Upstream: structs.ServiceID{ Upstream: structs.ServiceID{
ID: "mysql", ID: "mysql",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Config: map[string]interface{}{ Config: map[string]interface{}{
"protocol": "http", "protocol": "http",

View File

@ -186,7 +186,7 @@ func (s *ConnectCA) Sign(
"we are %s", serviceID.Datacenter, s.srv.config.Datacenter) "we are %s", serviceID.Datacenter, s.srv.config.Datacenter)
} }
} else if isAgent { } else if isAgent {
structs.DefaultEnterpriseMeta().FillAuthzContext(&authzContext) structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if rule != nil && rule.NodeWrite(agentID.Agent, &authzContext) != acl.Allow { if rule != nil && rule.NodeWrite(agentID.Agent, &authzContext) != acl.Allow {
return acl.ErrPermissionDenied return acl.ErrPermissionDenied
} }

View File

@ -144,7 +144,7 @@ func (c *Coordinate) Update(args *structs.CoordinateUpdateRequest, reply *struct
} }
if authz != nil { if authz != nil {
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.DefaultEnterpriseMeta().FillAuthzContext(&authzContext) structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if authz.NodeWrite(args.Node, &authzContext) != acl.Allow { if authz.NodeWrite(args.Node, &authzContext) != acl.Allow {
return acl.ErrPermissionDenied return acl.ErrPermissionDenied
} }
@ -227,7 +227,7 @@ func (c *Coordinate) Node(args *structs.NodeSpecificRequest, reply *structs.Inde
} }
if authz != nil { if authz != nil {
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
if authz.NodeRead(args.Node, &authzContext) != acl.Allow { if authz.NodeRead(args.Node, &authzContext) != acl.Allow {
return acl.ErrPermissionDenied return acl.ErrPermissionDenied
} }

View File

@ -5,5 +5,5 @@ package discoverychain
import "github.com/hashicorp/consul/agent/structs" import "github.com/hashicorp/consul/agent/structs"
func (c *compiler) GetEnterpriseMeta() *structs.EnterpriseMeta { func (c *compiler) GetEnterpriseMeta() *structs.EnterpriseMeta {
return structs.DefaultEnterpriseMeta() return structs.DefaultEnterpriseMetaInDefaultPartition()
} }

View File

@ -47,7 +47,7 @@ func (t *txnResultsFilter) Filter(i int) bool {
result.KV.EnterpriseMeta.FillAuthzContext(&authzContext) result.KV.EnterpriseMeta.FillAuthzContext(&authzContext)
return t.authorizer.KeyRead(result.KV.Key, &authzContext) != acl.Allow return t.authorizer.KeyRead(result.KV.Key, &authzContext) != acl.Allow
case result.Node != nil: case result.Node != nil:
structs.WildcardEnterpriseMeta().FillAuthzContext(&authzContext) structs.WildcardEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
return t.authorizer.NodeRead(result.Node.Node, &authzContext) != acl.Allow return t.authorizer.NodeRead(result.Node.Node, &authzContext) != acl.Allow
case result.Service != nil: case result.Service != nil:
result.Service.EnterpriseMeta.FillAuthzContext(&authzContext) result.Service.EnterpriseMeta.FillAuthzContext(&authzContext)

View File

@ -80,7 +80,7 @@ func TestFSM_RegisterNode(t *testing.T) {
} }
// Verify service registered // Verify service registered
_, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMeta()) _, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -135,7 +135,7 @@ func TestFSM_RegisterNode_Service(t *testing.T) {
} }
// Verify service registered // Verify service registered
_, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMeta()) _, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -144,7 +144,7 @@ func TestFSM_RegisterNode_Service(t *testing.T) {
} }
// Verify check // Verify check
_, checks, err := fsm.state.NodeChecks(nil, "foo", structs.DefaultEnterpriseMeta()) _, checks, err := fsm.state.NodeChecks(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -207,7 +207,7 @@ func TestFSM_DeregisterService(t *testing.T) {
} }
// Verify service not registered // Verify service not registered
_, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMeta()) _, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -270,7 +270,7 @@ func TestFSM_DeregisterCheck(t *testing.T) {
} }
// Verify check not registered // Verify check not registered
_, checks, err := fsm.state.NodeChecks(nil, "foo", structs.DefaultEnterpriseMeta()) _, checks, err := fsm.state.NodeChecks(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -339,7 +339,7 @@ func TestFSM_DeregisterNode(t *testing.T) {
} }
// Verify service not registered // Verify service not registered
_, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMeta()) _, services, err := fsm.state.NodeServices(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -348,7 +348,7 @@ func TestFSM_DeregisterNode(t *testing.T) {
} }
// Verify checks not registered // Verify checks not registered
_, checks, err := fsm.state.NodeChecks(nil, "foo", structs.DefaultEnterpriseMeta()) _, checks, err := fsm.state.NodeChecks(nil, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -1441,7 +1441,7 @@ func TestFSM_ConfigEntry(t *testing.T) {
Config: map[string]interface{}{ Config: map[string]interface{}{
"foo": "bar", "foo": "bar",
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// Create a new request. // Create a new request.
@ -1595,7 +1595,7 @@ func TestFSM_Chunking_Lifecycle(t *testing.T) {
assert.NotNil(node) assert.NotNil(node)
// Verify service registered // Verify service registered
_, services, err := fsm2.state.NodeServices(nil, fmt.Sprintf("foo%d", i), structs.DefaultEnterpriseMeta()) _, services, err := fsm2.state.NodeServices(nil, fmt.Sprintf("foo%d", i), structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(err) require.NoError(err)
require.NotNil(services) require.NotNil(services)
_, ok := services.Services["db"] _, ok := services.Services["db"]

View File

@ -253,7 +253,7 @@ func TestFSM_SnapshotRestore_OSS(t *testing.T) {
}, },
} }
require.NoError(t, fsm.state.EnsureConfigEntry(20, ingress)) require.NoError(t, fsm.state.EnsureConfigEntry(20, ingress))
_, gatewayServices, err := fsm.state.GatewayServices(nil, "ingress", structs.DefaultEnterpriseMeta()) _, gatewayServices, err := fsm.state.GatewayServices(nil, "ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
// Raft Chunking // Raft Chunking
@ -641,7 +641,7 @@ func TestFSM_SnapshotRestore_OSS(t *testing.T) {
require.Equal(t, autopilotConf, restoredConf) require.Equal(t, autopilotConf, restoredConf)
// Verify legacy intentions are restored. // Verify legacy intentions are restored.
_, ixns, err := fsm2.state.LegacyIntentions(nil, structs.WildcardEnterpriseMeta()) _, ixns, err := fsm2.state.LegacyIntentions(nil, structs.WildcardEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Len(t, ixns, 1) require.Len(t, ixns, 1)
require.Equal(t, ixn, ixns[0]) require.Equal(t, ixn, ixns[0])
@ -663,19 +663,19 @@ func TestFSM_SnapshotRestore_OSS(t *testing.T) {
require.Equal(t, caConfig, caConf) require.Equal(t, caConfig, caConf)
// Verify config entries are restored // Verify config entries are restored
_, serviceConfEntry, err := fsm2.state.ConfigEntry(nil, structs.ServiceDefaults, "foo", structs.DefaultEnterpriseMeta()) _, serviceConfEntry, err := fsm2.state.ConfigEntry(nil, structs.ServiceDefaults, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, serviceConfig, serviceConfEntry) require.Equal(t, serviceConfig, serviceConfEntry)
_, proxyConfEntry, err := fsm2.state.ConfigEntry(nil, structs.ProxyDefaults, "global", structs.DefaultEnterpriseMeta()) _, proxyConfEntry, err := fsm2.state.ConfigEntry(nil, structs.ProxyDefaults, "global", structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, proxyConfig, proxyConfEntry) require.Equal(t, proxyConfig, proxyConfEntry)
_, ingressRestored, err := fsm2.state.ConfigEntry(nil, structs.IngressGateway, "ingress", structs.DefaultEnterpriseMeta()) _, ingressRestored, err := fsm2.state.ConfigEntry(nil, structs.IngressGateway, "ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, ingress, ingressRestored) require.Equal(t, ingress, ingressRestored)
_, restoredGatewayServices, err := fsm2.state.GatewayServices(nil, "ingress", structs.DefaultEnterpriseMeta()) _, restoredGatewayServices, err := fsm2.state.GatewayServices(nil, "ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, gatewayServices, restoredGatewayServices) require.Equal(t, gatewayServices, restoredGatewayServices)
@ -704,12 +704,12 @@ func TestFSM_SnapshotRestore_OSS(t *testing.T) {
require.Equal(t, systemMetadataEntry, systemMetadataLoaded[0]) require.Equal(t, systemMetadataEntry, systemMetadataLoaded[0])
// Verify service-intentions is restored // Verify service-intentions is restored
_, serviceIxnEntry, err := fsm2.state.ConfigEntry(nil, structs.ServiceIntentions, "foo", structs.DefaultEnterpriseMeta()) _, serviceIxnEntry, err := fsm2.state.ConfigEntry(nil, structs.ServiceIntentions, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, serviceIxn, serviceIxnEntry) require.Equal(t, serviceIxn, serviceIxnEntry)
// Verify mesh config entry is restored // Verify mesh config entry is restored
_, meshConfigEntry, err := fsm2.state.ConfigEntry(nil, structs.MeshConfig, structs.MeshConfigMesh, structs.DefaultEnterpriseMeta()) _, meshConfigEntry, err := fsm2.state.ConfigEntry(nil, structs.MeshConfig, structs.MeshConfigMesh, structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, meshConfig, meshConfigEntry) require.Equal(t, meshConfig, meshConfigEntry)

View File

@ -377,7 +377,7 @@ func TestIntentionApply_WithoutIDs(t *testing.T) {
waitForLeaderEstablishment(t, s1) waitForLeaderEstablishment(t, s1)
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
// Force "test" to be L7-capable. // Force "test" to be L7-capable.
{ {
@ -413,7 +413,7 @@ func TestIntentionApply_WithoutIDs(t *testing.T) {
opList := func() (*structs.IndexedIntentions, error) { opList := func() (*structs.IndexedIntentions, error) {
req := &structs.IntentionListRequest{ req := &structs.IntentionListRequest{
Datacenter: "dc1", Datacenter: "dc1",
EnterpriseMeta: *structs.WildcardEnterpriseMeta(), EnterpriseMeta: *structs.WildcardEnterpriseMetaInDefaultPartition(),
} }
var resp structs.IndexedIntentions var resp structs.IndexedIntentions
if err := msgpackrpc.CallWithCodec(codec, "Intention.List", req, &resp); err != nil { if err := msgpackrpc.CallWithCodec(codec, "Intention.List", req, &resp); err != nil {

View File

@ -885,7 +885,7 @@ func TestInternal_GatewayServiceDump_Terminating(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Checks: structs.HealthChecks{ Checks: structs.HealthChecks{
{ {
@ -895,7 +895,7 @@ func TestInternal_GatewayServiceDump_Terminating(t *testing.T) {
Status: "passing", Status: "passing",
ServiceID: "db2", ServiceID: "db2",
ServiceName: "db", ServiceName: "db",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
GatewayService: &structs.GatewayService{ GatewayService: &structs.GatewayService{
@ -917,7 +917,7 @@ func TestInternal_GatewayServiceDump_Terminating(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Checks: structs.HealthChecks{ Checks: structs.HealthChecks{
{ {
@ -927,7 +927,7 @@ func TestInternal_GatewayServiceDump_Terminating(t *testing.T) {
Status: "warning", Status: "warning",
ServiceID: "db", ServiceID: "db",
ServiceName: "db", ServiceName: "db",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
GatewayService: &structs.GatewayService{ GatewayService: &structs.GatewayService{
@ -1225,7 +1225,7 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Checks: structs.HealthChecks{ Checks: structs.HealthChecks{
{ {
@ -1235,7 +1235,7 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
Status: "warning", Status: "warning",
ServiceID: "db", ServiceID: "db",
ServiceName: "db", ServiceName: "db",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
GatewayService: &structs.GatewayService{ GatewayService: &structs.GatewayService{
@ -1259,7 +1259,7 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Checks: structs.HealthChecks{ Checks: structs.HealthChecks{
{ {
@ -1269,7 +1269,7 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
Status: "passing", Status: "passing",
ServiceID: "db2", ServiceID: "db2",
ServiceName: "db", ServiceName: "db",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
GatewayService: &structs.GatewayService{ GatewayService: &structs.GatewayService{
@ -1706,10 +1706,10 @@ func TestInternal_ServiceTopology(t *testing.T) {
registerTestTopologyEntries(t, codec, "") registerTestTopologyEntries(t, codec, "")
var ( var (
ingress = structs.NewServiceName("ingress", structs.DefaultEnterpriseMeta()) ingress = structs.NewServiceName("ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
api = structs.NewServiceName("api", structs.DefaultEnterpriseMeta()) api = structs.NewServiceName("api", structs.DefaultEnterpriseMetaInDefaultPartition())
web = structs.NewServiceName("web", structs.DefaultEnterpriseMeta()) web = structs.NewServiceName("web", structs.DefaultEnterpriseMetaInDefaultPartition())
redis = structs.NewServiceName("redis", structs.DefaultEnterpriseMeta()) redis = structs.NewServiceName("redis", structs.DefaultEnterpriseMetaInDefaultPartition())
) )
t.Run("ingress", func(t *testing.T) { t.Run("ingress", func(t *testing.T) {
@ -2027,7 +2027,7 @@ func TestInternal_IntentionUpstreams(t *testing.T) {
require.Len(r, out.Services, 1) require.Len(r, out.Services, 1)
expectUp := structs.ServiceList{ expectUp := structs.ServiceList{
structs.NewServiceName("api", structs.DefaultEnterpriseMeta()), structs.NewServiceName("api", structs.DefaultEnterpriseMetaInDefaultPartition()),
} }
require.Equal(r, expectUp, out.Services) require.Equal(r, expectUp, out.Services)
}) })
@ -2083,7 +2083,7 @@ service_prefix "api" { policy = "read" }
require.Len(r, out.Services, 1) require.Len(r, out.Services, 1)
expectUp := structs.ServiceList{ expectUp := structs.ServiceList{
structs.NewServiceName("api", structs.DefaultEnterpriseMeta()), structs.NewServiceName("api", structs.DefaultEnterpriseMetaInDefaultPartition()),
} }
require.Equal(r, expectUp, out.Services) require.Equal(r, expectUp, out.Services)
}) })

View File

@ -533,7 +533,7 @@ func (s *Server) initializeACLs(ctx context.Context, upgrade bool) error {
s.logger.Info("initializing acls") s.logger.Info("initializing acls")
// Create/Upgrade the builtin global-management policy // Create/Upgrade the builtin global-management policy
_, policy, err := s.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMeta()) _, policy, err := s.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return fmt.Errorf("failed to get the builtin global-management policy") return fmt.Errorf("failed to get the builtin global-management policy")
} }
@ -544,7 +544,7 @@ func (s *Server) initializeACLs(ctx context.Context, upgrade bool) error {
Description: "Builtin Policy that grants unlimited access", Description: "Builtin Policy that grants unlimited access",
Rules: structs.ACLPolicyGlobalManagement, Rules: structs.ACLPolicyGlobalManagement,
Syntax: acl.SyntaxCurrent, Syntax: acl.SyntaxCurrent,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
if policy != nil { if policy != nil {
newPolicy.Name = policy.Name newPolicy.Name = policy.Name
@ -595,7 +595,7 @@ func (s *Server) initializeACLs(ctx context.Context, upgrade bool) error {
// DEPRECATED (ACL-Legacy-Compat) - only needed for compatibility // DEPRECATED (ACL-Legacy-Compat) - only needed for compatibility
Type: structs.ACLTokenTypeManagement, Type: structs.ACLTokenTypeManagement,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
token.SetHash(true) token.SetHash(true)
@ -654,7 +654,7 @@ func (s *Server) initializeACLs(ctx context.Context, upgrade bool) error {
SecretID: anonymousToken, SecretID: anonymousToken,
Description: "Anonymous Token", Description: "Anonymous Token",
CreateTime: time.Now(), CreateTime: time.Now(),
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
token.SetHash(true) token.SetHash(true)
@ -1112,7 +1112,7 @@ func (s *Server) bootstrapConfigEntries(entries []structs.ConfigEntry) error {
// We generate a "reap" event to cause the node to be cleaned up. // We generate a "reap" event to cause the node to be cleaned up.
func (s *Server) reconcileReaped(known map[string]struct{}) error { func (s *Server) reconcileReaped(known map[string]struct{}) error {
state := s.fsm.State() state := s.fsm.State()
_, checks, err := state.ChecksInState(nil, api.HealthAny, structs.DefaultEnterpriseMeta()) _, checks, err := state.ChecksInState(nil, api.HealthAny, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -1128,7 +1128,7 @@ func (s *Server) reconcileReaped(known map[string]struct{}) error {
} }
// Get the node services, look for ConsulServiceID // Get the node services, look for ConsulServiceID
_, services, err := state.NodeServices(nil, check.Node, structs.DefaultEnterpriseMeta()) _, services, err := state.NodeServices(nil, check.Node, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -1270,7 +1270,7 @@ func (s *Server) handleAliveMember(member serf.Member) error {
// Check if the associated service is available // Check if the associated service is available
if service != nil { if service != nil {
match := false match := false
_, services, err := state.NodeServices(nil, member.Name, structs.DefaultEnterpriseMeta()) _, services, err := state.NodeServices(nil, member.Name, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -1288,7 +1288,7 @@ func (s *Server) handleAliveMember(member serf.Member) error {
} }
// Check if the serfCheck is in the passing state // Check if the serfCheck is in the passing state
_, checks, err := state.NodeChecks(nil, member.Name, structs.DefaultEnterpriseMeta()) _, checks, err := state.NodeChecks(nil, member.Name, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -1342,7 +1342,7 @@ func (s *Server) handleFailedMember(member serf.Member) error {
if node.Address == member.Addr.String() { if node.Address == member.Addr.String() {
// Check if the serfCheck is in the critical state // Check if the serfCheck is in the critical state
_, checks, err := state.NodeChecks(nil, member.Name, structs.DefaultEnterpriseMeta()) _, checks, err := state.NodeChecks(nil, member.Name, structs.DefaultEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }

View File

@ -1430,7 +1430,7 @@ func (c *CAManager) SignCertificate(csr *x509.CertificateRequest, spiffeID conne
csr.URIs = uris csr.URIs = uris
} }
entMeta.Merge(structs.DefaultEnterpriseMeta()) entMeta.Merge(structs.DefaultEnterpriseMetaInDefaultPartition())
} }
commonCfg, err := config.GetCommonConfig() commonCfg, err := config.GetCommonConfig()

View File

@ -156,7 +156,7 @@ func (s *Server) fetchFederationStateAntiEntropyDetails(
} }
// Fetch our current list of all mesh gateways. // Fetch our current list of all mesh gateways.
entMeta := structs.WildcardEnterpriseMeta() entMeta := structs.WildcardEnterpriseMetaInDefaultPartition()
idx2, raw, err := state.ServiceDump(ws, structs.ServiceKindMeshGateway, true, entMeta) idx2, raw, err := state.ServiceDump(ws, structs.ServiceKindMeshGateway, true, entMeta)
if err != nil { if err != nil {
return err return err

View File

@ -38,7 +38,7 @@ func (s *Server) startIntentionConfigEntryMigration(ctx context.Context) error {
// datacenter is composed entirely of compatible servers and there are // datacenter is composed entirely of compatible servers and there are
// no more legacy intentions. // no more legacy intentions.
if s.DatacenterSupportsIntentionsAsConfigEntries() { if s.DatacenterSupportsIntentionsAsConfigEntries() {
_, ixns, err := s.fsm.State().LegacyIntentions(nil, structs.WildcardEnterpriseMeta()) _, ixns, err := s.fsm.State().LegacyIntentions(nil, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -88,7 +88,7 @@ func (s *Server) legacyIntentionMigration(ctx context.Context) error {
} }
state := s.fsm.State() state := s.fsm.State()
_, ixns, err := state.LegacyIntentions(nil, structs.WildcardEnterpriseMeta()) _, ixns, err := state.LegacyIntentions(nil, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }

View File

@ -457,7 +457,7 @@ func TestLeader_LegacyIntentionMigration(t *testing.T) {
checkIntentions := func(t *testing.T, srv *Server, legacyOnly bool, expect map[string]*structs.Intention) { checkIntentions := func(t *testing.T, srv *Server, legacyOnly bool, expect map[string]*structs.Intention) {
t.Helper() t.Helper()
wildMeta := structs.WildcardEnterpriseMeta() wildMeta := structs.WildcardEnterpriseMetaInDefaultPartition()
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
var ( var (
got structs.Intentions got structs.Intentions
@ -556,7 +556,7 @@ func TestLeader_LegacyIntentionMigration(t *testing.T) {
} }
// also check config entries // also check config entries
_, gotConfigs, err := s1.fsm.State().ConfigEntriesByKind(nil, structs.ServiceIntentions, structs.WildcardEnterpriseMeta()) _, gotConfigs, err := s1.fsm.State().ConfigEntriesByKind(nil, structs.ServiceIntentions, structs.WildcardEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
gotConfigsM := mapifyConfigs(gotConfigs) gotConfigsM := mapifyConfigs(gotConfigs)

View File

@ -1329,11 +1329,11 @@ func TestLeader_ACLUpgrade_IsStickyEvenIfSerfTagsRegress(t *testing.T) {
// Everybody has the management policy. // Everybody has the management policy.
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
_, policy1, err := s1.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMeta()) _, policy1, err := s1.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(r, err) require.NoError(r, err)
require.NotNil(r, policy1) require.NotNil(r, policy1)
_, policy2, err := s2.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMeta()) _, policy2, err := s2.fsm.State().ACLPolicyGetByID(nil, structs.ACLPolicyGlobalManagementID, structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(r, err) require.NoError(r, err)
require.NotNil(r, policy2) require.NotNil(r, policy2)
}) })
@ -1392,7 +1392,7 @@ func TestLeader_ConfigEntryBootstrap(t *testing.T) {
testrpc.WaitForTestAgent(t, s1.RPC, "dc1") testrpc.WaitForTestAgent(t, s1.RPC, "dc1")
retry.Run(t, func(t *retry.R) { retry.Run(t, func(t *retry.R) {
_, entry, err := s1.fsm.State().ConfigEntry(nil, structs.ProxyDefaults, structs.ProxyConfigGlobal, structs.DefaultEnterpriseMeta()) _, entry, err := s1.fsm.State().ConfigEntry(nil, structs.ProxyDefaults, structs.ProxyConfigGlobal, structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, entry) require.NotNil(t, entry)
global, ok := entry.(*structs.ProxyConfigEntry) global, ok := entry.(*structs.ProxyConfigEntry)
@ -1917,7 +1917,7 @@ func TestDatacenterSupportsIntentionsAsConfigEntries(t *testing.T) {
tags["ft_si"] = "0" tags["ft_si"] = "0"
} }
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
t.Run("one node primary with old version", func(t *testing.T) { t.Run("one node primary with old version", func(t *testing.T) {
dir1, s1 := testServerWithConfig(t, func(c *Config) { dir1, s1 := testServerWithConfig(t, func(c *Config) {

View File

@ -26,7 +26,7 @@ func TestWalk_ServiceQuery(t *testing.T) {
Near: "_agent", Near: "_agent",
Tags: []string{"tag1", "tag2", "tag3"}, Tags: []string{"tag1", "tag2", "tag3"},
NodeMeta: map[string]string{"foo": "bar", "role": "server"}, NodeMeta: map[string]string{"foo": "bar", "role": "server"},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
if err := walk(service, fn); err != nil { if err := walk(service, fn); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)

View File

@ -1493,7 +1493,7 @@ func TestServer_ReloadConfig(t *testing.T) {
} }
require.NoError(t, s.ReloadConfig(rc)) require.NoError(t, s.ReloadConfig(rc))
_, entry, err := s.fsm.State().ConfigEntry(nil, structs.ProxyDefaults, structs.ProxyConfigGlobal, structs.DefaultEnterpriseMeta()) _, entry, err := s.fsm.State().ConfigEntry(nil, structs.ProxyDefaults, structs.ProxyConfigGlobal, structs.DefaultEnterpriseMetaInDefaultPartition())
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, entry) require.NotNil(t, entry)
global, ok := entry.(*structs.ProxyConfigEntry) global, ok := entry.(*structs.ProxyConfigEntry)

View File

@ -46,7 +46,7 @@ func (s *Server) initializeSessionTimers() error {
// Scan all sessions and reset their timer // Scan all sessions and reset their timer
state := s.fsm.State() state := s.fsm.State()
_, sessions, err := state.SessionList(nil, structs.WildcardEnterpriseMeta()) _, sessions, err := state.SessionList(nil, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }

View File

@ -1013,7 +1013,7 @@ func aclTokenDeleteTxn(tx WriteTxn, idx uint64, value, index string, entMeta *st
func aclTokenDeleteAllForAuthMethodTxn(tx WriteTxn, idx uint64, methodName string, methodGlobalLocality bool, methodMeta *structs.EnterpriseMeta) error { func aclTokenDeleteAllForAuthMethodTxn(tx WriteTxn, idx uint64, methodName string, methodGlobalLocality bool, methodMeta *structs.EnterpriseMeta) error {
// collect all the tokens linked with the given auth method. // collect all the tokens linked with the given auth method.
iter, err := aclTokenListByAuthMethod(tx, methodName, methodMeta, structs.WildcardEnterpriseMeta()) iter, err := aclTokenListByAuthMethod(tx, methodName, methodMeta, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return fmt.Errorf("failed acl token lookup: %v", err) return fmt.Errorf("failed acl token lookup: %v", err)
} }
@ -1143,7 +1143,7 @@ func (s *Store) ACLPolicyGetByName(ws memdb.WatchSet, name string, entMeta *stru
func aclPolicyGetByName(tx ReadTxn, name string, entMeta *structs.EnterpriseMeta) (<-chan struct{}, interface{}, error) { func aclPolicyGetByName(tx ReadTxn, name string, entMeta *structs.EnterpriseMeta) (<-chan struct{}, interface{}, error) {
// todo: accept non-pointer value // todo: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: name, EnterpriseMeta: *entMeta} q := Query{Value: name, EnterpriseMeta: *entMeta}
return tx.FirstWatch(tableACLPolicies, indexName, q) return tx.FirstWatch(tableACLPolicies, indexName, q)
@ -1376,7 +1376,7 @@ func (s *Store) ACLRoleGetByName(ws memdb.WatchSet, name string, entMeta *struct
func aclRoleGetByName(tx ReadTxn, name string, entMeta *structs.EnterpriseMeta) (<-chan struct{}, interface{}, error) { func aclRoleGetByName(tx ReadTxn, name string, entMeta *structs.EnterpriseMeta) (<-chan struct{}, interface{}, error) {
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{EnterpriseMeta: *entMeta, Value: name} q := Query{EnterpriseMeta: *entMeta, Value: name}
return tx.FirstWatch(tableACLRoles, indexName, q) return tx.FirstWatch(tableACLRoles, indexName, q)
@ -1445,7 +1445,7 @@ func (s *Store) ACLRoleList(ws memdb.WatchSet, policy string, entMeta *structs.E
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
if policy != "" { if policy != "" {

View File

@ -2844,7 +2844,7 @@ func TestStateStore_ACLAuthMethod_GlobalNameShadowing_TokenTest(t *testing.T) {
// we'll create our auth method here that shadows the global-token-minting // we'll create our auth method here that shadows the global-token-minting
// one in the primary. // one in the primary.
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
lastIndex++ lastIndex++
require.NoError(t, s.ACLAuthMethodSet(lastIndex, &structs.ACLAuthMethod{ require.NoError(t, s.ACLAuthMethodSet(lastIndex, &structs.ACLAuthMethod{

View File

@ -187,7 +187,7 @@ func ensureNoNodeWithSimilarNameTxn(tx ReadTxn, node *structs.Node, allowClashWi
if strings.EqualFold(node.Node, enode.Node) && node.ID != enode.ID { if strings.EqualFold(node.Node, enode.Node) && node.ID != enode.ID {
// Look up the existing node's Serf health check to see if it's failed. // Look up the existing node's Serf health check to see if it's failed.
// If it is, the node can be renamed. // If it is, the node can be renamed.
enodeCheck, err := tx.First(tableChecks, indexID, NodeCheckQuery{EnterpriseMeta: *structs.DefaultEnterpriseMeta(), Node: enode.Node, CheckID: string(structs.SerfCheckID)}) enodeCheck, err := tx.First(tableChecks, indexID, NodeCheckQuery{EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(), Node: enode.Node, CheckID: string(structs.SerfCheckID)})
if err != nil { if err != nil {
return fmt.Errorf("Cannot get status of node %s: %s", enode.Node, err) return fmt.Errorf("Cannot get status of node %s: %s", enode.Node, err)
} }
@ -902,7 +902,7 @@ func (s *Store) ConnectServiceNodes(ws memdb.WatchSet, serviceName string, entMe
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: serviceName, EnterpriseMeta: *entMeta} q := Query{Value: serviceName, EnterpriseMeta: *entMeta}
return serviceNodesTxn(tx, ws, indexConnect, q) return serviceNodesTxn(tx, ws, indexConnect, q)
@ -915,7 +915,7 @@ func (s *Store) ServiceNodes(ws memdb.WatchSet, serviceName string, entMeta *str
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: serviceName, EnterpriseMeta: *entMeta} q := Query{Value: serviceName, EnterpriseMeta: *entMeta}
return serviceNodesTxn(tx, ws, indexService, q) return serviceNodesTxn(tx, ws, indexService, q)
@ -989,7 +989,7 @@ func (s *Store) ServiceTagNodes(ws memdb.WatchSet, service string, tags []string
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: service, EnterpriseMeta: *entMeta} q := Query{Value: service, EnterpriseMeta: *entMeta}
@ -1150,7 +1150,7 @@ func (s *Store) NodeService(nodeName string, serviceID string, entMeta *structs.
func getNodeServiceTxn(tx ReadTxn, nodeName, serviceID string, entMeta *structs.EnterpriseMeta) (*structs.NodeService, error) { func getNodeServiceTxn(tx ReadTxn, nodeName, serviceID string, entMeta *structs.EnterpriseMeta) (*structs.NodeService, error) {
// TODO: pass non-pointer type for ent meta // TODO: pass non-pointer type for ent meta
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// Query the service // Query the service
@ -1324,7 +1324,7 @@ func (s *Store) deleteServiceCASTxn(tx WriteTxn, idx, cidx uint64, nodeName, ser
func (s *Store) deleteServiceTxn(tx WriteTxn, idx uint64, nodeName, serviceID string, entMeta *structs.EnterpriseMeta) error { func (s *Store) deleteServiceTxn(tx WriteTxn, idx uint64, nodeName, serviceID string, entMeta *structs.EnterpriseMeta) error {
// TODO: pass non-pointer type for ent meta // TODO: pass non-pointer type for ent meta
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
service, err := tx.First(tableServices, indexID, NodeServiceQuery{EnterpriseMeta: *entMeta, Node: nodeName, Service: serviceID}) service, err := tx.First(tableServices, indexID, NodeServiceQuery{EnterpriseMeta: *entMeta, Node: nodeName, Service: serviceID})
@ -1337,7 +1337,7 @@ func (s *Store) deleteServiceTxn(tx WriteTxn, idx uint64, nodeName, serviceID st
// TODO: accept a non-pointer value for EnterpriseMeta // TODO: accept a non-pointer value for EnterpriseMeta
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// Delete any checks associated with the service. This will invalidate // Delete any checks associated with the service. This will invalidate
// sessions as necessary. // sessions as necessary.
@ -1586,7 +1586,7 @@ func getNodeCheckTxn(tx ReadTxn, nodeName string, checkID types.CheckID, entMeta
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// Return the check. // Return the check.
@ -1608,7 +1608,7 @@ func (s *Store) NodeChecks(ws memdb.WatchSet, nodeName string, entMeta *structs.
defer tx.Abort() defer tx.Abort()
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// Get the table index. // Get the table index.
@ -1639,7 +1639,7 @@ func (s *Store) ServiceChecks(ws memdb.WatchSet, serviceName string, entMeta *st
idx := catalogChecksMaxIndex(tx, entMeta) idx := catalogChecksMaxIndex(tx, entMeta)
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: serviceName, EnterpriseMeta: *entMeta} q := Query{Value: serviceName, EnterpriseMeta: *entMeta}
iter, err := tx.Get(tableChecks, indexService, q) iter, err := tx.Get(tableChecks, indexService, q)
@ -1668,7 +1668,7 @@ func (s *Store) ServiceChecksByNodeMeta(ws memdb.WatchSet, serviceName string,
idx := maxIndexForService(tx, serviceName, true, true, entMeta) idx := maxIndexForService(tx, serviceName, true, true, entMeta)
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: serviceName, EnterpriseMeta: *entMeta} q := Query{Value: serviceName, EnterpriseMeta: *entMeta}
iter, err := tx.Get(tableChecks, indexService, q) iter, err := tx.Get(tableChecks, indexService, q)
@ -1717,7 +1717,7 @@ func checksInStateTxn(tx ReadTxn, ws memdb.WatchSet, state string, entMeta *stru
idx := catalogChecksMaxIndex(tx, entMeta) idx := catalogChecksMaxIndex(tx, entMeta)
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// Query all checks if HealthAny is passed, otherwise use the index. // Query all checks if HealthAny is passed, otherwise use the index.
@ -1830,7 +1830,7 @@ func (q NodeServiceQuery) NamespaceOrDefault() string {
// check deletion within an existing transaction. // check deletion within an existing transaction.
func (s *Store) deleteCheckTxn(tx WriteTxn, idx uint64, node string, checkID types.CheckID, entMeta *structs.EnterpriseMeta) error { func (s *Store) deleteCheckTxn(tx WriteTxn, idx uint64, node string, checkID types.CheckID, entMeta *structs.EnterpriseMeta) error {
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// Try to retrieve the existing health check. // Try to retrieve the existing health check.
@ -1984,7 +1984,7 @@ func checkServiceNodesTxn(tx ReadTxn, ws memdb.WatchSet, serviceName string, con
// TODO: accept non-pointer // TODO: accept non-pointer
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: serviceName, EnterpriseMeta: *entMeta} q := Query{Value: serviceName, EnterpriseMeta: *entMeta}
@ -2113,7 +2113,7 @@ func (s *Store) CheckServiceTagNodes(ws memdb.WatchSet, serviceName string, tags
// TODO: accept non-pointer value // TODO: accept non-pointer value
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: serviceName, EnterpriseMeta: *entMeta} q := Query{Value: serviceName, EnterpriseMeta: *entMeta}
@ -2214,7 +2214,7 @@ func parseCheckServiceNodes(
// First add the node-level checks. These always apply to any // First add the node-level checks. These always apply to any
// service on the node. // service on the node.
var checks structs.HealthChecks var checks structs.HealthChecks
q := NodeServiceQuery{Node: sn.Node, EnterpriseMeta: *structs.DefaultEnterpriseMeta()} q := NodeServiceQuery{Node: sn.Node, EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition()}
iter, err := tx.Get(tableChecks, indexNodeService, q) iter, err := tx.Get(tableChecks, indexNodeService, q)
if err != nil { if err != nil {
return 0, nil, err return 0, nil, err
@ -2319,7 +2319,7 @@ func serviceDumpKindTxn(tx ReadTxn, ws memdb.WatchSet, kind structs.ServiceKind,
idx := catalogServiceKindMaxIndex(tx, ws, kind, entMeta) idx := catalogServiceKindMaxIndex(tx, ws, kind, entMeta)
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: string(kind), EnterpriseMeta: *entMeta} q := Query{Value: string(kind), EnterpriseMeta: *entMeta}
services, err := tx.Get(tableServices, indexKind, q) services, err := tx.Get(tableServices, indexKind, q)
@ -2343,7 +2343,7 @@ func parseNodes(tx ReadTxn, ws memdb.WatchSet, idx uint64,
iter memdb.ResultIterator, entMeta *structs.EnterpriseMeta) (uint64, structs.NodeDump, error) { iter memdb.ResultIterator, entMeta *structs.EnterpriseMeta) (uint64, structs.NodeDump, error) {
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
// We don't want to track an unlimited number of services, so we pull a // We don't want to track an unlimited number of services, so we pull a
@ -2566,7 +2566,7 @@ func terminatingConfigGatewayServices(
// updateGatewayNamespace is used to target all services within a namespace // updateGatewayNamespace is used to target all services within a namespace
func updateGatewayNamespace(tx WriteTxn, idx uint64, service *structs.GatewayService, entMeta *structs.EnterpriseMeta) error { func updateGatewayNamespace(tx WriteTxn, idx uint64, service *structs.GatewayService, entMeta *structs.EnterpriseMeta) error {
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: string(structs.ServiceKindTypical), EnterpriseMeta: *entMeta} q := Query{Value: string(structs.ServiceKindTypical), EnterpriseMeta: *entMeta}
services, err := tx.Get(tableServices, indexKind, q) services, err := tx.Get(tableServices, indexKind, q)
@ -2890,7 +2890,7 @@ func (s *Store) ServiceTopology(
// Fetch connect endpoints for the target service in order to learn if its proxies are configured as // Fetch connect endpoints for the target service in order to learn if its proxies are configured as
// transparent proxies. // transparent proxies.
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
q := Query{Value: service, EnterpriseMeta: *entMeta} q := Query{Value: service, EnterpriseMeta: *entMeta}
@ -3250,7 +3250,7 @@ func updateMeshTopology(tx WriteTxn, idx uint64, node string, svc *structs.NodeS
oldUpstreams := make(map[structs.ServiceName]bool) oldUpstreams := make(map[structs.ServiceName]bool)
if e, ok := existing.(*structs.ServiceNode); ok { if e, ok := existing.(*structs.ServiceNode); ok {
for _, u := range e.ServiceProxy.Upstreams { for _, u := range e.ServiceProxy.Upstreams {
upstreamMeta := structs.NewEnterpriseMeta(u.DestinationNamespace) upstreamMeta := structs.NewEnterpriseMetaInDefaultPartition(u.DestinationNamespace)
sn := structs.NewServiceName(u.DestinationName, &upstreamMeta) sn := structs.NewServiceName(u.DestinationName, &upstreamMeta)
oldUpstreams[sn] = true oldUpstreams[sn] = true
@ -3266,7 +3266,7 @@ func updateMeshTopology(tx WriteTxn, idx uint64, node string, svc *structs.NodeS
} }
// TODO (freddy): Account for upstream datacenter // TODO (freddy): Account for upstream datacenter
upstreamMeta := structs.NewEnterpriseMeta(u.DestinationNamespace) upstreamMeta := structs.NewEnterpriseMetaInDefaultPartition(u.DestinationNamespace)
upstream := structs.NewServiceName(u.DestinationName, &upstreamMeta) upstream := structs.NewServiceName(u.DestinationName, &upstreamMeta)
obj, err := tx.First(tableMeshTopology, indexID, upstream, downstream) obj, err := tx.First(tableMeshTopology, indexID, upstream, downstream)

View File

@ -60,7 +60,7 @@ func serviceHealthSnapshot(db ReadDB, topic stream.Topic) stream.SnapshotFunc {
defer tx.Abort() defer tx.Abort()
connect := topic == topicServiceHealthConnect connect := topic == topicServiceHealthConnect
entMeta := structs.NewEnterpriseMeta(req.Namespace) entMeta := structs.NewEnterpriseMetaInDefaultPartition(req.Namespace)
idx, nodes, err := checkServiceNodesTxn(tx, nil, req.Key, connect, &entMeta) idx, nodes, err := checkServiceNodesTxn(tx, nil, req.Key, connect, &entMeta)
if err != nil { if err != nil {
return 0, err return 0, err

View File

@ -91,10 +91,10 @@ func TestServiceHealthSnapshot_ConnectTopic(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "web", Name: "web",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err = store.EnsureConfigEntry(counter.Next(), configEntry) err = store.EnsureConfigEntry(counter.Next(), configEntry)
require.NoError(t, err) require.NoError(t, err)
@ -1053,10 +1053,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return ensureConfigEntryTxn(tx, tx.Index, configEntry) return ensureConfigEntryTxn(tx, tx.Index, configEntry)
}, },
@ -1071,14 +1071,14 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return ensureConfigEntryTxn(tx, tx.Index, configEntry) return ensureConfigEntryTxn(tx, tx.Index, configEntry)
}, },
@ -1130,14 +1130,14 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1191,14 +1191,14 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return ensureConfigEntryTxn(tx, tx.Index, configEntry) return ensureConfigEntryTxn(tx, tx.Index, configEntry)
}, },
@ -1224,10 +1224,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1243,14 +1243,14 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return ensureConfigEntryTxn(tx, tx.Index, configEntry) return ensureConfigEntryTxn(tx, tx.Index, configEntry)
}, },
@ -1271,14 +1271,14 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1294,10 +1294,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return ensureConfigEntryTxn(tx, tx.Index, configEntry) return ensureConfigEntryTxn(tx, tx.Index, configEntry)
}, },
@ -1317,10 +1317,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1337,10 +1337,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
{ {
Name: "srv1", Name: "srv1",
CAFile: "foo.crt", CAFile: "foo.crt",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return ensureConfigEntryTxn(tx, tx.Index, configEntry) return ensureConfigEntryTxn(tx, tx.Index, configEntry)
}, },
@ -1365,10 +1365,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1384,7 +1384,7 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
testServiceRegistration(t, "tgate1", regTerminatingGateway, regNode2), false) testServiceRegistration(t, "tgate1", regTerminatingGateway, regNode2), false)
}, },
Mutate: func(s *Store, tx *txn) error { Mutate: func(s *Store, tx *txn) error {
return deleteConfigEntryTxn(tx, tx.Index, structs.TerminatingGateway, "tgate1", structs.DefaultEnterpriseMeta()) return deleteConfigEntryTxn(tx, tx.Index, structs.TerminatingGateway, "tgate1", structs.DefaultEnterpriseMetaInDefaultPartition())
}, },
WantEvents: []stream.Event{ WantEvents: []stream.Event{
testServiceHealthDeregistrationEvent(t, testServiceHealthDeregistrationEvent(t,
@ -1407,10 +1407,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1435,10 +1435,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1467,10 +1467,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1482,10 +1482,10 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err = ensureConfigEntryTxn(tx, tx.Index, configEntry) err = ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1537,14 +1537,14 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
Services: []structs.LinkedService{ Services: []structs.LinkedService{
{ {
Name: "srv1", Name: "srv1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "srv2", Name: "srv2",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
err := ensureConfigEntryTxn(tx, tx.Index, configEntry) err := ensureConfigEntryTxn(tx, tx.Index, configEntry)
if err != nil { if err != nil {
@ -1554,7 +1554,7 @@ func TestServiceHealthEventsFromChanges(t *testing.T) {
testServiceRegistration(t, "tgate1", regTerminatingGateway), false) testServiceRegistration(t, "tgate1", regTerminatingGateway), false)
}, },
Mutate: func(s *Store, tx *txn) error { Mutate: func(s *Store, tx *txn) error {
return s.deleteServiceTxn(tx, tx.Index, "node1", "tgate1", structs.DefaultEnterpriseMeta()) return s.deleteServiceTxn(tx, tx.Index, "node1", "tgate1", structs.DefaultEnterpriseMetaInDefaultPartition())
}, },
WantEvents: []stream.Event{ WantEvents: []stream.Event{
testServiceHealthDeregistrationEvent(t, testServiceHealthDeregistrationEvent(t,
@ -2185,7 +2185,7 @@ func newTestEventServiceHealthRegister(index uint64, nodeNum int, svc string) st
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Checks: []*structs.HealthCheck{ Checks: []*structs.HealthCheck{
{ {
@ -2197,7 +2197,7 @@ func newTestEventServiceHealthRegister(index uint64, nodeNum int, svc string) st
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Node: node, Node: node,
@ -2211,7 +2211,7 @@ func newTestEventServiceHealthRegister(index uint64, nodeNum int, svc string) st
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2253,7 +2253,7 @@ func newTestEventServiceHealthDeregister(index uint64, nodeNum int, svc string)
CreateIndex: 10, CreateIndex: 10,
ModifyIndex: 10, ModifyIndex: 10,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2365,7 +2365,7 @@ func newPayloadCheckServiceNode(service, namespace string) EventPayloadCheckServ
Value: &structs.CheckServiceNode{ Value: &structs.CheckServiceNode{
Service: &structs.NodeService{ Service: &structs.NodeService{
Service: service, Service: service,
EnterpriseMeta: structs.NewEnterpriseMeta(namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(namespace),
}, },
}, },
} }
@ -2377,7 +2377,7 @@ func newPayloadCheckServiceNodeWithOverride(
Value: &structs.CheckServiceNode{ Value: &structs.CheckServiceNode{
Service: &structs.NodeService{ Service: &structs.NodeService{
Service: service, Service: service,
EnterpriseMeta: structs.NewEnterpriseMeta(namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(namespace),
}, },
}, },
overrideKey: overrideKey, overrideKey: overrideKey,

View File

@ -230,7 +230,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
Tags: []string{"primary"}, Tags: []string{"primary"},
Weights: &structs.Weights{Passing: 1, Warning: 1}, Weights: &structs.Weights{Passing: 1, Warning: 1},
RaftIndex: structs.RaftIndex{CreateIndex: 2, ModifyIndex: 2}, RaftIndex: structs.RaftIndex{CreateIndex: 2, ModifyIndex: 2},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
@ -268,7 +268,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
Name: "check", Name: "check",
Status: "critical", Status: "critical",
RaftIndex: structs.RaftIndex{CreateIndex: 3, ModifyIndex: 3}, RaftIndex: structs.RaftIndex{CreateIndex: 3, ModifyIndex: 3},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
@ -313,7 +313,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
Name: "check", Name: "check",
Status: "critical", Status: "critical",
RaftIndex: structs.RaftIndex{CreateIndex: 3, ModifyIndex: 3}, RaftIndex: structs.RaftIndex{CreateIndex: 3, ModifyIndex: 3},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
&structs.HealthCheck{ &structs.HealthCheck{
Node: "node1", Node: "node1",
@ -324,7 +324,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
ServiceName: "redis", ServiceName: "redis",
ServiceTags: []string{"primary"}, ServiceTags: []string{"primary"},
RaftIndex: structs.RaftIndex{CreateIndex: 4, ModifyIndex: 4}, RaftIndex: structs.RaftIndex{CreateIndex: 4, ModifyIndex: 4},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
@ -357,7 +357,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
Node: "nope", Node: "nope",
CheckID: "check2", CheckID: "check2",
Name: "check", Name: "check",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
err = s.EnsureRegistration(6, req) err = s.EnsureRegistration(6, req)
@ -1395,7 +1395,7 @@ func TestStateStore_EnsureService(t *testing.T) {
Address: "1.1.1.1", Address: "1.1.1.1",
Port: 1111, Port: 1111,
Weights: &structs.Weights{Passing: 1, Warning: 0}, Weights: &structs.Weights{Passing: 1, Warning: 0},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// Creating a service without a node returns an error. // Creating a service without a node returns an error.
@ -1531,7 +1531,7 @@ func TestStateStore_EnsureService_connectProxy(t *testing.T) {
Warning: 1, Warning: 1,
}, },
Proxy: structs.ConnectProxyConfig{DestinationServiceName: "foo"}, Proxy: structs.ConnectProxyConfig{DestinationServiceName: "foo"},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// Service successfully registers into the state store. // Service successfully registers into the state store.
@ -2259,7 +2259,7 @@ func TestStateStore_Service_Snapshot(t *testing.T) {
Address: "1.1.1.1", Address: "1.1.1.1",
Port: 1111, Port: 1111,
Weights: &structs.Weights{Passing: 1, Warning: 0}, Weights: &structs.Weights{Passing: 1, Warning: 0},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
ID: "service2", ID: "service2",
@ -2268,7 +2268,7 @@ func TestStateStore_Service_Snapshot(t *testing.T) {
Address: "1.1.1.2", Address: "1.1.1.2",
Port: 1112, Port: 1112,
Weights: &structs.Weights{Passing: 1, Warning: 1}, Weights: &structs.Weights{Passing: 1, Warning: 1},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
for i, svc := range ns { for i, svc := range ns {
@ -4248,7 +4248,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 6, CreateIndex: 6,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
&structs.HealthCheck{ &structs.HealthCheck{
Node: "node1", Node: "node1",
@ -4260,7 +4260,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 8, CreateIndex: 8,
ModifyIndex: 8, ModifyIndex: 8,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
Services: []*structs.NodeService{ Services: []*structs.NodeService{
@ -4275,7 +4275,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 2, CreateIndex: 2,
ModifyIndex: 2, ModifyIndex: 2,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
ID: "service2", ID: "service2",
@ -4288,7 +4288,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 3, CreateIndex: 3,
ModifyIndex: 3, ModifyIndex: 3,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -4305,7 +4305,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 7, CreateIndex: 7,
ModifyIndex: 7, ModifyIndex: 7,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
&structs.HealthCheck{ &structs.HealthCheck{
Node: "node2", Node: "node2",
@ -4317,7 +4317,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 9, CreateIndex: 9,
ModifyIndex: 9, ModifyIndex: 9,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
Services: []*structs.NodeService{ Services: []*structs.NodeService{
@ -4332,7 +4332,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 4, CreateIndex: 4,
ModifyIndex: 4, ModifyIndex: 4,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
ID: "service2", ID: "service2",
@ -4345,7 +4345,7 @@ func TestStateStore_NodeInfo_NodeDump(t *testing.T) {
CreateIndex: 5, CreateIndex: 5,
ModifyIndex: 5, ModifyIndex: 5,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -6151,7 +6151,7 @@ func TestCatalog_catalogDownstreams_Watches(t *testing.T) {
Node: "foo", Node: "foo",
})) }))
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
admin := structs.NewServiceName("admin", defaultMeta) admin := structs.NewServiceName("admin", defaultMeta)
cache := structs.NewServiceName("cache", defaultMeta) cache := structs.NewServiceName("cache", defaultMeta)
@ -6261,7 +6261,7 @@ func TestCatalog_catalogDownstreams_Watches(t *testing.T) {
} }
func TestCatalog_catalogDownstreams(t *testing.T) { func TestCatalog_catalogDownstreams(t *testing.T) {
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
type expect struct { type expect struct {
idx uint64 idx uint64
@ -6377,7 +6377,7 @@ func TestCatalog_catalogDownstreams(t *testing.T) {
} }
tx := s.db.ReadTxn() tx := s.db.ReadTxn()
idx, names, err := downstreamsFromRegistrationTxn(tx, ws, structs.NewServiceName("admin", structs.DefaultEnterpriseMeta())) idx, names, err := downstreamsFromRegistrationTxn(tx, ws, structs.NewServiceName("admin", structs.DefaultEnterpriseMetaInDefaultPartition()))
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, tc.expect.idx, idx) require.Equal(t, tc.expect.idx, idx)
@ -6387,7 +6387,7 @@ func TestCatalog_catalogDownstreams(t *testing.T) {
} }
func TestCatalog_upstreamsFromRegistration(t *testing.T) { func TestCatalog_upstreamsFromRegistration(t *testing.T) {
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
type expect struct { type expect struct {
idx uint64 idx uint64
@ -6552,7 +6552,7 @@ func TestCatalog_upstreamsFromRegistration(t *testing.T) {
} }
tx := s.db.ReadTxn() tx := s.db.ReadTxn()
idx, names, err := upstreamsFromRegistrationTxn(tx, ws, structs.NewServiceName("api", structs.DefaultEnterpriseMeta())) idx, names, err := upstreamsFromRegistrationTxn(tx, ws, structs.NewServiceName("api", structs.DefaultEnterpriseMetaInDefaultPartition()))
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, tc.expect.idx, idx) require.Equal(t, tc.expect.idx, idx)
@ -6574,7 +6574,7 @@ func TestCatalog_upstreamsFromRegistration_Watches(t *testing.T) {
Node: "foo", Node: "foo",
})) }))
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
web := structs.NewServiceName("web", defaultMeta) web := structs.NewServiceName("web", defaultMeta)
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
@ -6739,7 +6739,7 @@ func TestCatalog_topologyCleanupPanic(t *testing.T) {
Node: "foo", Node: "foo",
})) }))
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
web := structs.NewServiceName("web", defaultMeta) web := structs.NewServiceName("web", defaultMeta)
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
@ -6816,7 +6816,7 @@ func TestCatalog_upstreamsFromRegistration_Ingress(t *testing.T) {
}, },
})) }))
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
ingress := structs.NewServiceName("ingress", defaultMeta) ingress := structs.NewServiceName("ingress", defaultMeta)
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
@ -7023,7 +7023,7 @@ func TestCatalog_cleanupGatewayWildcards_panic(t *testing.T) {
}, },
})) }))
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
// Register two different gateways that target services via wildcard // Register two different gateways that target services via wildcard
require.NoError(t, s.EnsureConfigEntry(2, &structs.TerminatingGatewayConfigEntry{ require.NoError(t, s.EnsureConfigEntry(2, &structs.TerminatingGatewayConfigEntry{
@ -7078,7 +7078,7 @@ func TestCatalog_cleanupGatewayWildcards_panic(t *testing.T) {
} }
func TestCatalog_DownstreamsForService(t *testing.T) { func TestCatalog_DownstreamsForService(t *testing.T) {
defaultMeta := structs.DefaultEnterpriseMeta() defaultMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
type expect struct { type expect struct {
idx uint64 idx uint64
@ -7203,7 +7203,7 @@ func TestCatalog_DownstreamsForService(t *testing.T) {
defer tx.Abort() defer tx.Abort()
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
sn := structs.NewServiceName("admin", structs.DefaultEnterpriseMeta()) sn := structs.NewServiceName("admin", structs.DefaultEnterpriseMetaInDefaultPartition())
idx, names, err := s.downstreamsForServiceTxn(tx, ws, "dc1", sn) idx, names, err := s.downstreamsForServiceTxn(tx, ws, "dc1", sn)
require.NoError(t, err) require.NoError(t, err)
@ -7215,7 +7215,7 @@ func TestCatalog_DownstreamsForService(t *testing.T) {
func TestCatalog_DownstreamsForService_Updates(t *testing.T) { func TestCatalog_DownstreamsForService_Updates(t *testing.T) {
var ( var (
defaultMeta = structs.DefaultEnterpriseMeta() defaultMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
target = structs.NewServiceName("admin", defaultMeta) target = structs.NewServiceName("admin", defaultMeta)
) )
@ -7509,7 +7509,7 @@ func TestProtocolForIngressGateway(t *testing.T) {
defer tx.Abort() defer tx.Abort()
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
sn := structs.NewServiceName("ingress", structs.DefaultEnterpriseMeta()) sn := structs.NewServiceName("ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
idx, protocol, err := metricsProtocolForIngressGateway(tx, ws, sn) idx, protocol, err := metricsProtocolForIngressGateway(tx, ws, sn)
require.NoError(t, err) require.NoError(t, err)

View File

@ -401,7 +401,7 @@ func (s *Store) discoveryChainTargetsTxn(tx ReadTxn, ws memdb.WatchSet, dc, serv
var resp []structs.ServiceName var resp []structs.ServiceName
for _, t := range chain.Targets { for _, t := range chain.Targets {
em := structs.NewEnterpriseMeta(t.Namespace) em := structs.NewEnterpriseMetaInDefaultPartition(t.Namespace)
target := structs.NewServiceName(t.Service, &em) target := structs.NewServiceName(t.Service, &em)
// TODO (freddy): Allow upstream DC and encode in response // TODO (freddy): Allow upstream DC and encode in response
@ -457,7 +457,7 @@ func (s *Store) discoveryChainSourcesTxn(tx ReadTxn, ws memdb.WatchSet, dc strin
} }
for _, t := range chain.Targets { for _, t := range chain.Targets {
em := structs.NewEnterpriseMeta(t.Namespace) em := structs.NewEnterpriseMetaInDefaultPartition(t.Namespace)
candidate := structs.NewServiceName(t.Service, &em) candidate := structs.NewServiceName(t.Service, &em)
if !candidate.Matches(destination) { if !candidate.Matches(destination) {
@ -495,7 +495,7 @@ func validateProposedConfigEntryInServiceGraph(
// somehow omit the ones that have a default protocol configured. // somehow omit the ones that have a default protocol configured.
for _, kind := range serviceGraphKinds { for _, kind := range serviceGraphKinds {
_, entries, err := configEntriesByKindTxn(tx, nil, kind, structs.WildcardEnterpriseMeta()) _, entries, err := configEntriesByKindTxn(tx, nil, kind, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -504,7 +504,7 @@ func validateProposedConfigEntryInServiceGraph(
} }
} }
_, ingressEntries, err := configEntriesByKindTxn(tx, nil, structs.IngressGateway, structs.WildcardEnterpriseMeta()) _, ingressEntries, err := configEntriesByKindTxn(tx, nil, structs.IngressGateway, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -516,7 +516,7 @@ func validateProposedConfigEntryInServiceGraph(
checkIngress = append(checkIngress, ingress) checkIngress = append(checkIngress, ingress)
} }
_, ixnEntries, err := configEntriesByKindTxn(tx, nil, structs.ServiceIntentions, structs.WildcardEnterpriseMeta()) _, ixnEntries, err := configEntriesByKindTxn(tx, nil, structs.ServiceIntentions, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -573,7 +573,7 @@ func validateProposedConfigEntryInServiceGraph(
checkIntentions = append(checkIntentions, ixn) checkIntentions = append(checkIntentions, ixn)
} }
_, ixnEntries, err := configEntriesByKindTxn(tx, nil, structs.ServiceIntentions, structs.WildcardEnterpriseMeta()) _, ixnEntries, err := configEntriesByKindTxn(tx, nil, structs.ServiceIntentions, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return err return err
} }
@ -1232,7 +1232,7 @@ func NewConfigEntryKindName(kind, name string, entMeta *structs.EnterpriseMeta)
Name: name, Name: name,
} }
if entMeta == nil { if entMeta == nil {
entMeta = structs.DefaultEnterpriseMeta() entMeta = structs.DefaultEnterpriseMetaInDefaultPartition()
} }
ret.EnterpriseMeta = *entMeta ret.EnterpriseMeta = *entMeta

View File

@ -128,7 +128,7 @@ func configIntentionsListTxn(tx ReadTxn, ws memdb.WatchSet, entMeta *structs.Ent
idx := maxIndexTxn(tx, tableConfigEntries) idx := maxIndexTxn(tx, tableConfigEntries)
iter, err := getConfigEntryKindsWithTxn(tx, structs.ServiceIntentions, structs.WildcardEnterpriseMeta()) iter, err := getConfigEntryKindsWithTxn(tx, structs.ServiceIntentions, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return 0, nil, false, fmt.Errorf("failed config entry lookup: %s", err) return 0, nil, false, fmt.Errorf("failed config entry lookup: %s", err)
} }

View File

@ -331,7 +331,7 @@ func TestStore_ConfigEntry_GraphValidation(t *testing.T) {
Kind: structs.ServiceDefaults, Kind: structs.ServiceDefaults,
Name: "main", Name: "main",
Protocol: "http", Protocol: "http",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
&structs.ServiceResolverConfigEntry{ &structs.ServiceResolverConfigEntry{
Kind: structs.ServiceResolver, Kind: structs.ServiceResolver,
@ -354,7 +354,7 @@ func TestStore_ConfigEntry_GraphValidation(t *testing.T) {
{Weight: 90, ServiceSubset: "v1"}, {Weight: 90, ServiceSubset: "v1"},
{Weight: 10, ServiceSubset: "v2"}, {Weight: 10, ServiceSubset: "v2"},
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
return s.EnsureConfigEntry(0, entry) return s.EnsureConfigEntry(0, entry)
}, },
@ -1554,7 +1554,7 @@ func TestStore_ValidateIngressGatewayErrorOnMismatchedProtocols(t *testing.T) {
} }
func TestSourcesForTarget(t *testing.T) { func TestSourcesForTarget(t *testing.T) {
defaultMeta := *structs.DefaultEnterpriseMeta() defaultMeta := *structs.DefaultEnterpriseMetaInDefaultPartition()
type expect struct { type expect struct {
idx uint64 idx uint64
@ -1829,7 +1829,7 @@ func TestSourcesForTarget(t *testing.T) {
tx := s.db.ReadTxn() tx := s.db.ReadTxn()
defer tx.Abort() defer tx.Abort()
sn := structs.NewServiceName("sink", structs.DefaultEnterpriseMeta()) sn := structs.NewServiceName("sink", structs.DefaultEnterpriseMetaInDefaultPartition())
idx, names, err := s.discoveryChainSourcesTxn(tx, ws, "dc1", sn) idx, names, err := s.discoveryChainSourcesTxn(tx, ws, "dc1", sn)
require.NoError(t, err) require.NoError(t, err)
@ -1840,7 +1840,7 @@ func TestSourcesForTarget(t *testing.T) {
} }
func TestTargetsForSource(t *testing.T) { func TestTargetsForSource(t *testing.T) {
defaultMeta := *structs.DefaultEnterpriseMeta() defaultMeta := *structs.DefaultEnterpriseMetaInDefaultPartition()
type expect struct { type expect struct {
idx uint64 idx uint64

View File

@ -1008,7 +1008,7 @@ func (s *Store) intentionTopologyTxn(tx ReadTxn, ws memdb.WatchSet,
return true return true
} }
return false return false
}, structs.WildcardEnterpriseMeta()) }, structs.WildcardEnterpriseMetaInDefaultPartition())
if err != nil { if err != nil {
return index, nil, fmt.Errorf("failed to fetch catalog service list: %v", err) return index, nil, fmt.Errorf("failed to fetch catalog service list: %v", err)
} }

View File

@ -288,7 +288,7 @@ func TestStore_IntentionMutation(t *testing.T) {
func testStore_IntentionMutation(t *testing.T, s *Store) { func testStore_IntentionMutation(t *testing.T, s *Store) {
lastIndex := uint64(1) lastIndex := uint64(1)
defaultEntMeta := structs.DefaultEnterpriseMeta() defaultEntMeta := structs.DefaultEnterpriseMetaInDefaultPartition()
var ( var (
id1 = testUUID() id1 = testUUID()
@ -1072,7 +1072,7 @@ func TestStore_IntentionsList(t *testing.T) {
lastIndex = 1 // minor state machine implementation difference lastIndex = 1 // minor state machine implementation difference
} }
entMeta := structs.WildcardEnterpriseMeta() entMeta := structs.WildcardEnterpriseMetaInDefaultPartition()
// Querying with no results returns nil. // Querying with no results returns nil.
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
@ -1686,7 +1686,7 @@ func TestStore_LegacyIntention_Snapshot_Restore(t *testing.T) {
// Intentions are returned precedence sorted unlike the snapshot so we need // Intentions are returned precedence sorted unlike the snapshot so we need
// to rearrange the expected slice some. // to rearrange the expected slice some.
expected[0], expected[1], expected[2] = expected[1], expected[2], expected[0] expected[0], expected[1], expected[2] = expected[1], expected[2], expected[0]
entMeta := structs.WildcardEnterpriseMeta() entMeta := structs.WildcardEnterpriseMetaInDefaultPartition()
idx, actual, fromConfig, err := s.Intentions(nil, entMeta) idx, actual, fromConfig, err := s.Intentions(nil, entMeta)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, idx, uint64(6)) require.Equal(t, idx, uint64(6))
@ -1898,46 +1898,46 @@ func TestStore_IntentionTopology(t *testing.T) {
{ {
ID: structs.ConsulServiceID, ID: structs.ConsulServiceID,
Service: structs.ConsulServiceName, Service: structs.ConsulServiceName,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
ID: "api-1", ID: "api-1",
Service: "api", Service: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
ID: "mysql-1", ID: "mysql-1",
Service: "mysql", Service: "mysql",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
ID: "web-1", ID: "web-1",
Service: "web", Service: "web",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Kind: structs.ServiceKindConnectProxy, Kind: structs.ServiceKindConnectProxy,
ID: "web-proxy-1", ID: "web-proxy-1",
Service: "web-proxy", Service: "web-proxy",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Kind: structs.ServiceKindTerminatingGateway, Kind: structs.ServiceKindTerminatingGateway,
ID: "terminating-gateway-1", ID: "terminating-gateway-1",
Service: "terminating-gateway", Service: "terminating-gateway",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Kind: structs.ServiceKindIngressGateway, Kind: structs.ServiceKindIngressGateway,
ID: "ingress-gateway-1", ID: "ingress-gateway-1",
Service: "ingress-gateway", Service: "ingress-gateway",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Kind: structs.ServiceKindMeshGateway, Kind: structs.ServiceKindMeshGateway,
ID: "mesh-gateway-1", ID: "mesh-gateway-1",
Service: "mesh-gateway", Service: "mesh-gateway",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
@ -1975,7 +1975,7 @@ func TestStore_IntentionTopology(t *testing.T) {
services: structs.ServiceList{ services: structs.ServiceList{
{ {
Name: "mysql", Name: "mysql",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2002,7 +2002,7 @@ func TestStore_IntentionTopology(t *testing.T) {
services: structs.ServiceList{ services: structs.ServiceList{
{ {
Name: "api", Name: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2029,11 +2029,11 @@ func TestStore_IntentionTopology(t *testing.T) {
services: structs.ServiceList{ services: structs.ServiceList{
{ {
Name: "ingress-gateway", Name: "ingress-gateway",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "mysql", Name: "mysql",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2060,7 +2060,7 @@ func TestStore_IntentionTopology(t *testing.T) {
services: structs.ServiceList{ services: structs.ServiceList{
{ {
Name: "web", Name: "web",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2087,11 +2087,11 @@ func TestStore_IntentionTopology(t *testing.T) {
services: structs.ServiceList{ services: structs.ServiceList{
{ {
Name: "api", Name: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "mysql", Name: "mysql",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2140,11 +2140,11 @@ func TestStore_IntentionTopology(t *testing.T) {
services: structs.ServiceList{ services: structs.ServiceList{
{ {
Name: "api", Name: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "mysql", Name: "mysql",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -2190,7 +2190,7 @@ func TestStore_IntentionTopology_Watches(t *testing.T) {
})) }))
i++ i++
target := structs.NewServiceName("web", structs.DefaultEnterpriseMeta()) target := structs.NewServiceName("web", structs.DefaultEnterpriseMetaInDefaultPartition())
ws := memdb.NewWatchSet() ws := memdb.NewWatchSet()
index, got, err := s.IntentionTopology(ws, target, false, acl.Deny) index, got, err := s.IntentionTopology(ws, target, false, acl.Deny)
@ -2246,7 +2246,7 @@ func TestStore_IntentionTopology_Watches(t *testing.T) {
require.NoError(t, s.EnsureService(i, "foo", &structs.NodeService{ require.NoError(t, s.EnsureService(i, "foo", &structs.NodeService{
ID: "api-1", ID: "api-1",
Service: "api", Service: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
})) }))
require.True(t, watchFired(ws)) require.True(t, watchFired(ws))
@ -2259,7 +2259,7 @@ func TestStore_IntentionTopology_Watches(t *testing.T) {
expect := structs.ServiceList{ expect := structs.ServiceList{
{ {
Name: "api", Name: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
require.Equal(t, expect, got) require.Equal(t, expect, got)

View File

@ -279,7 +279,7 @@ func TestStateStore_Txn_Service(t *testing.T) {
CreateIndex: 2, CreateIndex: 2,
ModifyIndex: 2, ModifyIndex: 2,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Meta: map[string]string{}, Meta: map[string]string{},
}, },
}, },
@ -291,7 +291,7 @@ func TestStateStore_Txn_Service(t *testing.T) {
CreateIndex: 6, CreateIndex: 6,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
&structs.TxnResult{ &structs.TxnResult{
@ -303,7 +303,7 @@ func TestStateStore_Txn_Service(t *testing.T) {
CreateIndex: 3, CreateIndex: 3,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
} }
@ -336,7 +336,7 @@ func TestStateStore_Txn_Service(t *testing.T) {
ModifyIndex: 2, ModifyIndex: 2,
}, },
Weights: &structs.Weights{Passing: 1, Warning: 1}, Weights: &structs.Weights{Passing: 1, Warning: 1},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Meta: map[string]string{}, Meta: map[string]string{},
}, },
"svc5": { "svc5": {
@ -346,7 +346,7 @@ func TestStateStore_Txn_Service(t *testing.T) {
ModifyIndex: 6, ModifyIndex: 6,
}, },
Weights: &structs.Weights{Passing: 1, Warning: 1}, Weights: &structs.Weights{Passing: 1, Warning: 1},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
"svc2": { "svc2": {
ID: "svc2", ID: "svc2",
@ -356,7 +356,7 @@ func TestStateStore_Txn_Service(t *testing.T) {
ModifyIndex: 6, ModifyIndex: 6,
}, },
Weights: &structs.Weights{Passing: 1, Warning: 1}, Weights: &structs.Weights{Passing: 1, Warning: 1},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
} }
@ -431,7 +431,7 @@ func TestStateStore_Txn_Checks(t *testing.T) {
CreateIndex: 2, CreateIndex: 2,
ModifyIndex: 2, ModifyIndex: 2,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
&structs.TxnResult{ &structs.TxnResult{
@ -443,7 +443,7 @@ func TestStateStore_Txn_Checks(t *testing.T) {
CreateIndex: 6, CreateIndex: 6,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
&structs.TxnResult{ &structs.TxnResult{
@ -455,7 +455,7 @@ func TestStateStore_Txn_Checks(t *testing.T) {
CreateIndex: 3, CreateIndex: 3,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
} }
@ -478,7 +478,7 @@ func TestStateStore_Txn_Checks(t *testing.T) {
CreateIndex: 2, CreateIndex: 2,
ModifyIndex: 2, ModifyIndex: 2,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
&structs.HealthCheck{ &structs.HealthCheck{
Node: "node1", Node: "node1",
@ -488,7 +488,7 @@ func TestStateStore_Txn_Checks(t *testing.T) {
CreateIndex: 3, CreateIndex: 3,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
&structs.HealthCheck{ &structs.HealthCheck{
Node: "node1", Node: "node1",
@ -498,7 +498,7 @@ func TestStateStore_Txn_Checks(t *testing.T) {
CreateIndex: 6, CreateIndex: 6,
ModifyIndex: 6, ModifyIndex: 6,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
require.Equal(t, expectedChecks, actual) require.Equal(t, expectedChecks, actual)

View File

@ -754,14 +754,14 @@ func TestTxn_Read(t *testing.T) {
ID: "svc-foo", ID: "svc-foo",
Service: "svc-foo", Service: "svc-foo",
Address: "127.0.0.1", Address: "127.0.0.1",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.NoError(state.EnsureService(3, "foo", &svc)) require.NoError(state.EnsureService(3, "foo", &svc))
check := structs.HealthCheck{ check := structs.HealthCheck{
Node: "foo", Node: "foo",
CheckID: types.CheckID("check-foo"), CheckID: types.CheckID("check-foo"),
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
state.EnsureCheck(4, &check) state.EnsureCheck(4, &check)

View File

@ -414,7 +414,7 @@ func (d *DNSServer) handlePtr(resp dns.ResponseWriter, req *dns.Msg) {
AllowStale: cfg.AllowStale, AllowStale: cfg.AllowStale,
}, },
ServiceAddress: serviceAddress, ServiceAddress: serviceAddress,
EnterpriseMeta: *structs.WildcardEnterpriseMeta(), EnterpriseMeta: *structs.WildcardEnterpriseMetaInDefaultPartition(),
} }
var sout structs.IndexedServiceNodes var sout structs.IndexedServiceNodes
@ -548,7 +548,7 @@ func (d *DNSServer) nameservers(cfg *dnsConfig, maxRecursionLevel int) (ns []dns
Service: structs.ConsulServiceName, Service: structs.ConsulServiceName,
Connect: false, Connect: false,
Ingress: false, Ingress: false,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}) })
if err != nil { if err != nil {
d.logger.Warn("Unable to get list of servers", "error", err) d.logger.Warn("Unable to get list of servers", "error", err)

View File

@ -887,7 +887,7 @@ func (l *State) updateSyncState() error {
AllowStale: true, AllowStale: true,
MaxStaleDuration: fullSyncReadMaxStale, MaxStaleDuration: fullSyncReadMaxStale,
}, },
EnterpriseMeta: *structs.WildcardEnterpriseMeta(), EnterpriseMeta: *structs.WildcardEnterpriseMetaInDefaultPartition(),
} }
var out1 structs.IndexedNodeServiceList var out1 structs.IndexedNodeServiceList

View File

@ -57,7 +57,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
assert.False(t, a.State.ServiceExists(structs.ServiceID{ID: srv1.ID})) assert.False(t, a.State.ServiceExists(structs.ServiceID{ID: srv1.ID}))
a.State.AddService(srv1, "") a.State.AddService(srv1, "")
@ -77,7 +77,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 0, Warning: 0,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv2, "") a.State.AddService(srv2, "")
@ -99,7 +99,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv3, "") a.State.AddService(srv3, "")
@ -113,7 +113,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 0, Warning: 0,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
args.Service = srv4 args.Service = srv4
if err := a.RPC("Catalog.Register", args, &out); err != nil { if err := a.RPC("Catalog.Register", args, &out); err != nil {
@ -131,7 +131,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv5, "") a.State.AddService(srv5, "")
@ -153,7 +153,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 0, Warning: 0,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.SetServiceState(&local.ServiceState{ a.State.SetServiceState(&local.ServiceState{
Service: srv6, Service: srv6,
@ -209,7 +209,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
} }
} }
if err := servicesInSync(a.State, 5, structs.DefaultEnterpriseMeta()); err != nil { if err := servicesInSync(a.State, 5, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -248,7 +248,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
} }
} }
if err := servicesInSync(a.State, 4, structs.DefaultEnterpriseMeta()); err != nil { if err := servicesInSync(a.State, 4, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
@ -284,7 +284,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv1, "") a.State.AddService(srv1, "")
args.Service = srv1 args.Service = srv1
@ -301,7 +301,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 0, Warning: 0,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv2, "") a.State.AddService(srv2, "")
@ -322,7 +322,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv3, "") a.State.AddService(srv3, "")
@ -337,7 +337,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 0, Warning: 0,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
args.Service = srv4 args.Service = srv4
assert.Nil(a.RPC("Catalog.Register", args, &out)) assert.Nil(a.RPC("Catalog.Register", args, &out))
@ -353,7 +353,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.SetServiceState(&local.ServiceState{ a.State.SetServiceState(&local.ServiceState{
Service: srv5, Service: srv5,
@ -391,7 +391,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
} }
} }
assert.Nil(servicesInSync(a.State, 4, structs.DefaultEnterpriseMeta())) assert.Nil(servicesInSync(a.State, 4, structs.DefaultEnterpriseMetaInDefaultPartition()))
// Remove one of the services // Remove one of the services
a.State.RemoveService(structs.NewServiceID("cache-proxy", nil)) a.State.RemoveService(structs.NewServiceID("cache-proxy", nil))
@ -418,7 +418,7 @@ func TestAgentAntiEntropy_Services_ConnectProxy(t *testing.T) {
} }
} }
assert.Nil(servicesInSync(a.State, 3, structs.DefaultEnterpriseMeta())) assert.Nil(servicesInSync(a.State, 3, structs.DefaultEnterpriseMetaInDefaultPartition()))
} }
func TestAgent_ServiceWatchCh(t *testing.T) { func TestAgent_ServiceWatchCh(t *testing.T) {
@ -625,7 +625,7 @@ func TestAgentAntiEntropy_EnableTagOverride(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
assert.Equal(r, want, got) assert.Equal(r, want, got)
case "svc_id2": case "svc_id2":
@ -638,7 +638,7 @@ func TestAgentAntiEntropy_EnableTagOverride(t *testing.T) {
} }
} }
if err := servicesInSync(a.State, 2, structs.DefaultEnterpriseMeta()); err != nil { if err := servicesInSync(a.State, 2, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
r.Fatal(err) r.Fatal(err)
} }
}) })
@ -873,7 +873,7 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
} }
} }
if err := servicesInSync(a.State, 2, structs.DefaultEnterpriseMeta()); err != nil { if err := servicesInSync(a.State, 2, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
@ -918,7 +918,7 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
} }
} }
if err := servicesInSync(a.State, 1, structs.DefaultEnterpriseMeta()); err != nil { if err := servicesInSync(a.State, 1, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
@ -953,7 +953,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
CheckID: "mysql", CheckID: "mysql",
Name: "mysql", Name: "mysql",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddCheck(chk1, "") a.State.AddCheck(chk1, "")
args.Check = chk1 args.Check = chk1
@ -967,7 +967,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
CheckID: "redis", CheckID: "redis",
Name: "redis", Name: "redis",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddCheck(chk2, "") a.State.AddCheck(chk2, "")
@ -985,7 +985,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
CheckID: "web", CheckID: "web",
Name: "web", Name: "web",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddCheck(chk3, "") a.State.AddCheck(chk3, "")
@ -995,7 +995,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
CheckID: "lb", CheckID: "lb",
Name: "lb", Name: "lb",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
args.Check = chk4 args.Check = chk4
if err := a.RPC("Catalog.Register", args, &out); err != nil { if err := a.RPC("Catalog.Register", args, &out); err != nil {
@ -1008,7 +1008,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
CheckID: "cache", CheckID: "cache",
Name: "cache", Name: "cache",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.SetCheckState(&local.CheckState{ a.State.SetCheckState(&local.CheckState{
Check: chk5, Check: chk5,
@ -1056,7 +1056,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
} }
} }
if err := checksInSync(a.State, 4, structs.DefaultEnterpriseMeta()); err != nil { if err := checksInSync(a.State, 4, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
r.Fatal(err) r.Fatal(err)
} }
}) })
@ -1119,7 +1119,7 @@ func TestAgentAntiEntropy_Checks(t *testing.T) {
} }
} }
if err := checksInSync(a.State, 3, structs.DefaultEnterpriseMeta()); err != nil { if err := checksInSync(a.State, 3, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
r.Fatal(err) r.Fatal(err)
} }
}) })
@ -1165,7 +1165,7 @@ func TestAgentAntiEntropy_RemovingServiceAndCheck(t *testing.T) {
Name: "lb", Name: "lb",
ServiceID: svcID, ServiceID: svcID,
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
args.Check = chk args.Check = chk
@ -1250,7 +1250,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv1, "root") a.State.AddService(srv1, "root")
srv2 := &structs.NodeService{ srv2 := &structs.NodeService{
@ -1262,7 +1262,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddService(srv2, "root") a.State.AddService(srv2, "root")
@ -1304,7 +1304,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
} }
} }
if err := servicesInSync(a.State, 2, structs.DefaultEnterpriseMeta()); err != nil { if err := servicesInSync(a.State, 2, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
@ -1318,7 +1318,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
CheckID: "mysql-check", CheckID: "mysql-check",
Name: "mysql", Name: "mysql",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddCheck(chk1, token) a.State.AddCheck(chk1, token)
@ -1331,7 +1331,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
CheckID: "api-check", CheckID: "api-check",
Name: "api", Name: "api",
Status: api.HealthPassing, Status: api.HealthPassing,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
a.State.AddCheck(chk2, token) a.State.AddCheck(chk2, token)
@ -1372,7 +1372,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
} }
} }
if err := checksInSync(a.State, 2, structs.DefaultEnterpriseMeta()); err != nil { if err := checksInSync(a.State, 2, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1417,7 +1417,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
} }
} }
if err := checksInSync(a.State, 1, structs.DefaultEnterpriseMeta()); err != nil { if err := checksInSync(a.State, 1, structs.DefaultEnterpriseMetaInDefaultPartition()); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1863,19 +1863,19 @@ func TestAgent_CheckCriticalTime(t *testing.T) {
Status: api.HealthPassing, Status: api.HealthPassing,
} }
l.AddCheck(chk, "") l.AddCheck(chk, "")
if checks := l.CriticalCheckStates(structs.DefaultEnterpriseMeta()); len(checks) > 0 { if checks := l.CriticalCheckStates(structs.DefaultEnterpriseMetaInDefaultPartition()); len(checks) > 0 {
t.Fatalf("should not have any critical checks") t.Fatalf("should not have any critical checks")
} }
// Set it to warning and make sure that doesn't show up as critical. // Set it to warning and make sure that doesn't show up as critical.
l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthWarning, "") l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthWarning, "")
if checks := l.CriticalCheckStates(structs.DefaultEnterpriseMeta()); len(checks) > 0 { if checks := l.CriticalCheckStates(structs.DefaultEnterpriseMetaInDefaultPartition()); len(checks) > 0 {
t.Fatalf("should not have any critical checks") t.Fatalf("should not have any critical checks")
} }
// Fail the check and make sure the time looks reasonable. // Fail the check and make sure the time looks reasonable.
l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthCritical, "") l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthCritical, "")
if c, ok := l.CriticalCheckStates(structs.DefaultEnterpriseMeta())[structs.NewCheckID(checkID, nil)]; !ok { if c, ok := l.CriticalCheckStates(structs.DefaultEnterpriseMetaInDefaultPartition())[structs.NewCheckID(checkID, nil)]; !ok {
t.Fatalf("should have a critical check") t.Fatalf("should have a critical check")
} else if c.CriticalFor() > time.Millisecond { } else if c.CriticalFor() > time.Millisecond {
t.Fatalf("bad: %#v, check was critical for %v", c, c.CriticalFor()) t.Fatalf("bad: %#v, check was critical for %v", c, c.CriticalFor())
@ -1886,7 +1886,7 @@ func TestAgent_CheckCriticalTime(t *testing.T) {
// 50ms the check should not be any less than that. // 50ms the check should not be any less than that.
time.Sleep(50 * time.Millisecond) time.Sleep(50 * time.Millisecond)
l.UpdateCheck(chk.CompoundCheckID(), api.HealthCritical, "") l.UpdateCheck(chk.CompoundCheckID(), api.HealthCritical, "")
if c, ok := l.CriticalCheckStates(structs.DefaultEnterpriseMeta())[structs.NewCheckID(checkID, nil)]; !ok { if c, ok := l.CriticalCheckStates(structs.DefaultEnterpriseMetaInDefaultPartition())[structs.NewCheckID(checkID, nil)]; !ok {
t.Fatalf("should have a critical check") t.Fatalf("should have a critical check")
} else if c.CriticalFor() < 50*time.Millisecond { } else if c.CriticalFor() < 50*time.Millisecond {
t.Fatalf("bad: %#v, check was critical for %v", c, c.CriticalFor()) t.Fatalf("bad: %#v, check was critical for %v", c, c.CriticalFor())
@ -1894,14 +1894,14 @@ func TestAgent_CheckCriticalTime(t *testing.T) {
// Set it passing again. // Set it passing again.
l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthPassing, "") l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthPassing, "")
if checks := l.CriticalCheckStates(structs.DefaultEnterpriseMeta()); len(checks) > 0 { if checks := l.CriticalCheckStates(structs.DefaultEnterpriseMetaInDefaultPartition()); len(checks) > 0 {
t.Fatalf("should not have any critical checks") t.Fatalf("should not have any critical checks")
} }
// Fail the check and make sure the time looks like it started again // Fail the check and make sure the time looks like it started again
// from the latest failure, not the original one. // from the latest failure, not the original one.
l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthCritical, "") l.UpdateCheck(structs.NewCheckID(checkID, nil), api.HealthCritical, "")
if c, ok := l.CriticalCheckStates(structs.DefaultEnterpriseMeta())[structs.NewCheckID(checkID, nil)]; !ok { if c, ok := l.CriticalCheckStates(structs.DefaultEnterpriseMetaInDefaultPartition())[structs.NewCheckID(checkID, nil)]; !ok {
t.Fatalf("should have a critical check") t.Fatalf("should have a critical check")
} else if c.CriticalFor() > time.Millisecond { } else if c.CriticalFor() > time.Millisecond {
t.Fatalf("bad: %#v, check was critical for %v", c, c.CriticalFor()) t.Fatalf("bad: %#v, check was critical for %v", c, c.CriticalFor())
@ -2282,7 +2282,7 @@ func TestState_SyncChanges_DuplicateAddServiceOnlySyncsOnce(t *testing.T) {
Kind: structs.ServiceKindTypical, Kind: structs.ServiceKindTypical,
ID: "the-service-id", ID: "the-service-id",
Service: "web", Service: "web",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
checks := []*structs.HealthCheck{ checks := []*structs.HealthCheck{
{Node: "this-node", CheckID: "the-id-1", Name: "check-healthy-1"}, {Node: "this-node", CheckID: "the-id-1", Name: "check-healthy-1"},

View File

@ -86,7 +86,7 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e
Datacenter: s.source.Datacenter, Datacenter: s.source.Datacenter,
QueryOptions: structs.QueryOptions{Token: s.token}, QueryOptions: structs.QueryOptions{Token: s.token},
ServiceName: s.proxyCfg.DestinationServiceName, ServiceName: s.proxyCfg.DestinationServiceName,
EnterpriseMeta: structs.NewEnterpriseMeta(s.proxyID.NamespaceOrEmpty()), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(s.proxyID.NamespaceOrEmpty()),
}, intentionUpstreamsID, s.ch) }, intentionUpstreamsID, s.ch)
if err != nil { if err != nil {
return snap, err return snap, err
@ -97,7 +97,7 @@ func (s *handlerConnectProxy) initialize(ctx context.Context) (ConfigSnapshot, e
Name: structs.MeshConfigMesh, Name: structs.MeshConfigMesh,
Datacenter: s.source.Datacenter, Datacenter: s.source.Datacenter,
QueryOptions: structs.QueryOptions{Token: s.token}, QueryOptions: structs.QueryOptions{Token: s.token},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, meshConfigEntryID, s.ch) }, meshConfigEntryID, s.ch)
if err != nil { if err != nil {
return snap, err return snap, err
@ -228,7 +228,7 @@ func (s *handlerConnectProxy) handleUpdate(ctx context.Context, u cache.UpdateEv
// Use the centralized upstream defaults if they exist and there isn't specific configuration for this upstream // Use the centralized upstream defaults if they exist and there isn't specific configuration for this upstream
// This is only relevant to upstreams from intentions because for explicit upstreams the defaulting is handled // This is only relevant to upstreams from intentions because for explicit upstreams the defaulting is handled
// by the ResolveServiceConfig endpoint. // by the ResolveServiceConfig endpoint.
wildcardSID := structs.NewServiceID(structs.WildcardSpecifier, structs.WildcardEnterpriseMeta()) wildcardSID := structs.NewServiceID(structs.WildcardSpecifier, structs.WildcardEnterpriseMetaInDefaultPartition())
defaults, ok := snap.ConnectProxy.UpstreamConfig[wildcardSID.String()] defaults, ok := snap.ConnectProxy.UpstreamConfig[wildcardSID.String()]
if ok { if ok {
u = defaults u = defaults

View File

@ -141,7 +141,7 @@ func (m *Manager) syncState() {
defer m.mu.Unlock() defer m.mu.Unlock()
// Traverse the local state and ensure all proxy services are registered // Traverse the local state and ensure all proxy services are registered
services := m.State.Services(structs.WildcardEnterpriseMeta()) services := m.State.Services(structs.WildcardEnterpriseMetaInDefaultPartition())
for sid, svc := range services { for sid, svc := range services {
if svc.Kind != structs.ServiceKindConnectProxy && if svc.Kind != structs.ServiceKindConnectProxy &&
svc.Kind != structs.ServiceKindTerminatingGateway && svc.Kind != structs.ServiceKindTerminatingGateway &&

View File

@ -169,7 +169,7 @@ func TestManager_BasicLifecycle(t *testing.T) {
QueryOptions: structs.QueryOptions{Token: "my-token", Filter: ""}, QueryOptions: structs.QueryOptions{Token: "my-token", Filter: ""},
ServiceName: "db", ServiceName: "db",
Connect: true, Connect: true,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}) })
db_v1_HealthCacheKey := testGenCacheKey(&structs.ServiceSpecificRequest{ db_v1_HealthCacheKey := testGenCacheKey(&structs.ServiceSpecificRequest{
Datacenter: "dc1", Datacenter: "dc1",
@ -178,7 +178,7 @@ func TestManager_BasicLifecycle(t *testing.T) {
}, },
ServiceName: "db", ServiceName: "db",
Connect: true, Connect: true,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}) })
db_v2_HealthCacheKey := testGenCacheKey(&structs.ServiceSpecificRequest{ db_v2_HealthCacheKey := testGenCacheKey(&structs.ServiceSpecificRequest{
Datacenter: "dc1", Datacenter: "dc1",
@ -187,7 +187,7 @@ func TestManager_BasicLifecycle(t *testing.T) {
}, },
ServiceName: "db", ServiceName: "db",
Connect: true, Connect: true,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}) })
db := structs.NewServiceName("db", nil) db := structs.NewServiceName("db", nil)

View File

@ -34,7 +34,7 @@ func (s *handlerMeshGateway) initialize(ctx context.Context) (ConfigSnapshot, er
Datacenter: s.source.Datacenter, Datacenter: s.source.Datacenter,
QueryOptions: structs.QueryOptions{Token: s.token}, QueryOptions: structs.QueryOptions{Token: s.token},
Source: *s.source, Source: *s.source,
EnterpriseMeta: *structs.WildcardEnterpriseMeta(), EnterpriseMeta: *structs.WildcardEnterpriseMetaInDefaultPartition(),
}, serviceListWatchID, s.ch) }, serviceListWatchID, s.ch)
if err != nil { if err != nil {
@ -85,7 +85,7 @@ func (s *handlerMeshGateway) initialize(ctx context.Context) (ConfigSnapshot, er
Datacenter: s.source.Datacenter, Datacenter: s.source.Datacenter,
QueryOptions: structs.QueryOptions{Token: s.token}, QueryOptions: structs.QueryOptions{Token: s.token},
Kind: structs.ServiceResolver, Kind: structs.ServiceResolver,
EnterpriseMeta: *structs.WildcardEnterpriseMeta(), EnterpriseMeta: *structs.WildcardEnterpriseMetaInDefaultPartition(),
}, serviceResolversWatchID, s.ch) }, serviceResolversWatchID, s.ch)
if err != nil { if err != nil {
s.logger.Named(logging.MeshGateway). s.logger.Named(logging.MeshGateway).
@ -205,7 +205,7 @@ func (s *handlerMeshGateway) handleUpdate(ctx context.Context, u cache.UpdateEve
ServiceKind: structs.ServiceKindMeshGateway, ServiceKind: structs.ServiceKindMeshGateway,
UseServiceKind: true, UseServiceKind: true,
Source: *s.source, Source: *s.source,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, fmt.Sprintf("mesh-gateway:%s", dc), s.ch) }, fmt.Sprintf("mesh-gateway:%s", dc), s.ch)
if err != nil { if err != nil {

View File

@ -312,7 +312,7 @@ func genVerifyGatewayWatch(expectedDatacenter string) verifyWatchRequest {
require.Equal(t, expectedDatacenter, reqReal.Datacenter) require.Equal(t, expectedDatacenter, reqReal.Datacenter)
require.True(t, reqReal.UseServiceKind) require.True(t, reqReal.UseServiceKind)
require.Equal(t, structs.ServiceKindMeshGateway, reqReal.ServiceKind) require.Equal(t, structs.ServiceKindMeshGateway, reqReal.ServiceKind)
require.Equal(t, structs.DefaultEnterpriseMeta(), &reqReal.EnterpriseMeta) require.Equal(t, structs.DefaultEnterpriseMetaInDefaultPartition(), &reqReal.EnterpriseMeta)
} }
} }
@ -1658,7 +1658,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
// Centrally configured upstream defaults should be stored so that upstreams from intentions can inherit them // Centrally configured upstream defaults should be stored so that upstreams from intentions can inherit them
require.Len(t, snap.ConnectProxy.UpstreamConfig, 1) require.Len(t, snap.ConnectProxy.UpstreamConfig, 1)
wc := structs.NewServiceName(structs.WildcardSpecifier, structs.WildcardEnterpriseMeta()) wc := structs.NewServiceName(structs.WildcardSpecifier, structs.WildcardEnterpriseMetaInDefaultPartition())
require.Contains(t, snap.ConnectProxy.UpstreamConfig, wc.String()) require.Contains(t, snap.ConnectProxy.UpstreamConfig, wc.String())
}, },
}, },
@ -2011,7 +2011,7 @@ func TestState_WatchesAndUpdates(t *testing.T) {
// Centrally configured upstream defaults should be stored so that upstreams from intentions can inherit them // Centrally configured upstream defaults should be stored so that upstreams from intentions can inherit them
require.Len(t, snap.ConnectProxy.UpstreamConfig, 2) require.Len(t, snap.ConnectProxy.UpstreamConfig, 2)
wc := structs.NewServiceName(structs.WildcardSpecifier, structs.WildcardEnterpriseMeta()) wc := structs.NewServiceName(structs.WildcardSpecifier, structs.WildcardEnterpriseMetaInDefaultPartition())
require.Contains(t, snap.ConnectProxy.UpstreamConfig, wc.String()) require.Contains(t, snap.ConnectProxy.UpstreamConfig, wc.String())
require.Contains(t, snap.ConnectProxy.UpstreamConfig, upstreamIDForDC2(db.String())) require.Contains(t, snap.ConnectProxy.UpstreamConfig, upstreamIDForDC2(db.String()))
}, },

View File

@ -229,7 +229,7 @@ func (s *handlerUpstreams) resetWatchesFromChain(
// Outside of transparent mode we only watch the chain target, B, // Outside of transparent mode we only watch the chain target, B,
// since A is a virtual service and traffic will not be sent to it. // since A is a virtual service and traffic will not be sent to it.
if !watchedChainEndpoints && s.proxyCfg.Mode == structs.ProxyModeTransparent { if !watchedChainEndpoints && s.proxyCfg.Mode == structs.ProxyModeTransparent {
chainEntMeta := structs.NewEnterpriseMeta(chain.Namespace) chainEntMeta := structs.NewEnterpriseMetaInDefaultPartition(chain.Namespace)
opts := targetWatchOpts{ opts := targetWatchOpts{
upstreamID: id, upstreamID: id,
@ -299,7 +299,7 @@ func (s *handlerUpstreams) watchMeshGateway(ctx context.Context, dc string, upst
ServiceKind: structs.ServiceKindMeshGateway, ServiceKind: structs.ServiceKindMeshGateway,
UseServiceKind: true, UseServiceKind: true,
Source: *s.source, Source: *s.source,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, "mesh-gateway:"+dc+":"+upstreamID, s.ch) }, "mesh-gateway:"+dc+":"+upstreamID, s.ch)
} }

View File

@ -51,7 +51,7 @@ func (h *Server) Subscribe(req *pbsubscribe.SubscribeRequest, serverStream pbsub
logger.Trace("new subscription") logger.Trace("new subscription")
defer logger.Trace("subscription closed") defer logger.Trace("subscription closed")
entMeta := structs.NewEnterpriseMeta(req.Namespace) entMeta := structs.NewEnterpriseMetaInDefaultPartition(req.Namespace)
authz, err := h.Backend.ResolveTokenAndDefaultMeta(req.Token, &entMeta, nil) authz, err := h.Backend.ResolveTokenAndDefaultMeta(req.Token, &entMeta, nil)
if err != nil { if err != nil {
return err return err

View File

@ -51,7 +51,7 @@ func TestSortCheckServiceNodes_OrderIsConsistentWithRPCResponse(t *testing.T) {
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Checks: []*structs.HealthCheck{}, Checks: []*structs.HealthCheck{},
} }
@ -92,7 +92,7 @@ func TestHealthView_IntegrationWithStore_WithEmptySnapshot(t *testing.T) {
ServiceSpecificRequest: structs.ServiceSpecificRequest{ ServiceSpecificRequest: structs.ServiceSpecificRequest{
Datacenter: "dc1", Datacenter: "dc1",
ServiceName: "web", ServiceName: "web",
EnterpriseMeta: structs.NewEnterpriseMeta(namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(namespace),
QueryOptions: structs.QueryOptions{MaxQueryTime: time.Second}, QueryOptions: structs.QueryOptions{MaxQueryTime: time.Second},
}, },
}, },
@ -277,7 +277,7 @@ func TestHealthView_IntegrationWithStore_WithFullSnapshot(t *testing.T) {
ServiceSpecificRequest: structs.ServiceSpecificRequest{ ServiceSpecificRequest: structs.ServiceSpecificRequest{
Datacenter: "dc1", Datacenter: "dc1",
ServiceName: "web", ServiceName: "web",
EnterpriseMeta: structs.NewEnterpriseMeta(namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(namespace),
QueryOptions: structs.QueryOptions{MaxQueryTime: time.Second}, QueryOptions: structs.QueryOptions{MaxQueryTime: time.Second},
}, },
}, },
@ -429,7 +429,7 @@ func TestHealthView_IntegrationWithStore_EventBatches(t *testing.T) {
ServiceSpecificRequest: structs.ServiceSpecificRequest{ ServiceSpecificRequest: structs.ServiceSpecificRequest{
Datacenter: "dc1", Datacenter: "dc1",
ServiceName: "web", ServiceName: "web",
EnterpriseMeta: structs.NewEnterpriseMeta(namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(namespace),
QueryOptions: structs.QueryOptions{MaxQueryTime: time.Second}, QueryOptions: structs.QueryOptions{MaxQueryTime: time.Second},
}, },
}, },
@ -486,7 +486,7 @@ func TestHealthView_IntegrationWithStore_Filtering(t *testing.T) {
ServiceSpecificRequest: structs.ServiceSpecificRequest{ ServiceSpecificRequest: structs.ServiceSpecificRequest{
Datacenter: "dc1", Datacenter: "dc1",
ServiceName: "web", ServiceName: "web",
EnterpriseMeta: structs.NewEnterpriseMeta(namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(namespace),
QueryOptions: structs.QueryOptions{ QueryOptions: structs.QueryOptions{
Filter: `Node.Node == "node2"`, Filter: `Node.Node == "node2"`,
MaxQueryTime: time.Second, MaxQueryTime: time.Second,
@ -659,7 +659,7 @@ func newNewSnapshotToFollowEvent() *pbsubscribe.Event {
// returns the empty string. It allows the same tests to work in both oss and ent // returns the empty string. It allows the same tests to work in both oss and ent
// without duplicating the tests. // without duplicating the tests.
func getNamespace(ns string) string { func getNamespace(ns string) string {
meta := structs.NewEnterpriseMeta(ns) meta := structs.NewEnterpriseMetaInDefaultPartition(ns)
return meta.NamespaceOrEmpty() return meta.NamespaceOrEmpty()
} }

View File

@ -3,12 +3,13 @@ package agent
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/mitchellh/copystructure"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/mitchellh/copystructure"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -48,7 +49,7 @@ func TestServiceManager_RegisterService(t *testing.T) {
ID: "redis", ID: "redis",
Service: "redis", Service: "redis",
Port: 8000, Port: 8000,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal)) require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal))
@ -64,7 +65,7 @@ func TestServiceManager_RegisterService(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, redisService) }, redisService)
} }
@ -120,7 +121,7 @@ func TestServiceManager_RegisterSidecar(t *testing.T) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal)) require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal))
@ -157,7 +158,7 @@ func TestServiceManager_RegisterSidecar(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, sidecarService) }, sidecarService)
} }
@ -193,7 +194,7 @@ func TestServiceManager_RegisterMeshGateway(t *testing.T) {
ID: "mesh-gateway", ID: "mesh-gateway",
Service: "mesh-gateway", Service: "mesh-gateway",
Port: 443, Port: 443,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal)) require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal))
@ -217,7 +218,7 @@ func TestServiceManager_RegisterMeshGateway(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, gateway) }, gateway)
} }
@ -253,7 +254,7 @@ func TestServiceManager_RegisterTerminatingGateway(t *testing.T) {
ID: "terminating-gateway", ID: "terminating-gateway",
Service: "terminating-gateway", Service: "terminating-gateway",
Port: 443, Port: 443,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal)) require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal))
@ -277,7 +278,7 @@ func TestServiceManager_RegisterTerminatingGateway(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, gateway) }, gateway)
} }
@ -351,7 +352,7 @@ func TestServiceManager_PersistService_API(t *testing.T) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
} }
@ -385,7 +386,7 @@ func TestServiceManager_PersistService_API(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
svc := newNodeService() svc := newNodeService()
@ -435,7 +436,7 @@ func TestServiceManager_PersistService_API(t *testing.T) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
expectJSONFile(t, configFile, pcfg, resetDefaultsQueryMeta) expectJSONFile(t, configFile, pcfg, resetDefaultsQueryMeta)
@ -483,7 +484,7 @@ func TestServiceManager_PersistService_API(t *testing.T) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
expectJSONFile(t, configFile, pcfg, resetDefaultsQueryMeta) expectJSONFile(t, configFile, pcfg, resetDefaultsQueryMeta)
@ -622,7 +623,7 @@ func TestServiceManager_PersistService_ConfigFiles(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
// Now wait until we've re-registered using central config updated data. // Now wait until we've re-registered using central config updated data.
@ -660,7 +661,7 @@ func TestServiceManager_PersistService_ConfigFiles(t *testing.T) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, resetDefaultsQueryMeta) }, resetDefaultsQueryMeta)
// Verify in memory state. // Verify in memory state.
@ -743,7 +744,7 @@ func TestServiceManager_Disabled(t *testing.T) {
}, },
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
} }
require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal)) require.NoError(a.addServiceFromSource(svc, nil, false, "", ConfigSourceLocal))
@ -774,7 +775,7 @@ func TestServiceManager_Disabled(t *testing.T) {
Passing: 1, Passing: 1,
Warning: 1, Warning: 1,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, sidecarService) }, sidecarService)
} }
@ -884,7 +885,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) {
{ {
Upstream: structs.ServiceID{ Upstream: structs.ServiceID{
ID: "zap", ID: "zap",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Config: map[string]interface{}{ Config: map[string]interface{}{
"passive_health_check": map[string]interface{}{ "passive_health_check": map[string]interface{}{
@ -947,7 +948,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) {
{ {
Upstream: structs.ServiceID{ Upstream: structs.ServiceID{
ID: "zap", ID: "zap",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Config: map[string]interface{}{ Config: map[string]interface{}{
"protocol": "grpc", "protocol": "grpc",
@ -1019,7 +1020,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) {
{ {
Upstream: structs.ServiceID{ Upstream: structs.ServiceID{
ID: "zap", ID: "zap",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Config: map[string]interface{}{ Config: map[string]interface{}{
"protocol": "grpc", "protocol": "grpc",
@ -1075,7 +1076,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) {
{ {
Upstream: structs.ServiceID{ Upstream: structs.ServiceID{
ID: "zap", ID: "zap",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Config: map[string]interface{}{ Config: map[string]interface{}{
"mesh_gateway": map[string]interface{}{ "mesh_gateway": map[string]interface{}{
@ -1133,7 +1134,7 @@ func Test_mergeServiceConfig_UpstreamOverrides(t *testing.T) {
{ {
Upstream: structs.ServiceID{ Upstream: structs.ServiceID{
ID: "zap", ID: "zap",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Config: map[string]interface{}{ Config: map[string]interface{}{
"mesh_gateway": map[string]interface{}{ "mesh_gateway": map[string]interface{}{

View File

@ -126,7 +126,7 @@ func (a *Agent) sidecarServiceFromNodeService(ns *structs.NodeService, token str
// it doesn't seem to be necessary - even with thousands of services this is // it doesn't seem to be necessary - even with thousands of services this is
// not expensive to compute. // not expensive to compute.
usedPorts := make(map[int]struct{}) usedPorts := make(map[int]struct{})
for _, otherNS := range a.State.Services(structs.WildcardEnterpriseMeta()) { for _, otherNS := range a.State.Services(structs.WildcardEnterpriseMetaInDefaultPartition()) {
// Check if other port is in auto-assign range // Check if other port is in auto-assign range
if otherNS.Port >= a.config.ConnectSidecarMinPort && if otherNS.Port >= a.config.ConnectSidecarMinPort &&
otherNS.Port <= a.config.ConnectSidecarMaxPort { otherNS.Port <= a.config.ConnectSidecarMaxPort {

View File

@ -51,7 +51,7 @@ func TestAgent_sidecarServiceFromNodeService(t *testing.T) {
}, },
token: "foo", token: "foo",
wantNS: &structs.NodeService{ wantNS: &structs.NodeService{
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Kind: structs.ServiceKindConnectProxy, Kind: structs.ServiceKindConnectProxy,
ID: "web1-sidecar-proxy", ID: "web1-sidecar-proxy",
Service: "web-sidecar-proxy", Service: "web-sidecar-proxy",
@ -111,7 +111,7 @@ func TestAgent_sidecarServiceFromNodeService(t *testing.T) {
}, },
token: "foo", token: "foo",
wantNS: &structs.NodeService{ wantNS: &structs.NodeService{
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Kind: structs.ServiceKindConnectProxy, Kind: structs.ServiceKindConnectProxy,
ID: "web1-sidecar-proxy", ID: "web1-sidecar-proxy",
Service: "motorbike1", Service: "motorbike1",
@ -189,7 +189,7 @@ func TestAgent_sidecarServiceFromNodeService(t *testing.T) {
}, },
}, },
wantNS: &structs.NodeService{ wantNS: &structs.NodeService{
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Kind: structs.ServiceKindConnectProxy, Kind: structs.ServiceKindConnectProxy,
ID: "web1-sidecar-proxy", ID: "web1-sidecar-proxy",
Service: "web-sidecar-proxy", Service: "web-sidecar-proxy",
@ -279,7 +279,7 @@ func TestAgent_sidecarServiceFromNodeService(t *testing.T) {
}, },
token: "foo", token: "foo",
wantNS: &structs.NodeService{ wantNS: &structs.NodeService{
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Kind: structs.ServiceKindConnectProxy, Kind: structs.ServiceKindConnectProxy,
ID: "web1-sidecar-proxy", ID: "web1-sidecar-proxy",
Service: "web-sidecar-proxy", Service: "web-sidecar-proxy",

View File

@ -229,7 +229,7 @@ func (s *ACLNodeIdentity) SyntheticPolicy() *ACLPolicy {
policy.Rules = rules policy.Rules = rules
policy.Syntax = acl.SyntaxCurrent policy.Syntax = acl.SyntaxCurrent
policy.Datacenters = []string{s.Datacenter} policy.Datacenters = []string{s.Datacenter}
policy.EnterpriseMeta = *DefaultEnterpriseMeta() policy.EnterpriseMeta = *DefaultEnterpriseMetaInDefaultPartition()
policy.SetHash(true) policy.SetHash(true)
return policy return policy
} }

View File

@ -55,7 +55,7 @@ func (_ *ACLAuthMethodEnterpriseMeta) FillWithEnterpriseMeta(_ *EnterpriseMeta)
} }
func (_ *ACLAuthMethodEnterpriseMeta) ToEnterpriseMeta() *EnterpriseMeta { func (_ *ACLAuthMethodEnterpriseMeta) ToEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
func aclServiceIdentityRules(svc string, _ *EnterpriseMeta) string { func aclServiceIdentityRules(svc string, _ *EnterpriseMeta) string {

View File

@ -5,31 +5,31 @@ package structs
// GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from // GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from
// fields in the ServiceRouteDestination // fields in the ServiceRouteDestination
func (dest *ServiceRouteDestination) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta { func (dest *ServiceRouteDestination) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
// GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from // GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from
// fields in the ServiceSplit // fields in the ServiceSplit
func (split *ServiceSplit) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta { func (split *ServiceSplit) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
// GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from // GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from
// fields in the ServiceResolverRedirect // fields in the ServiceResolverRedirect
func (redir *ServiceResolverRedirect) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta { func (redir *ServiceResolverRedirect) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
// GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from // GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from
// fields in the ServiceResolverFailover // fields in the ServiceResolverFailover
func (failover *ServiceResolverFailover) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta { func (failover *ServiceResolverFailover) GetEnterpriseMeta(_ *EnterpriseMeta) *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
// GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from // GetEnterpriseMeta is used to synthesize the EnterpriseMeta struct from
// fields in the DiscoveryChainRequest // fields in the DiscoveryChainRequest
func (req *DiscoveryChainRequest) GetEnterpriseMeta() *EnterpriseMeta { func (req *DiscoveryChainRequest) GetEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
// WithEnterpriseMeta will populate the corresponding fields in the // WithEnterpriseMeta will populate the corresponding fields in the

View File

@ -7,7 +7,7 @@ import (
) )
func TestIngressGatewayConfigEntry(t *testing.T) { func TestIngressGatewayConfigEntry(t *testing.T) {
defaultMeta := DefaultEnterpriseMeta() defaultMeta := DefaultEnterpriseMetaInDefaultPartition()
cases := map[string]configEntryTestcase{ cases := map[string]configEntryTestcase{
"normalize: empty protocol": { "normalize: empty protocol": {

View File

@ -45,7 +45,7 @@ func TestServiceIntentionsConfigEntry(t *testing.T) {
generateUUID(), generateUUID(),
} }
defaultMeta := DefaultEnterpriseMeta() defaultMeta := DefaultEnterpriseMetaInDefaultPartition()
fooName := NewServiceName("foo", defaultMeta) fooName := NewServiceName("foo", defaultMeta)

View File

@ -1671,21 +1671,21 @@ func TestServiceConfigEntry(t *testing.T) {
expected: &ServiceConfigEntry{ expected: &ServiceConfigEntry{
Kind: ServiceDefaults, Kind: ServiceDefaults,
Name: "web", Name: "web",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
UpstreamConfig: &UpstreamConfiguration{ UpstreamConfig: &UpstreamConfiguration{
Overrides: []*UpstreamConfig{ Overrides: []*UpstreamConfig{
{ {
Name: "good", Name: "good",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
Protocol: "grpc", Protocol: "grpc",
}, },
{ {
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
Protocol: "http2", Protocol: "http2",
}, },
{ {
Name: "also-good", Name: "also-good",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
Protocol: "http", Protocol: "http",
}, },
}, },
@ -1707,7 +1707,7 @@ func TestServiceConfigEntry(t *testing.T) {
expected: &ServiceConfigEntry{ expected: &ServiceConfigEntry{
Kind: ServiceDefaults, Kind: ServiceDefaults,
Name: "web", Name: "web",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
UpstreamConfig: &UpstreamConfiguration{ UpstreamConfig: &UpstreamConfiguration{
Defaults: &UpstreamConfig{ Defaults: &UpstreamConfig{
Name: "also-good", Name: "also-good",
@ -1724,7 +1724,7 @@ func TestServiceConfigEntry(t *testing.T) {
expected: &ServiceConfigEntry{ expected: &ServiceConfigEntry{
Kind: ServiceDefaults, Kind: ServiceDefaults,
Name: "web", Name: "web",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
}, },
normalizeOnly: true, normalizeOnly: true,
}, },
@ -1738,7 +1738,7 @@ func TestServiceConfigEntry(t *testing.T) {
Kind: ServiceDefaults, Kind: ServiceDefaults,
Name: "web", Name: "web",
Protocol: "protocol", Protocol: "protocol",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
}, },
normalizeOnly: true, normalizeOnly: true,
}, },
@ -1759,7 +1759,7 @@ func TestServiceConfigEntry(t *testing.T) {
}, },
Defaults: &UpstreamConfig{ConnectTimeoutMs: -20}, Defaults: &UpstreamConfig{ConnectTimeoutMs: -20},
}, },
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
}, },
expected: &ServiceConfigEntry{ expected: &ServiceConfigEntry{
Kind: ServiceDefaults, Kind: ServiceDefaults,
@ -1768,13 +1768,13 @@ func TestServiceConfigEntry(t *testing.T) {
Overrides: []*UpstreamConfig{ Overrides: []*UpstreamConfig{
{ {
Name: "redis", Name: "redis",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
Protocol: "tcp", Protocol: "tcp",
ConnectTimeoutMs: 0, ConnectTimeoutMs: 0,
}, },
{ {
Name: "memcached", Name: "memcached",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
ConnectTimeoutMs: 0, ConnectTimeoutMs: 0,
}, },
}, },
@ -1782,7 +1782,7 @@ func TestServiceConfigEntry(t *testing.T) {
ConnectTimeoutMs: 0, ConnectTimeoutMs: 0,
}, },
}, },
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
}, },
normalizeOnly: true, normalizeOnly: true,
}, },
@ -1842,7 +1842,7 @@ func TestServiceConfigEntry(t *testing.T) {
}, },
Defaults: &UpstreamConfig{ConnectTimeoutMs: -20}, Defaults: &UpstreamConfig{ConnectTimeoutMs: -20},
}, },
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
}, },
expected: &ServiceConfigEntry{ expected: &ServiceConfigEntry{
Kind: ServiceDefaults, Kind: ServiceDefaults,
@ -1851,19 +1851,19 @@ func TestServiceConfigEntry(t *testing.T) {
Overrides: []*UpstreamConfig{ Overrides: []*UpstreamConfig{
{ {
Name: "redis", Name: "redis",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
Protocol: "tcp", Protocol: "tcp",
ConnectTimeoutMs: 0, ConnectTimeoutMs: 0,
}, },
{ {
Name: "memcached", Name: "memcached",
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
ConnectTimeoutMs: 0, ConnectTimeoutMs: 0,
}, },
}, },
Defaults: &UpstreamConfig{ConnectTimeoutMs: 0}, Defaults: &UpstreamConfig{ConnectTimeoutMs: 0},
}, },
EnterpriseMeta: *DefaultEnterpriseMeta(), EnterpriseMeta: *DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
} }

View File

@ -3,7 +3,7 @@
package structs package structs
func (us *Upstream) GetEnterpriseMeta() *EnterpriseMeta { func (us *Upstream) GetEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
func (us *Upstream) DestinationID() ServiceID { func (us *Upstream) DestinationID() ServiceID {

View File

@ -95,7 +95,7 @@ func (c *CompiledDiscoveryChain) ID() string {
} }
func (c *CompiledDiscoveryChain) CompoundServiceName() ServiceName { func (c *CompiledDiscoveryChain) CompoundServiceName() ServiceName {
entMeta := NewEnterpriseMeta(c.Namespace) entMeta := NewEnterpriseMetaInDefaultPartition(c.Namespace)
return NewServiceName(c.ServiceName, &entMeta) return NewServiceName(c.ServiceName, &entMeta)
} }

View File

@ -3,5 +3,5 @@
package structs package structs
func (t *DiscoveryTarget) GetEnterpriseMetadata() *EnterpriseMeta { func (t *DiscoveryTarget) GetEnterpriseMetadata() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }

View File

@ -7,23 +7,23 @@ import (
) )
func (ixn *Intention) SourceEnterpriseMeta() *EnterpriseMeta { func (ixn *Intention) SourceEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
func (ixn *Intention) DestinationEnterpriseMeta() *EnterpriseMeta { func (ixn *Intention) DestinationEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
func (e *IntentionMatchEntry) GetEnterpriseMeta() *EnterpriseMeta { func (e *IntentionMatchEntry) GetEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
func (e *IntentionQueryExact) SourceEnterpriseMeta() *EnterpriseMeta { func (e *IntentionQueryExact) SourceEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
func (e *IntentionQueryExact) DestinationEnterpriseMeta() *EnterpriseMeta { func (e *IntentionQueryExact) DestinationEnterpriseMeta() *EnterpriseMeta {
return DefaultEnterpriseMeta() return DefaultEnterpriseMetaInDefaultPartition()
} }
// FillAuthzContext can fill in an acl.AuthorizerContext object to setup // FillAuthzContext can fill in an acl.AuthorizerContext object to setup

View File

@ -445,7 +445,7 @@ func TestIntention_String(t *testing.T) {
for name, tc := range cases { for name, tc := range cases {
tc := tc tc := tc
// Add a bunch of required fields. // Add a bunch of required fields.
tc.ixn.DefaultNamespaces(DefaultEnterpriseMeta()) tc.ixn.DefaultNamespaces(DefaultEnterpriseMetaInDefaultPartition())
tc.ixn.UpdatePrecedence() tc.ixn.UpdatePrecedence()
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {

View File

@ -1817,7 +1817,7 @@ func NewCheckID(id types.CheckID, entMeta *EnterpriseMeta) CheckID {
var cid CheckID var cid CheckID
cid.ID = id cid.ID = id
if entMeta == nil { if entMeta == nil {
entMeta = DefaultEnterpriseMeta() entMeta = DefaultEnterpriseMetaInDefaultPartition()
} }
cid.EnterpriseMeta = *entMeta cid.EnterpriseMeta = *entMeta
@ -1843,7 +1843,7 @@ func NewServiceID(id string, entMeta *EnterpriseMeta) ServiceID {
var sid ServiceID var sid ServiceID
sid.ID = id sid.ID = id
if entMeta == nil { if entMeta == nil {
entMeta = DefaultEnterpriseMeta() entMeta = DefaultEnterpriseMetaInDefaultPartition()
} }
sid.EnterpriseMeta = *entMeta sid.EnterpriseMeta = *entMeta
@ -1886,7 +1886,7 @@ func NewServiceName(name string, entMeta *EnterpriseMeta) ServiceName {
var ret ServiceName var ret ServiceName
ret.Name = name ret.Name = name
if entMeta == nil { if entMeta == nil {
entMeta = DefaultEnterpriseMeta() entMeta = DefaultEnterpriseMetaInDefaultPartition()
} }
ret.EnterpriseMeta = *entMeta ret.EnterpriseMeta = *entMeta

View File

@ -42,6 +42,31 @@ func (m *EnterpriseMeta) LessThan(_ *EnterpriseMeta) bool {
return false return false
} }
func (m *EnterpriseMeta) WildcardEnterpriseMetaForPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta
}
func (m *EnterpriseMeta) DefaultEnterpriseMetaForPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta
}
func (m *EnterpriseMeta) NodeEnterpriseMetaForPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta
}
func (m *EnterpriseMeta) NewEnterpriseMetaInPartition(_ string) *EnterpriseMeta {
return &emptyEnterpriseMeta
}
// TODO(partition): stop using this
func NewEnterpriseMetaInDefaultPartition(_ string) EnterpriseMeta {
return emptyEnterpriseMeta
}
func NewEnterpriseMetaWithPartition(_, _ string) EnterpriseMeta {
return emptyEnterpriseMeta
}
func (m *EnterpriseMeta) NamespaceOrDefault() string { func (m *EnterpriseMeta) NamespaceOrDefault() string {
return IntentionDefaultNamespace return IntentionDefaultNamespace
} }
@ -66,22 +91,36 @@ func (m *EnterpriseMeta) PartitionOrEmpty() string {
return "" return ""
} }
func NewEnterpriseMeta(_ string) EnterpriseMeta {
return emptyEnterpriseMeta
}
// ReplicationEnterpriseMeta stub // ReplicationEnterpriseMeta stub
func ReplicationEnterpriseMeta() *EnterpriseMeta { func ReplicationEnterpriseMeta() *EnterpriseMeta {
return &emptyEnterpriseMeta return &emptyEnterpriseMeta
} }
// DefaultEnterpriseMeta stub // TODO(partition): stop using this
func DefaultEnterpriseMeta() *EnterpriseMeta { func DefaultEnterpriseMetaInDefaultPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta return &emptyEnterpriseMeta
} }
// WildcardEnterpriseMeta stub // DefaultEnterpriseMetaInPartition stub
func WildcardEnterpriseMeta() *EnterpriseMeta { func DefaultEnterpriseMetaInPartition(_ string) *EnterpriseMeta {
return &emptyEnterpriseMeta
}
func NodeEnterpriseMetaInPartition(_ string) *EnterpriseMeta {
return &emptyEnterpriseMeta
}
func NodeEnterpriseMetaInDefaultPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta
}
// TODO(partition): stop using this
func WildcardEnterpriseMetaInDefaultPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta
}
// WildcardEnterpriseMetaInPartition stub
func WildcardEnterpriseMetaInPartition(_ string) *EnterpriseMeta {
return &emptyEnterpriseMeta return &emptyEnterpriseMeta
} }
@ -114,7 +153,7 @@ func ServiceIDString(id string, _ *EnterpriseMeta) string {
} }
func ParseServiceIDString(input string) (string, *EnterpriseMeta) { func ParseServiceIDString(input string) (string, *EnterpriseMeta) {
return input, DefaultEnterpriseMeta() return input, DefaultEnterpriseMetaInDefaultPartition()
} }
func (sid ServiceID) String() string { func (sid ServiceID) String() string {
@ -127,7 +166,7 @@ func ServiceIDFromString(input string) ServiceID {
} }
func ParseServiceNameString(input string) (string, *EnterpriseMeta) { func ParseServiceNameString(input string) (string, *EnterpriseMeta) {
return input, DefaultEnterpriseMeta() return input, DefaultEnterpriseMetaInDefaultPartition()
} }
func (n ServiceName) String() string { func (n ServiceName) String() string {

View File

@ -156,7 +156,7 @@ func (s *HTTPHandlers) convertOps(resp http.ResponseWriter, req *http.Request) (
Value: in.KV.Value, Value: in.KV.Value,
Flags: in.KV.Flags, Flags: in.KV.Flags,
Session: in.KV.Session, Session: in.KV.Session,
EnterpriseMeta: structs.NewEnterpriseMeta(in.KV.Namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(in.KV.Namespace),
RaftIndex: structs.RaftIndex{ RaftIndex: structs.RaftIndex{
ModifyIndex: in.KV.Index, ModifyIndex: in.KV.Index,
}, },
@ -216,7 +216,7 @@ func (s *HTTPHandlers) convertOps(resp http.ResponseWriter, req *http.Request) (
Warning: svc.Weights.Warning, Warning: svc.Weights.Warning,
}, },
EnableTagOverride: svc.EnableTagOverride, EnableTagOverride: svc.EnableTagOverride,
EnterpriseMeta: structs.NewEnterpriseMeta(svc.Namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(svc.Namespace),
RaftIndex: structs.RaftIndex{ RaftIndex: structs.RaftIndex{
ModifyIndex: svc.ModifyIndex, ModifyIndex: svc.ModifyIndex,
}, },
@ -274,7 +274,7 @@ func (s *HTTPHandlers) convertOps(resp http.ResponseWriter, req *http.Request) (
Timeout: timeout, Timeout: timeout,
DeregisterCriticalServiceAfter: deregisterCriticalServiceAfter, DeregisterCriticalServiceAfter: deregisterCriticalServiceAfter,
}, },
EnterpriseMeta: structs.NewEnterpriseMeta(check.Namespace), EnterpriseMeta: structs.NewEnterpriseMetaInDefaultPartition(check.Namespace),
RaftIndex: structs.RaftIndex{ RaftIndex: structs.RaftIndex{
ModifyIndex: check.ModifyIndex, ModifyIndex: check.ModifyIndex,
}, },

View File

@ -621,7 +621,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
&structs.TxnResult{ &structs.TxnResult{
@ -643,7 +643,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
&structs.TxnResult{ &structs.TxnResult{
@ -665,7 +665,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
CreateIndex: index, CreateIndex: index,
ModifyIndex: index, ModifyIndex: index,
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },

View File

@ -611,7 +611,7 @@ func (s *HTTPHandlers) UIMetricsProxy(resp http.ResponseWriter, req *http.Reques
// This endpoint requires wildcard read on all services and all nodes. // This endpoint requires wildcard read on all services and all nodes.
// //
// In enterprise it requires this _in all namespaces_ too. // In enterprise it requires this _in all namespaces_ too.
wildMeta := structs.WildcardEnterpriseMeta() wildMeta := structs.WildcardEnterpriseMetaInDefaultPartition()
var authzContext acl.AuthorizerContext var authzContext acl.AuthorizerContext
wildMeta.FillAuthzContext(&authzContext) wildMeta.FillAuthzContext(&authzContext)

View File

@ -413,7 +413,7 @@ func TestUiServices(t *testing.T) {
ChecksPassing: 2, ChecksPassing: 2,
ChecksWarning: 1, ChecksWarning: 1,
ChecksCritical: 0, ChecksCritical: 0,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
ConnectedWithProxy: true, ConnectedWithProxy: true,
ConnectedWithGateway: true, ConnectedWithGateway: true,
@ -430,7 +430,7 @@ func TestUiServices(t *testing.T) {
ChecksWarning: 0, ChecksWarning: 0,
ChecksCritical: 0, ChecksCritical: 0,
ExternalSources: []string{"k8s"}, ExternalSources: []string{"k8s"},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
{ {
@ -444,7 +444,7 @@ func TestUiServices(t *testing.T) {
ChecksPassing: 0, ChecksPassing: 0,
ChecksWarning: 0, ChecksWarning: 0,
ChecksCritical: 0, ChecksCritical: 0,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
ConnectedWithGateway: true, ConnectedWithGateway: true,
}, },
@ -459,7 +459,7 @@ func TestUiServices(t *testing.T) {
ChecksPassing: 1, ChecksPassing: 1,
ChecksWarning: 0, ChecksWarning: 0,
ChecksCritical: 0, ChecksCritical: 0,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
{ {
@ -474,7 +474,7 @@ func TestUiServices(t *testing.T) {
ChecksWarning: 0, ChecksWarning: 0,
ChecksCritical: 0, ChecksCritical: 0,
GatewayConfig: GatewayConfig{AssociatedServiceCount: 2}, GatewayConfig: GatewayConfig{AssociatedServiceCount: 2},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
{ {
@ -489,7 +489,7 @@ func TestUiServices(t *testing.T) {
ChecksWarning: 0, ChecksWarning: 0,
ChecksCritical: 1, ChecksCritical: 1,
ExternalSources: []string{"k8s"}, ExternalSources: []string{"k8s"},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
} }
@ -526,7 +526,7 @@ func TestUiServices(t *testing.T) {
ChecksPassing: 1, ChecksPassing: 1,
ChecksWarning: 1, ChecksWarning: 1,
ChecksCritical: 0, ChecksCritical: 0,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
ConnectedWithProxy: false, ConnectedWithProxy: false,
ConnectedWithGateway: false, ConnectedWithGateway: false,
@ -543,7 +543,7 @@ func TestUiServices(t *testing.T) {
ChecksWarning: 0, ChecksWarning: 0,
ChecksCritical: 1, ChecksCritical: 1,
ExternalSources: []string{"k8s"}, ExternalSources: []string{"k8s"},
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
} }
@ -687,7 +687,7 @@ func TestUIGatewayServiceNodes_Terminating(t *testing.T) {
expect := []*ServiceSummary{ expect := []*ServiceSummary{
{ {
Name: "redis", Name: "redis",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "db", Name: "db",
@ -698,7 +698,7 @@ func TestUIGatewayServiceNodes_Terminating(t *testing.T) {
ChecksPassing: 1, ChecksPassing: 1,
ChecksWarning: 1, ChecksWarning: 1,
ChecksCritical: 0, ChecksCritical: 0,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
require.ElementsMatch(t, expect, summary) require.ElementsMatch(t, expect, summary)
@ -836,10 +836,10 @@ func TestUIGatewayServiceNodes_Ingress(t *testing.T) {
// Construct expected addresses so that differences between OSS/Ent are // Construct expected addresses so that differences between OSS/Ent are
// handled by code. We specifically don't include the trailing DNS . here as // handled by code. We specifically don't include the trailing DNS . here as
// we are constructing what we are expecting, not the actual value // we are constructing what we are expecting, not the actual value
webDNS := serviceIngressDNSName("web", "dc1", "consul", structs.DefaultEnterpriseMeta()) webDNS := serviceIngressDNSName("web", "dc1", "consul", structs.DefaultEnterpriseMetaInDefaultPartition())
webDNSAlt := serviceIngressDNSName("web", "dc1", "alt.consul", structs.DefaultEnterpriseMeta()) webDNSAlt := serviceIngressDNSName("web", "dc1", "alt.consul", structs.DefaultEnterpriseMetaInDefaultPartition())
dbDNS := serviceIngressDNSName("db", "dc1", "consul", structs.DefaultEnterpriseMeta()) dbDNS := serviceIngressDNSName("db", "dc1", "consul", structs.DefaultEnterpriseMetaInDefaultPartition())
dbDNSAlt := serviceIngressDNSName("db", "dc1", "alt.consul", structs.DefaultEnterpriseMeta()) dbDNSAlt := serviceIngressDNSName("db", "dc1", "alt.consul", structs.DefaultEnterpriseMetaInDefaultPartition())
dump := obj.([]*ServiceSummary) dump := obj.([]*ServiceSummary)
expect := []*ServiceSummary{ expect := []*ServiceSummary{
@ -852,7 +852,7 @@ func TestUIGatewayServiceNodes_Ingress(t *testing.T) {
"*.test.example.com:8081", "*.test.example.com:8081",
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
{ {
Name: "db", Name: "db",
@ -869,7 +869,7 @@ func TestUIGatewayServiceNodes_Ingress(t *testing.T) {
fmt.Sprintf("%s:8888", dbDNSAlt), fmt.Sprintf("%s:8888", dbDNSAlt),
}, },
}, },
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
} }
@ -1383,7 +1383,7 @@ func TestUIServiceTopology(t *testing.T) {
Services: []structs.IngressService{ Services: []structs.IngressService{
{ {
Name: "api", Name: "api",
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
}, },
}, },
@ -1435,7 +1435,7 @@ func TestUIServiceTopology(t *testing.T) {
Nodes: []string{"foo"}, Nodes: []string{"foo"},
InstanceCount: 1, InstanceCount: 1,
ChecksPassing: 3, ChecksPassing: 3,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
TransparentProxy: true, TransparentProxy: true,
}, },
Intention: structs.IntentionDecisionSummary{ Intention: structs.IntentionDecisionSummary{
@ -1483,7 +1483,7 @@ func TestUIServiceTopology(t *testing.T) {
Nodes: []string{"edge"}, Nodes: []string{"edge"},
InstanceCount: 1, InstanceCount: 1,
ChecksPassing: 1, ChecksPassing: 1,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
TransparentProxy: false, TransparentProxy: false,
}, },
Intention: structs.IntentionDecisionSummary{ Intention: structs.IntentionDecisionSummary{
@ -1505,7 +1505,7 @@ func TestUIServiceTopology(t *testing.T) {
ChecksPassing: 3, ChecksPassing: 3,
ChecksWarning: 1, ChecksWarning: 1,
ChecksCritical: 2, ChecksCritical: 2,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
TransparentProxy: false, TransparentProxy: false,
}, },
Intention: structs.IntentionDecisionSummary{ Intention: structs.IntentionDecisionSummary{
@ -1557,7 +1557,7 @@ func TestUIServiceTopology(t *testing.T) {
InstanceCount: 1, InstanceCount: 1,
ChecksPassing: 2, ChecksPassing: 2,
ChecksCritical: 1, ChecksCritical: 1,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
TransparentProxy: false, TransparentProxy: false,
}, },
Intention: structs.IntentionDecisionSummary{ Intention: structs.IntentionDecisionSummary{
@ -1577,7 +1577,7 @@ func TestUIServiceTopology(t *testing.T) {
Nodes: []string{"foo"}, Nodes: []string{"foo"},
InstanceCount: 1, InstanceCount: 1,
ChecksPassing: 3, ChecksPassing: 3,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
TransparentProxy: true, TransparentProxy: true,
}, },
Intention: structs.IntentionDecisionSummary{ Intention: structs.IntentionDecisionSummary{
@ -1630,7 +1630,7 @@ func TestUIServiceTopology(t *testing.T) {
ChecksPassing: 3, ChecksPassing: 3,
ChecksWarning: 1, ChecksWarning: 1,
ChecksCritical: 2, ChecksCritical: 2,
EnterpriseMeta: *structs.DefaultEnterpriseMeta(), EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
}, },
Intention: structs.IntentionDecisionSummary{ Intention: structs.IntentionDecisionSummary{
DefaultAllow: true, DefaultAllow: true,

View File

@ -187,7 +187,7 @@ func (a *Agent) shouldProcessUserEvent(msg *UserEvent) bool {
} }
// Scan for a match // Scan for a match
services := a.State.Services(structs.DefaultEnterpriseMeta()) services := a.State.Services(structs.DefaultEnterpriseMetaInDefaultPartition())
found := false found := false
OUTER: OUTER:
for name, info := range services { for name, info := range services {

View File

@ -598,8 +598,8 @@ func TestListenersFromSnapshot(t *testing.T) {
t, "kafka", "default", "dc1", t, "kafka", "default", "dc1",
connect.TestClusterID+".consul", "dc1", nil) connect.TestClusterID+".consul", "dc1", nil)
kafka := structs.NewServiceName("kafka", structs.DefaultEnterpriseMeta()) kafka := structs.NewServiceName("kafka", structs.DefaultEnterpriseMetaInDefaultPartition())
mongo := structs.NewServiceName("mongo", structs.DefaultEnterpriseMeta()) mongo := structs.NewServiceName("mongo", structs.DefaultEnterpriseMetaInDefaultPartition())
// We add a filter chains for each passthrough service name. // We add a filter chains for each passthrough service name.
// The filter chain will route to a cluster with the same SNI name. // The filter chain will route to a cluster with the same SNI name.

View File

@ -9,5 +9,5 @@ import (
) )
func parseEnterpriseMeta(node *envoy_core_v3.Node) *structs.EnterpriseMeta { func parseEnterpriseMeta(node *envoy_core_v3.Node) *structs.EnterpriseMeta {
return structs.DefaultEnterpriseMeta() return structs.DefaultEnterpriseMetaInDefaultPartition()
} }