mirror of https://github.com/status-im/consul.git
structs: rename the last helper method.
This one gets used a bunch, but we can rename it to make the behaviour more obvious.
This commit is contained in:
parent
8d8c1f9d5e
commit
eb632c53a2
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -491,7 +491,7 @@ func validateProposedConfigEntryInServiceGraph(
|
|||
enforceIngressProtocolsMatch bool
|
||||
)
|
||||
|
||||
wildcardEntMeta := kindName.WildcardEnterpriseMetaForPartition()
|
||||
wildcardEntMeta := kindName.WithWildcardNamespace()
|
||||
|
||||
switch kindName.Kind {
|
||||
case structs.ProxyDefaults:
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -42,7 +42,7 @@ func (m *EnterpriseMeta) LessThan(_ *EnterpriseMeta) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (m *EnterpriseMeta) WildcardEnterpriseMetaForPartition() *EnterpriseMeta {
|
||||
func (m *EnterpriseMeta) WithWildcardNamespace() *EnterpriseMeta {
|
||||
return &emptyEnterpriseMeta
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue