Skip to content

Commit 1d19ef7

Browse files
committed
move tenant pkg
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
1 parent 9e281f2 commit 1d19ef7

File tree

73 files changed

+97
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+97
-104
lines changed

pkg/alertmanager/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import (
1818
"gopkg.in/yaml.v2"
1919

2020
"github.com/cortexproject/cortex/pkg/alertmanager/alertspb"
21-
"github.com/cortexproject/cortex/pkg/tenant"
2221
"github.com/cortexproject/cortex/pkg/util"
2322
"github.com/cortexproject/cortex/pkg/util/concurrency"
2423
util_log "github.com/cortexproject/cortex/pkg/util/log"
24+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
2525
)
2626

2727
const (

pkg/alertmanager/distributor.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ import (
2121
"github.com/cortexproject/cortex/pkg/alertmanager/merger"
2222
"github.com/cortexproject/cortex/pkg/ring"
2323
"github.com/cortexproject/cortex/pkg/ring/client"
24-
"github.com/cortexproject/cortex/pkg/tenant"
2524
"github.com/cortexproject/cortex/pkg/util"
2625
util_log "github.com/cortexproject/cortex/pkg/util/log"
2726
"github.com/cortexproject/cortex/pkg/util/services"
28-
"github.com/cortexproject/cortex/pkg/util/users"
27+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
2928
)
3029

3130
// Distributor forwards requests to individual alertmanagers.
@@ -98,7 +97,7 @@ func (d *Distributor) isQuorumReadPath(p string) (bool, merger.Merger) {
9897
// In case of reads, it proxies the request to one of the alertmanagers.
9998
// DistributeRequest assumes that the caller has verified IsPathSupported returns
10099
// true for the route.
101-
func (d *Distributor) DistributeRequest(w http.ResponseWriter, r *http.Request, allowedTenants *users.AllowedTenants) {
100+
func (d *Distributor) DistributeRequest(w http.ResponseWriter, r *http.Request, allowedTenants *tenant.AllowedTenants) {
102101
d.requestsInFlight.Add(1)
103102
defer d.requestsInFlight.Done()
104103

pkg/alertmanager/distributor_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
util_log "github.com/cortexproject/cortex/pkg/util/log"
3232
"github.com/cortexproject/cortex/pkg/util/services"
3333
"github.com/cortexproject/cortex/pkg/util/test"
34-
"github.com/cortexproject/cortex/pkg/util/users"
34+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
3535
)
3636

3737
func TestDistributor_DistributeRequest(t *testing.T) {
@@ -262,9 +262,9 @@ func TestDistributor_DistributeRequest(t *testing.T) {
262262
req.Method = http.MethodDelete
263263
}
264264
req.RequestURI = url
265-
var allowedTenants *users.AllowedTenants
265+
var allowedTenants *tenant.AllowedTenants
266266
if c.isTenantDisabled {
267-
allowedTenants = users.NewAllowedTenants(nil, []string{"1"})
267+
allowedTenants = tenant.NewAllowedTenants(nil, []string{"1"})
268268
}
269269

270270
w := httptest.NewRecorder()

pkg/alertmanager/multitenant.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ import (
3333
"github.com/cortexproject/cortex/pkg/ring"
3434
"github.com/cortexproject/cortex/pkg/ring/client"
3535
"github.com/cortexproject/cortex/pkg/ring/kv"
36-
"github.com/cortexproject/cortex/pkg/tenant"
3736
"github.com/cortexproject/cortex/pkg/util"
3837
"github.com/cortexproject/cortex/pkg/util/concurrency"
3938
"github.com/cortexproject/cortex/pkg/util/flagext"
4039
util_log "github.com/cortexproject/cortex/pkg/util/log"
4140
"github.com/cortexproject/cortex/pkg/util/services"
42-
"github.com/cortexproject/cortex/pkg/util/users"
41+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
4342
)
4443

4544
const (
@@ -285,7 +284,7 @@ type MultitenantAlertmanager struct {
285284

286285
limits Limits
287286

288-
allowedTenants *users.AllowedTenants
287+
allowedTenants *tenant.AllowedTenants
289288

290289
registry prometheus.Registerer
291290
ringCheckErrors prometheus.Counter
@@ -378,7 +377,7 @@ func createMultitenantAlertmanager(cfg *MultitenantAlertmanagerConfig, fallbackC
378377
logger: log.With(logger, "component", "MultiTenantAlertmanager"),
379378
registry: registerer,
380379
limits: limits,
381-
allowedTenants: users.NewAllowedTenants(cfg.EnabledTenants, cfg.DisabledTenants),
380+
allowedTenants: tenant.NewAllowedTenants(cfg.EnabledTenants, cfg.DisabledTenants),
382381
ringCheckErrors: promauto.With(registerer).NewCounter(prometheus.CounterOpts{
383382
Name: "cortex_alertmanager_ring_check_errors_total",
384383
Help: "Number of errors that have occurred when checking the ring for ownership.",

pkg/compactor/blocks_cleaner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import (
2121
"github.com/cortexproject/cortex/pkg/storage/bucket"
2222
cortex_parquet "github.com/cortexproject/cortex/pkg/storage/parquet"
2323
"github.com/cortexproject/cortex/pkg/storage/tsdb/bucketindex"
24-
"github.com/cortexproject/cortex/pkg/tenant"
2524
"github.com/cortexproject/cortex/pkg/util"
2625
"github.com/cortexproject/cortex/pkg/util/concurrency"
2726
util_log "github.com/cortexproject/cortex/pkg/util/log"
2827
"github.com/cortexproject/cortex/pkg/util/services"
2928
"github.com/cortexproject/cortex/pkg/util/users"
29+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
3030
)
3131

3232
const (

pkg/compactor/blocks_cleaner_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ import (
2323
"github.com/cortexproject/cortex/pkg/storage/parquet"
2424
"github.com/cortexproject/cortex/pkg/storage/tsdb"
2525
"github.com/cortexproject/cortex/pkg/storage/tsdb/bucketindex"
26-
"github.com/cortexproject/cortex/pkg/tenant"
2726
"github.com/cortexproject/cortex/pkg/util"
2827
util_log "github.com/cortexproject/cortex/pkg/util/log"
2928
"github.com/cortexproject/cortex/pkg/util/services"
3029
cortex_testutil "github.com/cortexproject/cortex/pkg/util/testutil"
3130
"github.com/cortexproject/cortex/pkg/util/users"
31+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
3232
)
3333

3434
type testBlocksCleanerOptions struct {

pkg/compactor/compactor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ import (
3333
"github.com/cortexproject/cortex/pkg/storage/bucket"
3434
cortex_tsdb "github.com/cortexproject/cortex/pkg/storage/tsdb"
3535
"github.com/cortexproject/cortex/pkg/storage/tsdb/bucketindex"
36-
"github.com/cortexproject/cortex/pkg/tenant"
3736
"github.com/cortexproject/cortex/pkg/util"
3837
"github.com/cortexproject/cortex/pkg/util/backoff"
3938
"github.com/cortexproject/cortex/pkg/util/flagext"
4039
util_log "github.com/cortexproject/cortex/pkg/util/log"
4140
"github.com/cortexproject/cortex/pkg/util/services"
4241
"github.com/cortexproject/cortex/pkg/util/users"
42+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
4343
"github.com/cortexproject/cortex/pkg/util/validation"
4444
)
4545

@@ -405,7 +405,7 @@ type Compactor struct {
405405
logger log.Logger
406406
parentLogger log.Logger
407407
registerer prometheus.Registerer
408-
allowedTenants *users.AllowedTenants
408+
allowedTenants *tenant.AllowedTenants
409409
limits *validation.Overrides
410410

411411
// Functions that creates bucket client, grouper, planner and compactor using the context.
@@ -543,7 +543,7 @@ func newCompactor(
543543
blocksCompactorFactory: blocksCompactorFactory,
544544
blockDeletableCheckerFactory: blockDeletableCheckerFactory,
545545
compactionLifecycleCallbackFactory: compactionLifecycleCallbackFactory,
546-
allowedTenants: users.NewAllowedTenants(compactorCfg.EnabledTenants, compactorCfg.DisabledTenants),
546+
allowedTenants: tenant.NewAllowedTenants(compactorCfg.EnabledTenants, compactorCfg.DisabledTenants),
547547

548548
CompactorStartDurationSeconds: promauto.With(registerer).NewGauge(prometheus.GaugeOpts{
549549
Name: "cortex_compactor_start_duration_seconds",

pkg/compactor/compactor_paritioning_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ import (
3434
"github.com/cortexproject/cortex/pkg/storage/bucket"
3535
cortex_tsdb "github.com/cortexproject/cortex/pkg/storage/tsdb"
3636
"github.com/cortexproject/cortex/pkg/storage/tsdb/bucketindex"
37-
"github.com/cortexproject/cortex/pkg/tenant"
3837
"github.com/cortexproject/cortex/pkg/util"
3938
"github.com/cortexproject/cortex/pkg/util/concurrency"
4039
"github.com/cortexproject/cortex/pkg/util/flagext"
4140
"github.com/cortexproject/cortex/pkg/util/services"
4241
cortex_testutil "github.com/cortexproject/cortex/pkg/util/test"
4342
"github.com/cortexproject/cortex/pkg/util/testutil"
4443
"github.com/cortexproject/cortex/pkg/util/users"
44+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
4545
"github.com/cortexproject/cortex/pkg/util/validation"
4646
)
4747

pkg/compactor/compactor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ import (
4040
"github.com/cortexproject/cortex/pkg/storage/parquet"
4141
cortex_tsdb "github.com/cortexproject/cortex/pkg/storage/tsdb"
4242
"github.com/cortexproject/cortex/pkg/storage/tsdb/bucketindex"
43-
"github.com/cortexproject/cortex/pkg/tenant"
4443
"github.com/cortexproject/cortex/pkg/util"
4544
"github.com/cortexproject/cortex/pkg/util/concurrency"
4645
"github.com/cortexproject/cortex/pkg/util/flagext"
4746
"github.com/cortexproject/cortex/pkg/util/services"
4847
cortex_testutil "github.com/cortexproject/cortex/pkg/util/test"
4948
"github.com/cortexproject/cortex/pkg/util/testutil"
5049
"github.com/cortexproject/cortex/pkg/util/users"
50+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
5151
"github.com/cortexproject/cortex/pkg/util/validation"
5252
)
5353

pkg/configs/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222

2323
"github.com/cortexproject/cortex/pkg/configs/db"
2424
"github.com/cortexproject/cortex/pkg/configs/userconfig"
25-
"github.com/cortexproject/cortex/pkg/tenant"
2625
"github.com/cortexproject/cortex/pkg/util"
2726
util_log "github.com/cortexproject/cortex/pkg/util/log"
27+
"github.com/cortexproject/cortex/pkg/util/users/tenant"
2828
)
2929

3030
var (

0 commit comments

Comments
 (0)