Skip to content

Commit

Permalink
Enable Multi-group API support Kubebuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaizanse committed Nov 17, 2023
1 parent 93ade6c commit 76e00bb
Show file tree
Hide file tree
Showing 59 changed files with 129 additions and 119 deletions.
3 changes: 2 additions & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
domain: kyma-project.io
layout:
- go.kubebuilder.io/v4
multigroup: true
projectName: eventing-manager
repo: github.com/kyma-project/eventing-manager
resources:
Expand All @@ -15,6 +16,6 @@ resources:
domain: kyma-project.io
group: operator
kind: Eventing
path: github.com/kyma-project/eventing-manager/api/v1alpha1
path: github.com/kyma-project/eventing-manager/api/batch/v1alpha1
version: v1alpha1
version: "3"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"log"
"os"

eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/batch/eventing"

istiopeerauthentication "github.com/kyma-project/eventing-manager/pkg/istio/peerauthentication"

"github.com/go-logr/zapr"
Expand All @@ -36,7 +38,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"

eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/eventing"
"github.com/kyma-project/eventing-manager/options"
backendmetrics "github.com/kyma-project/eventing-manager/pkg/backend/metrics"
"github.com/kyma-project/eventing-manager/pkg/env"
Expand All @@ -57,7 +58,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
//+kubebuilder:scaffold:imports
)

Expand Down
77 changes: 40 additions & 37 deletions docs/user/02-configuration.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hack/e2e/cleanup/cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/hack/e2e/common/testenvironment"
"github.com/kyma-project/eventing-manager/pkg/eventing"

Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/common/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/kyma-project/eventing-manager/hack/e2e/common/eventing"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/common/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
ecv1alpha1 "github.com/kyma-project/kyma/components/eventing-controller/api/v1alpha1"
ecv1alpha2 "github.com/kyma-project/kyma/components/eventing-controller/api/v1alpha2"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"

"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/common/testenvironment/test_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/cloudevents/sdk-go/v2/binding"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"

ecv1alpha2 "github.com/kyma-project/kyma/components/eventing-controller/api/v1alpha2"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/kelseyhightower/envconfig"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
)

// E2EConfig represents the environment config for the end-to-end tests for eventing-manager.
Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/setup/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/pkg/errors"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/pkg/eventing"

"github.com/stretchr/testify/require"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/options"
"github.com/kyma-project/eventing-manager/pkg/env"
"github.com/kyma-project/eventing-manager/pkg/eventing"
Expand Down Expand Up @@ -74,8 +74,8 @@ const (

// Reconciler reconciles an Eventing object
//
//go:generate go run github.com/vektra/mockery/v2 --name=Controller --dir=../../../vendor/sigs.k8s.io/controller-runtime/pkg/controller --outpkg=mocks --case=underscore
//go:generate go run github.com/vektra/mockery/v2 --name=Manager --dir=../../../vendor/sigs.k8s.io/controller-runtime/pkg/manager --outpkg=mocks --case=underscore
//go:generate go run github.com/vektra/mockery/v2 --name=Controller --dir=../../../../vendor/sigs.k8s.io/controller-runtime/pkg/controller --outpkg=mocks --case=underscore
//go:generate go run github.com/vektra/mockery/v2 --name=Manager --dir=../../../../vendor/sigs.k8s.io/controller-runtime/pkg/manager --outpkg=mocks --case=underscore
type Reconciler struct {
client.Client
logger *logger.Logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/kyma-project/eventing-manager/pkg/watcher"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
submanagermocks "github.com/kyma-project/eventing-manager/pkg/subscriptionmanager/manager/mocks"
watchmock "github.com/kyma-project/eventing-manager/pkg/watcher/mocks"
testutils "github.com/kyma-project/eventing-manager/test/utils"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"github.com/kyma-project/eventing-manager/api/v1alpha1"
"github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/pkg/env"
"github.com/kyma-project/eventing-manager/pkg/eventing"
subscriptionmanager "github.com/kyma-project/eventing-manager/pkg/subscriptionmanager/manager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/kyma-project/eventing-manager/pkg/eventing"

"github.com/kyma-project/eventing-manager/api/v1alpha1"
"github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/pkg/k8s"
k8smocks "github.com/kyma-project/eventing-manager/pkg/k8s/mocks"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"os"
"testing"

eventing2 "github.com/kyma-project/eventing-manager/internal/controller/batch/eventing"

"github.com/onsi/gomega"
gomegatypes "github.com/onsi/gomega/types"
"github.com/stretchr/testify/require"
Expand All @@ -19,8 +21,7 @@ import (
natsv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1"
natstestutils "github.com/kyma-project/nats-manager/testutils"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/eventing"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/pkg/eventing"
"github.com/kyma-project/eventing-manager/pkg/k8s"
"github.com/kyma-project/eventing-manager/test/matchers"
Expand All @@ -29,7 +30,7 @@ import (
)

const (
projectRootDir = "../../../../../"
projectRootDir = "../../../../../../"
eventTypePrefix = "test-prefix"
)

Expand Down Expand Up @@ -161,7 +162,7 @@ func Test_CreateEventingCR_NATS(t *testing.T) {
g := gomega.NewWithT(t)

// given
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool {
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool {
return tc.givenDeploymentReady
}
// create unique namespace for this test run.
Expand Down Expand Up @@ -244,7 +245,7 @@ func Test_UpdateEventingCR(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
// given
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool {
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool {
return true
}
// create unique namespace for this test run.
Expand Down Expand Up @@ -298,7 +299,7 @@ func Test_ReconcileSameEventingCR(t *testing.T) {
////
// given
////
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool { return true }
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool { return true }

eventingCR := utils.NewEventingCR(
utils.WithEventingCRMinimal(),
Expand Down Expand Up @@ -527,7 +528,7 @@ func Test_WatcherEventingCRK8sObjects(t *testing.T) {

// given
g := gomega.NewWithT(t)
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool {
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool {
return true
}

Expand Down Expand Up @@ -637,7 +638,7 @@ func Test_CreateEventingCR_EventMesh(t *testing.T) {
g := gomega.NewWithT(t)

// given
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool {
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool {
return tc.givenDeploymentReady
}

Expand Down Expand Up @@ -719,7 +720,7 @@ func Test_DeleteEventingCR(t *testing.T) {
givenSubscription: utils.NewSubscription("test-nats-subscription", "test-nats-namespace"),
wantMatches: gomega.And(
matchers.HaveStatusWarning(),
matchers.HaveDeletionErrorCondition(eventingcontroller.SubscriptionExistsErrMessage),
matchers.HaveDeletionErrorCondition(eventing2.SubscriptionExistsErrMessage),
matchers.HaveFinalizer(),
),
},
Expand All @@ -734,7 +735,7 @@ func Test_DeleteEventingCR(t *testing.T) {
givenSubscription: utils.NewSubscription("test-eventmesh-subscription", "test-eventmesh-namespace"),
wantMatches: gomega.And(
matchers.HaveStatusWarning(),
matchers.HaveDeletionErrorCondition(eventingcontroller.SubscriptionExistsErrMessage),
matchers.HaveDeletionErrorCondition(eventing2.SubscriptionExistsErrMessage),
matchers.HaveFinalizer(),
),
},
Expand All @@ -747,7 +748,7 @@ func Test_DeleteEventingCR(t *testing.T) {
g := gomega.NewWithT(t)

// given
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool {
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool {
return true
}

Expand Down Expand Up @@ -924,7 +925,7 @@ func Test_WatcherNATSResource(t *testing.T) {
g := gomega.NewWithT(t)

// given
eventingcontroller.IsDeploymentReady = func(deployment *v1.Deployment) bool {
eventing2.IsDeploymentReady = func(deployment *v1.Deployment) bool {
return true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"os"
"testing"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/eventing"
eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/batch/eventing"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/pkg/eventing"
"github.com/kyma-project/eventing-manager/test/matchers"
"github.com/kyma-project/eventing-manager/test/utils"
Expand All @@ -20,7 +21,7 @@ import (
)

const (
projectRootDir = "../../../../../"
projectRootDir = "../../../../../../"
)

var testEnvironment *testutils.TestEnvironment //nolint:gochecknoglobals // used in tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

natstestutils "github.com/kyma-project/nats-manager/testutils"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/test/matchers"
testutils "github.com/kyma-project/eventing-manager/test/utils"

Expand All @@ -17,7 +17,7 @@ import (
)

const (
projectRootDir = "../../../../../"
projectRootDir = "../../../../../../"
)

var testEnvironment *integrationutils.TestEnvironment //nolint:gochecknoglobals // used in tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ import (
"os"
"testing"

eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/eventing"
eventingcontroller "github.com/kyma-project/eventing-manager/internal/controller/batch/eventing"

"github.com/kyma-project/eventing-manager/pkg/k8s"
"github.com/kyma-project/eventing-manager/test/matchers"
"github.com/kyma-project/eventing-manager/test/utils"
natstestutils "github.com/kyma-project/nats-manager/testutils"
"github.com/onsi/gomega"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/pkg/eventing"
testutils "github.com/kyma-project/eventing-manager/test/utils/integration"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
)

const (
projectRootDir = "../../../../../"
projectRootDir = "../../../../../../"
)

var testEnvironment *testutils.TestEnvironment //nolint:gochecknoglobals // used in tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/kyma-project/eventing-manager/api/v1alpha1"
"github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/test"
eventingMatchers "github.com/kyma-project/eventing-manager/test/matchers"
"github.com/kyma-project/eventing-manager/test/utils/integration"
Expand All @@ -18,7 +18,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

const projectRootDir = "../../../../../"
const projectRootDir = "../../../../../../"

const noError = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1"
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/test/matchers"
"github.com/kyma-project/eventing-manager/test/utils"
testutils "github.com/kyma-project/eventing-manager/test/utils/integration"
Expand All @@ -13,7 +13,7 @@ import (
)

const (
projectRootDir = "../../../../../"
projectRootDir = "../../../../../../"
)

var testEnvironment *testutils.TestEnvironment //nolint:gochecknoglobals // used in tests
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/kyma-project/eventing-manager/pkg/subscriptionmanager/manager"

"github.com/kyma-project/eventing-manager/api/v1alpha1"
"github.com/kyma-project/eventing-manager/api/batch/v1alpha1"
"github.com/kyma-project/eventing-manager/options"
"github.com/kyma-project/eventing-manager/pkg/env"
"github.com/kyma-project/eventing-manager/pkg/k8s"
Expand Down
Loading

0 comments on commit 76e00bb

Please sign in to comment.