Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor internal package structure #169

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ import (
"github.com/dash0hq/dash0-operator/images/pkg/common"
"github.com/dash0hq/dash0-operator/internal/backendconnection"
"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/controller"
"github.com/dash0hq/dash0-operator/internal/dash0/instrumentation"
"github.com/dash0hq/dash0-operator/internal/dash0/predelete"
"github.com/dash0hq/dash0-operator/internal/dash0/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/dash0/startup"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/dash0/webhooks"
"github.com/dash0hq/dash0-operator/internal/controller"
"github.com/dash0hq/dash0-operator/internal/instrumentation"
"github.com/dash0hq/dash0-operator/internal/predelete"
"github.com/dash0hq/dash0-operator/internal/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/startup"
"github.com/dash0hq/dash0-operator/internal/util"
"github.com/dash0hq/dash0-operator/internal/webhooks"
//+kubebuilder:scaffold:imports
)

Expand Down
2 changes: 1 addition & 1 deletion config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Note: The kustomize configs are not used in production, but they are currently still used when setting up the unit
# test environment, like in internal/dash0/webhooks/webhook_suite_test.go -> &envtest.Environment#WebhookInstallOptions.
# test environment, like in internal/webhooks/webhook_suite_test.go -> &envtest.Environment#WebhookInstallOptions.
# Thus, they need to be kept in sync with the webhook resources defined in
# helm-chart/dash0-operator/templates/operator/deployment-and-webhooks.yaml.
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type BackendConnectionReconciler struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/backendconnection/backendconnection_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type BackendConnectionManager struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type OtlpExporter struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
corev1 "k8s.io/api/core/v1"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
4 changes: 2 additions & 2 deletions internal/backendconnection/otelcolresources/desired_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/util"
)

type oTelColConfig struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
corev1 "k8s.io/api/core/v1"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/util"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/util"
)

type OTelColResourceManager struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: true,
BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s",
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
fmt.Sprintf("1.28.3-%s-%s", runtime.GOOS, runtime.GOARCH)),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/backendconnection"
"github.com/dash0hq/dash0-operator/internal/dash0/instrumentation"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/instrumentation"
"github.com/dash0hq/dash0-operator/internal/util"
)

type Dash0Reconciler struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/backendconnection"
"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/instrumentation"
"github.com/dash0hq/dash0-operator/internal/instrumentation"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/util"
)

type OperatorConfigurationReconciler struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/selfmonitoringapiaccess"
"github.com/dash0hq/dash0-operator/internal/util"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type PersesDashboardCrdReconciler struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/yaml"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type PrometheusRuleCrdReconciler struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type ApiClient interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type instrumentableWorkload interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: true,
BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s",
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
fmt.Sprintf("1.28.3-%s-%s", runtime.GOOS, runtime.GOARCH)),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/dash0/workloads"
"github.com/dash0hq/dash0-operator/internal/util"
"github.com/dash0hq/dash0-operator/internal/workloads"
)

type Instrumenter struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/dash0hq/dash0-operator/internal/dash0/controller"
"github.com/dash0hq/dash0-operator/internal/controller"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/backendconnection"
"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/controller"
"github.com/dash0hq/dash0-operator/internal/dash0/instrumentation"
"github.com/dash0hq/dash0-operator/internal/controller"
"github.com/dash0hq/dash0-operator/internal/instrumentation"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -58,9 +58,9 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: true,
BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s",
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
fmt.Sprintf("1.28.3-%s-%s", runtime.GOOS, runtime.GOARCH)),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type OtlpProtocol string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type SecretRef struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: true,
BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s",
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
fmt.Sprintf("1.28.3-%s-%s", runtime.GOOS, runtime.GOARCH)),
}

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.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/backendconnection"
"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/controller"
"github.com/dash0hq/dash0-operator/internal/dash0/instrumentation"
"github.com/dash0hq/dash0-operator/internal/controller"
"github.com/dash0hq/dash0-operator/internal/instrumentation"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/dash0/workloads"
"github.com/dash0hq/dash0-operator/internal/util"
"github.com/dash0hq/dash0-operator/internal/workloads"
)

type InstrumentationWebhookHandler struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: false,
BinaryAssetsDirectory: filepath.Join("..", "..", "..", "bin", "k8s",
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
fmt.Sprintf("1.28.3-%s-%s", runtime.GOOS, runtime.GOARCH)),
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")},
Paths: []string{filepath.Join("..", "..", "config", "webhook")},
},
}
Expect(testEnv).NotTo(BeNil())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/dash0hq/dash0-operator/internal/backendconnection/otelcolresources"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"sigs.k8s.io/controller-runtime/pkg/log"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"

. "github.com/dash0hq/dash0-operator/test/util"
)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/google/uuid"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/startup"
"github.com/dash0hq/dash0-operator/internal/startup"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

corev1 "k8s.io/api/core/v1"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"

. "github.com/onsi/gomega"

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"time"

"github.com/dash0hq/dash0-operator/internal/dash0/startup"
"github.com/dash0hq/dash0-operator/internal/startup"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
2 changes: 1 addition & 1 deletion test/util/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"

dash0v1alpha1 "github.com/dash0hq/dash0-operator/api/dash0monitoring/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion test/util/controller_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

func CreateControllerDeploymentWithoutSelfMonitoringWithoutAuth() *appsv1.Deployment {
Expand Down
2 changes: 1 addition & 1 deletion test/util/matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

corev1 "k8s.io/api/core/v1"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"

"github.com/onsi/gomega"
"github.com/onsi/gomega/format"
Expand Down
2 changes: 1 addition & 1 deletion test/util/verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

. "github.com/onsi/gomega"

"github.com/dash0hq/dash0-operator/internal/dash0/util"
"github.com/dash0hq/dash0-operator/internal/util"
)

type ContainerExpectations struct {
Expand Down