Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Nov 2, 2023
1 parent 3662fc8 commit 8a048d6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"k8s.io/component-base/metrics/legacyregistry"
"k8s.io/component-base/term"
ctrlmanageropts "k8s.io/controller-manager/options"
"k8s.io/klog/v2/klogr"
"k8s.io/klog/v2/textlogger"
cmdutil "k8s.io/kubectl/pkg/cmd/util"

"github.com/authzed/controller-idioms/manager"
Expand Down Expand Up @@ -103,7 +103,7 @@ func (o *Options) Run(ctx context.Context, f cmdutil.Factory) error {
}
DisableClientRateLimits(restConfig)

logger := klogr.New()
logger := textlogger.NewLogger(textlogger.NewConfig())

dclient, err := dynamic.NewForConfig(restConfig)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/check_migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func TestCheckMigrationsHandler(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tt := tt
ctrls := &fake.FakeInterface{}

ctx := CtxConfig.WithValue(context.Background(), &tt.config)
Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"k8s.io/client-go/tools/record"
_ "k8s.io/component-base/metrics/prometheus/workqueue" // for workqueue metric registration
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
"k8s.io/klog/v2/textlogger"

"github.com/authzed/spicedb-operator/pkg/apis/authzed/v1alpha1"
"github.com/authzed/spicedb-operator/pkg/config"
Expand Down Expand Up @@ -91,7 +91,7 @@ func NewController(ctx context.Context, registry *typed.Registry, dclient dynami
kclient: kclient,
}
c.OwnedResourceController = manager.NewOwnedResourceController(
klogr.New(),
textlogger.NewLogger(textlogger.NewConfig()),
v1alpha1.SpiceDBClusterResourceName,
v1alpha1ClusterGVR,
QueueOps,
Expand All @@ -100,7 +100,7 @@ func NewController(ctx context.Context, registry *typed.Registry, dclient dynami
c.syncOwnedResource,
)

fileInformerFactory, err := fileinformer.NewFileInformerFactory(klogr.New())
fileInformerFactory, err := fileinformer.NewFileInformerFactory(textlogger.NewLogger(textlogger.NewConfig()))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -224,7 +224,7 @@ func (c *Controller) loadConfig(path string) {
return
}

logger := klogr.New()
logger := textlogger.NewLogger(textlogger.NewConfig())
logger.V(3).Info("loading config", "path", path)

file, err := os.Open(path)
Expand Down Expand Up @@ -290,7 +290,7 @@ func (c *Controller) syncOwnedResource(ctx context.Context, gvr schema.GroupVers
return
}

logger := klogr.New().WithValues(
logger := textlogger.NewLogger(textlogger.NewConfig()).WithValues(
"syncID", middleware.NewSyncID(5),
"controller", c.Name(),
"obj", klog.KObj(cluster).MarshalLog(),
Expand Down Expand Up @@ -325,7 +325,7 @@ func (c *Controller) syncExternalResource(obj interface{}) {
return
}

logger := klogr.New().WithValues(
logger := textlogger.NewLogger(textlogger.NewConfig()).WithValues(
"syncID", middleware.NewSyncID(5),
"controller", c.Name(),
"obj", klog.KObj(objMeta),
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/run_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestRunMigrationHandler(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tt := tt
ctrls := &fake.FakeInterface{}
applyCalled := false
deleteCalled := false
Expand Down
7 changes: 3 additions & 4 deletions pkg/metadata/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import (
"fmt"
"strings"

"github.com/authzed/controller-idioms/adopt"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/cache"
"k8s.io/utils/pointer"

"github.com/authzed/controller-idioms/adopt"
"k8s.io/utils/ptr"
)

const (
Expand All @@ -38,7 +37,7 @@ const (

var (
ApplyForceOwned = metav1.ApplyOptions{FieldManager: FieldManager, Force: true}
PatchForceOwned = metav1.PatchOptions{FieldManager: FieldManager, Force: pointer.Bool(true)}
PatchForceOwned = metav1.PatchOptions{FieldManager: FieldManager, Force: ptr.To(true)}
ManagedDependentSelector = MustParseSelector(fmt.Sprintf("%s=%s", OperatorManagedLabelKey, OperatorManagedLabelValue))
)

Expand Down

0 comments on commit 8a048d6

Please sign in to comment.