Skip to content

Commit

Permalink
chore(tests): fix tests in KGO EE after bumping controller-runtime to…
Browse files Browse the repository at this point in the history
… v0.19.0 (#505)
  • Loading branch information
programmer04 authored Aug 19, 2024
1 parent a0614c5 commit fa31122
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (
"time"

"github.com/go-logr/logr"
"github.com/samber/lo"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/config"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down Expand Up @@ -164,6 +166,12 @@ func Run(
restCfg.UserAgent = metadata.UserAgent()

mgr, err := ctrl.NewManager(restCfg, ctrl.Options{
Controller: config.Controller{
// This is needed because controller-runtime since v0.19.0 keeps a global list of controller
// names and panics if there are duplicates. This is a workaround for that in tests.
// Ref: https://github.com/kubernetes-sigs/controller-runtime/pull/2902#issuecomment-2284194683
SkipNameValidation: lo.ToPtr(true),
},
Scheme: scheme,
Metrics: server.Options{
BindAddress: cfg.MetricsAddr,
Expand Down

0 comments on commit fa31122

Please sign in to comment.