Skip to content

Commit

Permalink
remove k8s.io/utils/pointer from repository
Browse files Browse the repository at this point in the history
Signed-off-by: Troy Connor <troy0820@users.noreply.github.com>
  • Loading branch information
troy0820 committed Dec 8, 2023
1 parent 9d36ddc commit 6e353af
Show file tree
Hide file tree
Showing 145 changed files with 1,083 additions and 1,083 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha4/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capierrors "sigs.k8s.io/cluster-api/errors"
)
Expand Down Expand Up @@ -422,7 +422,7 @@ func (in FailureDomains) FilterControlPlane() FailureDomains {
func (in FailureDomains) GetIDs() []*string {
ids := make([]*string, 0, len(in))
for id := range in {
ids = append(ids, pointer.String(id))
ids = append(ids, ptr.To(id))
}
return ids
}
Expand Down
16 changes: 8 additions & 8 deletions api/v1alpha4/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
Expand Down Expand Up @@ -113,17 +113,17 @@ func JSONSchemaPropsFuzzer(in *clusterv1.JSONSchemaProps, c fuzz.Continue) {
for i := 0; i < c.Intn(10); i++ {
in.Required = append(in.Required, c.RandString())
}
in.MaxItems = pointer.Int64(c.Int63())
in.MinItems = pointer.Int64(c.Int63())
in.MaxItems = ptr.To(c.Int63())
in.MinItems = ptr.To(c.Int63())
in.UniqueItems = c.RandBool()
in.Format = c.RandString()
in.MaxLength = pointer.Int64(c.Int63())
in.MinLength = pointer.Int64(c.Int63())
in.MaxLength = ptr.To(c.Int63())
in.MinLength = ptr.To(c.Int63())
in.Pattern = c.RandString()
in.Maximum = pointer.Int64(c.Int63())
in.Maximum = pointer.Int64(c.Int63())
in.Maximum = ptr.To(c.Int63())
in.Maximum = ptr.To(c.Int63())
in.ExclusiveMaximum = c.RandBool()
in.Minimum = pointer.Int64(c.Int63())
in.Minimum = ptr.To(c.Int63())
in.ExclusiveMinimum = c.RandBool()

// Not every random byte array is valid JSON, e.g. a string without `""`,so we're setting valid values.
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
corev1 "k8s.io/api/core/v1"
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"

capierrors "sigs.k8s.io/cluster-api/errors"
)
Expand Down Expand Up @@ -622,7 +622,7 @@ func (in FailureDomains) FilterControlPlane() FailureDomains {
func (in FailureDomains) GetIDs() []*string {
ids := make([]*string, 0, len(in))
for id := range in {
ids = append(ids, pointer.String(id))
ids = append(ids, ptr.To(id))
}
return ids
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/index/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"

"github.com/pkg/errors"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -81,7 +81,7 @@ func machineByProviderID(o client.Object) []string {
panic(fmt.Sprintf("Expected a Machine but got a %T", o))
}

providerID := pointer.StringDeref(machine.Spec.ProviderID, "")
providerID := ptr.Deref(machine.Spec.ProviderID, "")

if providerID == "" {
return nil
Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/index/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestIndexMachineByProviderID(t *testing.T) {
name: "Machine has invalid providerID",
object: &clusterv1.Machine{
Spec: clusterv1.MachineSpec{
ProviderID: pointer.String(""),
ProviderID: ptr.To(""),
},
},
expected: nil,
Expand All @@ -86,7 +86,7 @@ func TestIndexMachineByProviderID(t *testing.T) {
name: "Machine has valid providerID",
object: &clusterv1.Machine{
Spec: clusterv1.MachineSpec{
ProviderID: pointer.String(validProviderID),
ProviderID: ptr.To(validProviderID),
},
},
expected: []string{validProviderID},
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

. "github.com/onsi/gomega"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/util/certs"
Expand Down Expand Up @@ -141,8 +141,8 @@ func TestNewInitControlPlaneDiskMounts(t *testing.T) {
{
Device: "test-device",
Layout: true,
Overwrite: pointer.Bool(false),
TableType: pointer.String("gpt"),
Overwrite: ptr.To(false),
TableType: ptr.To("gpt"),
},
},
Filesystems: []bootstrapv1.Filesystem{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"k8s.io/apimachinery/pkg/types"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/klog/v2"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -1026,7 +1026,7 @@ func (r *KubeadmConfigReconciler) storeBootstrapData(ctx context.Context, scope
Kind: "KubeadmConfig",
Name: scope.Config.Name,
UID: scope.Config.UID,
Controller: pointer.Bool(true),
Controller: ptr.To(true),
},
},
},
Expand All @@ -1048,7 +1048,7 @@ func (r *KubeadmConfigReconciler) storeBootstrapData(ctx context.Context, scope
return errors.Wrapf(err, "failed to update bootstrap data secret for KubeadmConfig %s/%s", scope.Config.Namespace, scope.Config.Name)
}
}
scope.Config.Status.DataSecretName = pointer.String(secret.Name)
scope.Config.Status.DataSecretName = ptr.To(secret.Name)
scope.Config.Status.Ready = true
conditions.MarkTrue(scope.Config, bootstrapv1.DataSecretAvailableCondition)
return nil
Expand Down Expand Up @@ -1077,7 +1077,7 @@ func (r *KubeadmConfigReconciler) ensureBootstrapSecretOwnersRef(ctx context.Con
Kind: "KubeadmConfig",
UID: scope.Config.UID,
Name: scope.Config.Name,
Controller: pointer.Bool(true),
Controller: ptr.To(true),
}))
err = patchHelper.Patch(ctx, secret)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi
WithClusterName(clusterName).
WithBootstrapTemplate(bootstrapbuilder.KubeadmConfig(metav1.NamespaceDefault, "cfg").Unstructured()).
Build()
machine.Spec.Bootstrap.DataSecretName = pointer.String("something")
machine.Spec.Bootstrap.DataSecretName = ptr.To("something")

config := newKubeadmConfig(metav1.NamespaceDefault, "cfg")
config.SetOwnerReferences(util.EnsureOwnerRef(config.GetOwnerReferences(), metav1.OwnerReference{
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestKubeadmConfigReconciler_TestSecretOwnerReferenceReconciliation(t *testi
Kind: machine.Kind,
Name: machine.Name,
UID: machine.UID,
Controller: pointer.Bool(true),
Controller: ptr.To(true),
}})
g.Expect(myclient.Update(ctx, actual)).To(Succeed())

Expand Down Expand Up @@ -269,7 +269,7 @@ func TestKubeadmConfigReconciler_Reconcile_ReturnEarlyIfMachineHasDataSecretName
WithClusterName("cluster1").
WithBootstrapTemplate(bootstrapbuilder.KubeadmConfig(metav1.NamespaceDefault, "cfg").Unstructured()).
Build()
machine.Spec.Bootstrap.DataSecretName = pointer.String("something")
machine.Spec.Bootstrap.DataSecretName = ptr.To("something")

config := newKubeadmConfig(metav1.NamespaceDefault, "cfg")
addKubeadmConfigToMachine(config, machine)
Expand Down Expand Up @@ -975,7 +975,7 @@ func TestKubeadmConfigSecretCreatedStatusNotPatched(t *testing.T) {
Kind: "KubeadmConfig",
Name: workerJoinConfig.Name,
UID: workerJoinConfig.UID,
Controller: pointer.Bool(true),
Controller: ptr.To(true),
},
},
},
Expand Down Expand Up @@ -1617,7 +1617,7 @@ func TestKubeadmConfigReconciler_Reconcile_DynamicDefaultsForClusterConfiguratio
},
machine: &clusterv1.Machine{
Spec: clusterv1.MachineSpec{
Version: pointer.String("otherVersion"),
Version: ptr.To("otherVersion"),
},
},
},
Expand All @@ -1643,7 +1643,7 @@ func TestKubeadmConfigReconciler_Reconcile_DynamicDefaultsForClusterConfiguratio
},
machine: &clusterv1.Machine{
Spec: clusterv1.MachineSpec{
Version: pointer.String("myversion"),
Version: ptr.To("myversion"),
},
},
},
Expand Down
Loading

0 comments on commit 6e353af

Please sign in to comment.