Skip to content

Commit

Permalink
Move controllers to internal/controllers (#519)
Browse files Browse the repository at this point in the history
Rename NodeModulesConfigReconciler to NMCReconciler.
Use private interfaces for the NMCReconciler for consistency.

Upstream-Commit: 7e339cb
  • Loading branch information
qbarrand committed Aug 25, 2023
1 parent 2433383 commit 68c6aae
Show file tree
Hide file tree
Showing 33 changed files with 107 additions and 103 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ COPY vendor vendor
COPY api api
COPY api-hub api-hub
COPY cmd cmd
COPY controllers controllers
COPY docs.mk docs.mk
COPY internal internal

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ help: ## Display this help.
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) crd paths="./api/..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) webhook paths="./api/..." output:webhook:artifacts:config=config/webhook
$(CONTROLLER_GEN) rbac:roleName=manager-role paths="./controllers" output:rbac:artifacts:config=config/rbac
$(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/controllers" output:rbac:artifacts:config=config/rbac
# Hub
$(CONTROLLER_GEN) crd paths="./api-hub/..." output:crd:artifacts:config=config/crd-hub/bases
$(CONTROLLER_GEN) webhook paths="./api-hub/..." output:webhook:artifacts:config=config/webhook-hub
$(CONTROLLER_GEN) \
rbac:roleName=manager-role \
paths="./controllers/hub" \
paths="controllers/imagestream_reconciler.go" \
paths="./internal/controllers/hub" \
paths="internal/controllers/imagestream_reconciler.go" \
output:rbac:artifacts:config=config/rbac-hub

.PHONY: generate
Expand Down
4 changes: 2 additions & 2 deletions cmd/manager-hub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/rh-ecosystem-edge/kernel-module-management/api-hub/v1beta1"
"github.com/rh-ecosystem-edge/kernel-module-management/controllers"
"github.com/rh-ecosystem-edge/kernel-module-management/controllers/hub"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/auth"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/build"
buildocpbuild "github.com/rh-ecosystem-edge/kernel-module-management/internal/build/ocpbuild"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/cache"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/cluster"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/cmd"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/constants"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/controllers"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/controllers/hub"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/filter"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/manifestwork"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/metrics"
Expand Down
9 changes: 2 additions & 7 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ import (
buildv1 "github.com/openshift/api/build/v1"
imagev1 "github.com/openshift/api/image/v1"
kmmv1beta1 "github.com/rh-ecosystem-edge/kernel-module-management/api/v1beta1"
"github.com/rh-ecosystem-edge/kernel-module-management/controllers"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/auth"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/build"
buildocpbuild "github.com/rh-ecosystem-edge/kernel-module-management/internal/build/ocpbuild"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/cmd"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/config"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/constants"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/controllers"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/daemonset"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/filter"
"github.com/rh-ecosystem-edge/kernel-module-management/internal/metrics"
Expand Down Expand Up @@ -182,14 +182,9 @@ func main() {
cmd.FatalError(setupLogger, err, "unable to create controller", "name", controllers.ModuleNMCReconcilerName)
}

workerHelper := controllers.NewWorkerHelper(
client,
controllers.NewPodManager(client, workerImage, scheme),
)

ctx := ctrl.SetupSignalHandler()

if err = controllers.NewNodeModulesConfigReconciler(client, workerHelper).SetupWithManager(ctx, mgr); err != nil {
if err = controllers.NewNMCReconciler(client, scheme, workerImage).SetupWithManager(ctx, mgr); err != nil {
cmd.FatalError(setupLogger, err, "unable to create controller", "name", controllers.NodeModulesConfigReconcilerName)
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

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

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 68c6aae

Please sign in to comment.