Skip to content

Commit

Permalink
Fix linter issue with "k8s.io/utils/pointer" package usage
Browse files Browse the repository at this point in the history
"k8s.io/utils/pointer" is deprecated and instead functions in "k8s.io/utils/ptr" are
used instead: to be specific, ptr.To to obtain a pointer in this case

Signed-off-by: Furkat Gofurov <[email protected]>
  • Loading branch information
furkatgofurov7 committed Dec 25, 2023
1 parent 195590c commit 56e78f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions internal/sync/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

Expand Down Expand Up @@ -66,7 +66,7 @@ func setOwnerReference(owner, obj client.Object) {
Kind: turtlesv1.Kind,
Name: owner.GetName(),
UID: owner.GetUID(),
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
}})
}
4 changes: 2 additions & 2 deletions internal/sync/provider_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
turtlesv1 "github.com/rancher-sandbox/rancher-turtles/api/v1alpha1"
"github.com/rancher-sandbox/rancher-turtles/internal/sync"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
. "sigs.k8s.io/controller-runtime/pkg/envtest/komega"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -67,7 +67,7 @@ var _ = Describe("Provider sync", func() {
Eventually(UpdateStatus(infrastructure, func() {
infrastructure.Status = operatorv1.InfrastructureProviderStatus{
ProviderStatus: operatorv1.ProviderStatus{
InstalledVersion: pointer.String("v1.2.3"),
InstalledVersion: ptr.To("v1.2.3"),
},
}
})).Should(Succeed())
Expand Down
3 changes: 1 addition & 2 deletions test/testenv/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type NamespaceName struct {
func CAPIOperatorDeployProvider(ctx context.Context, input CAPIOperatorDeployProviderInput) {
Expect(ctx).NotTo(BeNil(), "ctx is required for CAPIOperatorDeployProvider")
Expect(input.BootstrapClusterProxy).ToNot(BeNil(), "BootstrapClusterProxy is required for CAPIOperatorDeployProvider")
Expect(input.BootstrapClusterProxy).ToNot(BeNil(), "BootstrapClusterProxy is required for CAPIOperatorDeployProvider")
Expect(input.CAPIProvidersYAML).ToNot(BeNil(), "CAPIProvidersYAML is required for CAPIOperatorDeployProvider")

for _, secret := range input.CAPIProvidersSecretsYAML {
Expand All @@ -65,7 +64,7 @@ func CAPIOperatorDeployProvider(ctx context.Context, input CAPIOperatorDeployPro
})).To(Succeed(), "Failed to apply secret for capi providers")
}

By("Adding CAPI Operaytor providers")
By("Adding CAPI Operator providers")
Expect(input.BootstrapClusterProxy.Apply(ctx, input.CAPIProvidersYAML)).To(Succeed(), "Failed to add CAPI operator providers")

if len(input.WaitForDeployments) == 0 {
Expand Down

0 comments on commit 56e78f0

Please sign in to comment.