Skip to content

Commit

Permalink
Fix static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinkumarsingh092 committed Mar 3, 2025
1 parent bb73e90 commit 0b6d694
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 88 deletions.
18 changes: 9 additions & 9 deletions api/netbox/v1beta1/netboxip.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

// +genclient
Expand Down Expand Up @@ -110,13 +110,13 @@ var tagSchema = &apiextensionsv1.JSONSchemaProps{
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"name": apiextensionsv1.JSONSchemaProps{
Type: "string",
MinLength: pointer.Int64(1),
MaxLength: pointer.Int64(100),
MinLength: ptr.To[int64](1),
MaxLength: ptr.To[int64](100),
},
"slug": apiextensionsv1.JSONSchemaProps{
Type: "string",
MinLength: pointer.Int64(1),
MaxLength: pointer.Int64(100),
MinLength: ptr.To[int64](1),
MaxLength: ptr.To[int64](100),
Pattern: tagSlugRegexp,
},
},
Expand All @@ -130,15 +130,15 @@ var NetBoxIPValidationSchema = &apiextensionsv1.CustomResourceValidation{
Properties: map[string]apiextensionsv1.JSONSchemaProps{
"address": apiextensionsv1.JSONSchemaProps{
Type: "string",
MinLength: pointer.Int64(1),
MinLength: ptr.To[int64](1),
// actual validation happens when unmarshaling, here we only
// make sure the addess is not empty (empty addresses will not
// produce an error when unmarshaled)
},
"dnsName": apiextensionsv1.JSONSchemaProps{
Type: "string",
MinLength: pointer.Int64(1),
MaxLength: pointer.Int64(253),
MinLength: ptr.To[int64](1),
MaxLength: ptr.To[int64](253),
Pattern: dnsNameRegexp,
},
"tags": apiextensionsv1.JSONSchemaProps{
Expand All @@ -150,7 +150,7 @@ var NetBoxIPValidationSchema = &apiextensionsv1.CustomResourceValidation{
"description": apiextensionsv1.JSONSchemaProps{
Type: "string",
// limit set by NetBox
MaxLength: pointer.Int64(200),
MaxLength: ptr.To[int64](200),
},
},
},
Expand Down
5 changes: 2 additions & 3 deletions cmd/netbox-ip-controller/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
"go.uber.org/zap"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
kubeerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -371,7 +370,7 @@ func TestClean(t *testing.T) {
},
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: v1.NamespaceDefault,
Namespace: corev1.NamespaceDefault,
Finalizers: []string{netboxipctrl.IPFinalizer},
},
Spec: v1beta1.NetBoxIPSpec{
Expand All @@ -381,7 +380,7 @@ func TestClean(t *testing.T) {
}

var err error
ip, err = env.KubeCRDClient.NetboxV1beta1().NetBoxIPs(v1.NamespaceDefault).Create(context.Background(), ip, metav1.CreateOptions{})
ip, err = env.KubeCRDClient.NetboxV1beta1().NetBoxIPs(corev1.NamespaceDefault).Create(context.Background(), ip, metav1.CreateOptions{})
if err != nil {
t.Fatalf("creating netboxip: %q\n", err)
}
Expand Down
78 changes: 39 additions & 39 deletions internal/controller/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
kubescheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
Expand Down Expand Up @@ -98,8 +98,8 @@ func TestReconcile(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -157,8 +157,8 @@ func TestReconcile(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -235,8 +235,8 @@ func TestReconcile(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -282,8 +282,8 @@ func TestReconcile(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -332,8 +332,8 @@ func TestReconcile(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -450,8 +450,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -500,8 +500,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -548,8 +548,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -577,8 +577,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -625,8 +625,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand All @@ -653,8 +653,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -682,8 +682,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -730,8 +730,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand All @@ -758,8 +758,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -788,8 +788,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -835,8 +835,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand All @@ -863,8 +863,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
},
Spec: v1beta1.NetBoxIPSpec{
Expand Down Expand Up @@ -892,8 +892,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down Expand Up @@ -921,8 +921,8 @@ func TestReconcileDualStack(t *testing.T) {
Kind: "Pod",
Name: name,
UID: types.UID(podUID),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}},
Finalizers: []string{netboxctrl.IPFinalizer},
},
Expand Down
Loading

0 comments on commit 0b6d694

Please sign in to comment.