Skip to content

Commit

Permalink
[chore] move all target-allocator code to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Jan 20, 2025
1 parent a36367b commit 3f2944a
Show file tree
Hide file tree
Showing 43 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions cmd/otel-allocator/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/prehook"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/server"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/prehook"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/server"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

// BenchmarkProcessTargets benchmarks the whole target allocation pipeline. It starts with data the prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/go-logr/logr"
"github.com/prometheus/client_golang/prometheus"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/diff"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/diff"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/assert"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

func TestSetCollectors(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/buraksezer/consistent"
"github.com/cespare/xxhash/v2"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

const consistentHashingStrategyName = "consistent-hashing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package allocation

import (
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

const leastWeightedStrategyName = "least-weighted"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package allocation
import (
"fmt"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

const perNodeStrategyName = "per-node"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/assert"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

var loggerPerNode = logf.Log.WithName("unit-tests")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

type AllocatorProvider func(log logr.Logger, opts ...AllocationOption) Allocator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"reflect"
"testing"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/diff"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/diff"
)

func BenchmarkGetAllTargetsByCollectorAndJob(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/stretchr/testify/require"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

func colIndex(index, numCols int) int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/client-go/kubernetes/fake"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
)

var logger = logf.Log.WithName("collector-unit-tests")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/go-logr/logr"
"github.com/prometheus/prometheus/model/relabel"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/go-logr/logr"
"github.com/prometheus/prometheus/model/relabel"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

type RelabelConfigTargetFilter struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/stretchr/testify/assert"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/assert"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

func BenchmarkServerTargetsHandler(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package server

import (
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

var _ allocation.Allocator = &mockAllocator{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (
"github.com/prometheus/prometheus/model/labels"
"gopkg.in/yaml.v2"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (
"gopkg.in/yaml.v2"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/config"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/config"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"go.uber.org/zap/zapcore"
"gopkg.in/yaml.v3"

allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/watcher"
allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/watcher"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"github.com/stretchr/testify/require"
ctrl "sigs.k8s.io/controller-runtime"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/config"
allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/watcher"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/config"
allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/watcher"
)

var defaultScrapeProtocols = []promconfig.ScrapeProtocol{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/retry"

allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/config"
allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/config"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
fcache "k8s.io/client-go/tools/cache/testing"
"k8s.io/utils/ptr"

allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/config"
allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/config"
)

var defaultScrapeProtocols = []promconfig.ScrapeProtocol{
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions cmd/otel-allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
ctrl "sigs.k8s.io/controller-runtime"

"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/collector"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/config"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/prehook"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/server"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/target"
allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/watcher"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/allocation"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/collector"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/config"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/prehook"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/server"
"github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/target"
allocatorWatcher "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/internal/watcher"
)

var (
Expand Down

0 comments on commit 3f2944a

Please sign in to comment.