Skip to content

Commit 46b8ccb

Browse files
Lint fixes
Signed-off-by: Danil Grigorev <[email protected]>
1 parent fa7dfa5 commit 46b8ccb

25 files changed

+102
-84
lines changed

api/v1alpha1/provider_conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"strings"
2121

2222
apimachineryconversion "k8s.io/apimachinery/pkg/conversion"
23-
"k8s.io/utils/pointer"
23+
"k8s.io/utils/ptr"
2424
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
2525
ctrlconfigv1 "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
2626
"sigs.k8s.io/controller-runtime/pkg/conversion"
@@ -525,5 +525,5 @@ func fromImageMeta(im *ImageMeta) *string {
525525
result = result + ":" + im.Tag
526526
}
527527

528-
return pointer.String(result)
528+
return ptr.To(result)
529529
}

cmd/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3131
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3232
"k8s.io/klog/v2"
33-
"k8s.io/klog/v2/klogr"
33+
"k8s.io/klog/v2/textlogger"
3434
"sigs.k8s.io/cluster-api-operator/internal/webhook"
3535
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
3636
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
@@ -131,7 +131,9 @@ func main() {
131131
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
132132
pflag.Parse()
133133

134-
ctrl.SetLogger(klogr.New())
134+
loggerConfig := textlogger.NewConfig([]textlogger.ConfigOption{}...)
135+
ctrl.SetLogger(textlogger.NewLogger(loggerConfig))
136+
135137
restConfig := ctrl.GetConfigOrDie()
136138

137139
diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions)

cmd/plugin/cmd/delete.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
"k8s.io/apimachinery/pkg/fields"
3030
"k8s.io/apimachinery/pkg/util/wait"
31-
"k8s.io/klog/v2/klogr"
31+
"k8s.io/klog/v2/textlogger"
3232

3333
kerrors "k8s.io/apimachinery/pkg/util/errors"
3434

@@ -142,7 +142,8 @@ func init() {
142142
func runDelete() error {
143143
ctx := context.Background()
144144

145-
ctrl.SetLogger(klogr.New())
145+
loggerConfig := textlogger.NewConfig([]textlogger.ConfigOption{}...)
146+
ctrl.SetLogger(textlogger.NewLogger(loggerConfig))
146147

147148
hasProviderNames := deleteOpts.coreProvider ||
148149
(len(deleteOpts.bootstrapProviders) > 0) ||

cmd/plugin/cmd/init_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func TestInitProviders(t *testing.T) {
329329

330330
for _, genericProvider := range tt.wantedProviders {
331331
g.Eventually(func(g Gomega) {
332-
copy := genericProvider.DeepCopyObject().(generic.Provider)
332+
copy := genericProvider.DeepCopyObject().(generic.Provider) //nolint
333333
g.Expect(env.Get(ctx, ctrlclient.ObjectKeyFromObject(genericProvider), copy)).To(Succeed())
334334
g.Expect(copy.GetSpec().Version).To(Equal(genericProvider.GetSpec().Version))
335335
}, waitShort).Should(Succeed())

cmd/plugin/cmd/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
3030

31-
// We need to initalize all registered providers
31+
// We need to initialize all registered providers.
3232
_ "sigs.k8s.io/cluster-api-operator/internal/controller/providers"
3333
)
3434

cmd/plugin/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
"sigs.k8s.io/cluster-api-operator/cmd/plugin/cmd"
2323

24-
// We need to initalize all registered providers
24+
// We need to initialize all registered providers.
2525
_ "sigs.k8s.io/cluster-api-operator/internal/controller/providers"
2626
)
2727

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/google/go-cmp v0.6.0
1111
github.com/google/go-github/v52 v52.0.0
1212
github.com/google/gofuzz v1.2.0
13+
github.com/onsi/ginkgo/v2 v2.15.0
1314
github.com/onsi/gomega v1.32.0
1415
github.com/spf13/cobra v1.8.0
1516
github.com/spf13/pflag v1.0.5
@@ -52,6 +53,7 @@ require (
5253
github.com/go-openapi/jsonpointer v0.19.6 // indirect
5354
github.com/go-openapi/jsonreference v0.20.2 // indirect
5455
github.com/go-openapi/swag v0.22.3 // indirect
56+
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
5557
github.com/gobuffalo/flect v1.0.2 // indirect
5658
github.com/gogo/protobuf v1.3.2 // indirect
5759
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@@ -60,6 +62,7 @@ require (
6062
github.com/google/gnostic-models v0.6.8 // indirect
6163
github.com/google/go-github/v53 v53.2.0 // indirect
6264
github.com/google/go-querystring v1.1.0 // indirect
65+
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
6366
github.com/google/uuid v1.4.0 // indirect
6467
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
6568
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -111,6 +114,7 @@ require (
111114
golang.org/x/term v0.18.0 // indirect
112115
golang.org/x/text v0.14.0 // indirect
113116
golang.org/x/time v0.3.0 // indirect
117+
golang.org/x/tools v0.16.1 // indirect
114118
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
115119
google.golang.org/appengine v1.6.7 // indirect
116120
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
349349
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
350350
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
351351
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
352+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
352353
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
353354
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
354355
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=

internal/controller/generic/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type Group[P Provider] interface {
5959
GetClusterctlProvider() *clusterctlv1.Provider
6060
}
6161

62-
// NewGroup is a function that creates a new group
62+
// NewGroup is a function that creates a new group.
6363
type NewGroup[P Provider] func(P, ProviderList, GroupBuilder[P]) Group[P]
6464

6565
type ProviderReconciler[P Provider] interface {

internal/controller/phases/component_customizer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2929
"k8s.io/client-go/kubernetes/scheme"
3030
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
31-
"k8s.io/utils/pointer"
31+
"k8s.io/utils/ptr"
3232
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
3333
"sigs.k8s.io/cluster-api/util"
3434
)
@@ -131,7 +131,7 @@ func customizeDeploymentSpec(pSpec operatorv1.ProviderSpec, d *appsv1.Deployment
131131
dSpec := pSpec.Deployment
132132

133133
if dSpec.Replicas != nil {
134-
d.Spec.Replicas = pointer.Int32(int32(*dSpec.Replicas))
134+
d.Spec.Replicas = ptr.To(int32(*dSpec.Replicas))
135135
}
136136

137137
if dSpec.Affinity != nil {

0 commit comments

Comments
 (0)