Use k8s utils pointer instead of Azure autorest/to

Since k/u includes pointer functions which are equivalent to the
autorest/to pointer functions, and the latter are deprecated, it seems
useful to switch to the former:
* to.FooPtr becomes pointer.Foo
* to.Foo becomes pointer.FooDeref with an appropriate default
* to.StringSlicePtr becomes &

This doesn't remove anything from vendor, but it does turn the
dependency into an indirect one, ready to be removed when the rest of
the Azure migration happens.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
Stephen Kitt
2022-12-07 18:16:16 +01:00
parent 09d7286eb5
commit 56d8302bc8
61 changed files with 1476 additions and 1478 deletions

View File

@@ -25,8 +25,8 @@ import (
"github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2019-05-01/containerregistry"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
"k8s.io/client-go/tools/cache"
"k8s.io/utils/pointer"
"github.com/stretchr/testify/assert"
)
@@ -39,27 +39,27 @@ func Test(t *testing.T) {
}`
result := []containerregistry.Registry{
{
Name: to.StringPtr("foo"),
Name: pointer.String("foo"),
RegistryProperties: &containerregistry.RegistryProperties{
LoginServer: to.StringPtr("*.azurecr.io"),
LoginServer: pointer.String("*.azurecr.io"),
},
},
{
Name: to.StringPtr("bar"),
Name: pointer.String("bar"),
RegistryProperties: &containerregistry.RegistryProperties{
LoginServer: to.StringPtr("*.azurecr.cn"),
LoginServer: pointer.String("*.azurecr.cn"),
},
},
{
Name: to.StringPtr("baz"),
Name: pointer.String("baz"),
RegistryProperties: &containerregistry.RegistryProperties{
LoginServer: to.StringPtr("*.azurecr.de"),
LoginServer: pointer.String("*.azurecr.de"),
},
},
{
Name: to.StringPtr("bus"),
Name: pointer.String("bus"),
RegistryProperties: &containerregistry.RegistryProperties{
LoginServer: to.StringPtr("*.azurecr.us"),
LoginServer: pointer.String("*.azurecr.us"),
},
},
}