diff --git a/agent/checks/alias.go b/agent/checks/alias.go index 78c4a32b4c..0a915e8cb7 100644 --- a/agent/checks/alias.go +++ b/agent/checks/alias.go @@ -108,7 +108,7 @@ func (c *CheckAlias) runLocal(stopCh chan struct{}) { } updateStatus := func() { - checks := c.Notify.Checks(c.WildcardEnterpriseMetaForPartition()) + checks := c.Notify.Checks(c.WithWildcardNamespace()) checksList := make([]*structs.HealthCheck, 0, len(checks)) for _, chk := range checks { checksList = append(checksList, chk) diff --git a/agent/consul/config_endpoint.go b/agent/consul/config_endpoint.go index b30269c599..43e5d3374f 100644 --- a/agent/consul/config_endpoint.go +++ b/agent/consul/config_endpoint.go @@ -479,7 +479,7 @@ func (c *ConfigEntry) ResolveServiceConfig(args *structs.ServiceConfigRequest, r cfgMap := make(map[string]interface{}) upstreamDefaults.MergeInto(cfgMap) - wildcard := structs.NewServiceID(structs.WildcardSpecifier, args.WildcardEnterpriseMetaForPartition()) + wildcard := structs.NewServiceID(structs.WildcardSpecifier, args.WithWildcardNamespace()) usConfigs[wildcard] = cfgMap } } diff --git a/agent/consul/state/acl.go b/agent/consul/state/acl.go index 548bb7c957..fdc20a8056 100644 --- a/agent/consul/state/acl.go +++ b/agent/consul/state/acl.go @@ -863,7 +863,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 { // collect all the tokens linked with the given auth method. - iter, err := aclTokenListByAuthMethod(tx, methodName, methodMeta, methodMeta.WildcardEnterpriseMetaForPartition()) + iter, err := aclTokenListByAuthMethod(tx, methodName, methodMeta, methodMeta.WithWildcardNamespace()) if err != nil { return fmt.Errorf("failed acl token lookup: %v", err) } diff --git a/agent/consul/state/catalog.go b/agent/consul/state/catalog.go index 72b4ba5645..f60579a63d 100644 --- a/agent/consul/state/catalog.go +++ b/agent/consul/state/catalog.go @@ -1540,7 +1540,7 @@ func (s *Store) EnsureCheck(idx uint64, hc *structs.HealthCheck) error { func updateAllServiceIndexesOfNode(tx WriteTxn, idx uint64, nodeID string, entMeta *structs.EnterpriseMeta) error { services, err := tx.Get(tableServices, indexNode, Query{ Value: nodeID, - EnterpriseMeta: *entMeta.WildcardEnterpriseMetaForPartition(), + EnterpriseMeta: *entMeta.WithWildcardNamespace(), }) if err != nil { return fmt.Errorf("failed updating services for node %s: %s", nodeID, err) @@ -2359,7 +2359,7 @@ func parseCheckServiceNodes( q := NodeServiceQuery{ Node: sn.Node, Service: "", // node checks have no service - EnterpriseMeta: *sn.EnterpriseMeta.WildcardEnterpriseMetaForPartition(), + EnterpriseMeta: *sn.EnterpriseMeta.WithWildcardNamespace(), } iter, err := tx.Get(tableChecks, indexNodeService, q) if err != nil { diff --git a/agent/consul/state/config_entry.go b/agent/consul/state/config_entry.go index 1dc00e0463..7ab78ac6ce 100644 --- a/agent/consul/state/config_entry.go +++ b/agent/consul/state/config_entry.go @@ -491,7 +491,7 @@ func validateProposedConfigEntryInServiceGraph( enforceIngressProtocolsMatch bool ) - wildcardEntMeta := kindName.WildcardEnterpriseMetaForPartition() + wildcardEntMeta := kindName.WithWildcardNamespace() switch kindName.Kind { case structs.ProxyDefaults: diff --git a/agent/consul/state/config_entry_intention.go b/agent/consul/state/config_entry_intention.go index 4c7ac078ce..a66156e68b 100644 --- a/agent/consul/state/config_entry_intention.go +++ b/agent/consul/state/config_entry_intention.go @@ -128,7 +128,7 @@ func configIntentionsListTxn(tx ReadTxn, ws memdb.WatchSet, entMeta *structs.Ent idx := maxIndexTxn(tx, tableConfigEntries) - iter, err := getConfigEntryKindsWithTxn(tx, structs.ServiceIntentions, entMeta.WildcardEnterpriseMetaForPartition()) + iter, err := getConfigEntryKindsWithTxn(tx, structs.ServiceIntentions, entMeta.WithWildcardNamespace()) if err != nil { return 0, nil, false, fmt.Errorf("failed config entry lookup: %s", err) } diff --git a/agent/consul/state/intention.go b/agent/consul/state/intention.go index 8ddab2aa99..72850b29e9 100644 --- a/agent/consul/state/intention.go +++ b/agent/consul/state/intention.go @@ -1017,7 +1017,7 @@ func (s *Store) intentionTopologyTxn(tx ReadTxn, ws memdb.WatchSet, return true } return false - }, target.WildcardEnterpriseMetaForPartition()) + }, target.WithWildcardNamespace()) if err != nil { return index, nil, fmt.Errorf("failed to fetch catalog service list: %v", err) } diff --git a/agent/dns.go b/agent/dns.go index 5693178c28..1e25305fdf 100644 --- a/agent/dns.go +++ b/agent/dns.go @@ -417,7 +417,7 @@ func (d *DNSServer) handlePtr(resp dns.ResponseWriter, req *dns.Msg) { AllowStale: cfg.AllowStale, }, ServiceAddress: serviceAddress, - EnterpriseMeta: *d.defaultEnterpriseMeta.WildcardEnterpriseMetaForPartition(), + EnterpriseMeta: *d.defaultEnterpriseMeta.WithWildcardNamespace(), } var sout structs.IndexedServiceNodes diff --git a/agent/local/state.go b/agent/local/state.go index 862f046fe2..b279f3b1d1 100644 --- a/agent/local/state.go +++ b/agent/local/state.go @@ -989,7 +989,7 @@ func (l *State) updateSyncState() error { AllowStale: true, MaxStaleDuration: fullSyncReadMaxStale, }, - EnterpriseMeta: *l.agentEnterpriseMeta.WildcardEnterpriseMetaForPartition(), + EnterpriseMeta: *l.agentEnterpriseMeta.WithWildcardNamespace(), } var out1 structs.IndexedNodeServiceList diff --git a/agent/proxycfg/connect_proxy.go b/agent/proxycfg/connect_proxy.go index 80316615bf..c4eeaee732 100644 --- a/agent/proxycfg/connect_proxy.go +++ b/agent/proxycfg/connect_proxy.go @@ -235,7 +235,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 // This is only relevant to upstreams from intentions because for explicit upstreams the defaulting is handled // by the ResolveServiceConfig endpoint. - wildcardSID := structs.NewServiceID(structs.WildcardSpecifier, s.proxyID.WildcardEnterpriseMetaForPartition()) + wildcardSID := structs.NewServiceID(structs.WildcardSpecifier, s.proxyID.WithWildcardNamespace()) defaults, ok := snap.ConnectProxy.UpstreamConfig[wildcardSID.String()] if ok { u = defaults diff --git a/agent/proxycfg/mesh_gateway.go b/agent/proxycfg/mesh_gateway.go index 5ffc590b4f..6a0856cf94 100644 --- a/agent/proxycfg/mesh_gateway.go +++ b/agent/proxycfg/mesh_gateway.go @@ -29,7 +29,7 @@ func (s *handlerMeshGateway) initialize(ctx context.Context) (ConfigSnapshot, er return snap, err } - wildcardEntMeta := s.proxyID.WildcardEnterpriseMetaForPartition() + wildcardEntMeta := s.proxyID.WithWildcardNamespace() // Watch for all services err = s.cache.Notify(ctx, cachetype.CatalogServiceListName, &structs.DCSpecificRequest{ diff --git a/agent/structs/structs_oss.go b/agent/structs/structs_oss.go index 7a72d0cab4..2d590ad06a 100644 --- a/agent/structs/structs_oss.go +++ b/agent/structs/structs_oss.go @@ -42,7 +42,7 @@ func (m *EnterpriseMeta) LessThan(_ *EnterpriseMeta) bool { return false } -func (m *EnterpriseMeta) WildcardEnterpriseMetaForPartition() *EnterpriseMeta { +func (m *EnterpriseMeta) WithWildcardNamespace() *EnterpriseMeta { return &emptyEnterpriseMeta } diff --git a/agent/ui_endpoint.go b/agent/ui_endpoint.go index 6b0fb28fb8..71342ada8a 100644 --- a/agent/ui_endpoint.go +++ b/agent/ui_endpoint.go @@ -633,7 +633,7 @@ func (s *HTTPHandlers) UIMetricsProxy(resp http.ResponseWriter, req *http.Reques // // TODO(partitions,acls): need to revisit this var authzContext acl.AuthorizerContext - entMeta.WildcardEnterpriseMetaForPartition().FillAuthzContext(&authzContext) + entMeta.WithWildcardNamespace().FillAuthzContext(&authzContext) if authz.NodeReadAll(&authzContext) != acl.Allow || authz.ServiceReadAll(&authzContext) != acl.Allow { return nil, acl.ErrPermissionDenied