Replace more pointer.String() with the new ptr.To()

This commit is contained in:
Ryan Richard 2023-07-28 12:46:15 -07:00
parent 519aece8a5
commit 0a21cb6d08
4 changed files with 55 additions and 55 deletions

View File

@ -20,7 +20,7 @@ import (
"k8s.io/apimachinery/pkg/types"
coretesting "k8s.io/client-go/testing"
clocktesting "k8s.io/utils/clock/testing"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
configv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1"
idpv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/idp/v1alpha1"
@ -993,7 +993,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "cant-find-me",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: "cant-find-me-name",
},
@ -1001,7 +1001,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "cant-find-me-either",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: "cant-find-me-either-name",
},
@ -1009,7 +1009,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "cant-find-me-still",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "ActiveDirectoryIdentityProvider",
Name: "cant-find-me-still-name",
},
@ -1054,7 +1054,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "can-find-me",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1062,7 +1062,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "can-find-me-too",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "LDAPIdentityProvider",
Name: ldapIdentityProvider.Name,
},
@ -1070,7 +1070,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "can-find-me-three",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "ActiveDirectoryIdentityProvider",
Name: adIdentityProvider.Name,
},
@ -1123,7 +1123,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "duplicate1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1131,7 +1131,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "duplicate1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "LDAPIdentityProvider",
Name: ldapIdentityProvider.Name,
},
@ -1139,7 +1139,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "duplicate1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "LDAPIdentityProvider",
Name: ldapIdentityProvider.Name,
},
@ -1147,7 +1147,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "unique",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "ActiveDirectoryIdentityProvider",
Name: adIdentityProvider.Name,
},
@ -1155,7 +1155,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "duplicate2",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "LDAPIdentityProvider",
Name: ldapIdentityProvider.Name,
},
@ -1163,7 +1163,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "duplicate2",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "ActiveDirectoryIdentityProvider",
Name: adIdentityProvider.Name,
},
@ -1202,7 +1202,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("wrong.example.com"),
APIGroup: ptr.To("wrong.example.com"),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1210,7 +1210,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name2",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(""), // empty string is wrong
APIGroup: ptr.To(""), // empty string is wrong
Kind: "LDAPIdentityProvider",
Name: ldapIdentityProvider.Name,
},
@ -1226,7 +1226,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name4",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor), // correct
APIGroup: ptr.To(apiGroupSupervisor), // correct
Kind: "ActiveDirectoryIdentityProvider",
Name: adIdentityProvider.Name,
},
@ -1272,7 +1272,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider", // correct
Name: oidcIdentityProvider.Name,
},
@ -1280,7 +1280,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name2",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "wrong",
Name: ldapIdentityProvider.Name,
},
@ -1288,7 +1288,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name3",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "", // empty is also wrong
Name: ldapIdentityProvider.Name,
},
@ -1330,7 +1330,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1393,7 +1393,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1557,7 +1557,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1628,7 +1628,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "not unique",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: "this will not be found",
},
@ -1663,7 +1663,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "not unique",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "this is wrong",
Name: "foo",
},
@ -1698,7 +1698,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("this is wrong"),
APIGroup: ptr.To("this is wrong"),
Kind: "OIDCIdentityProvider",
Name: "foo",
},
@ -1722,7 +1722,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1842,7 +1842,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1894,7 +1894,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "name2",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "LDAPIdentityProvider",
Name: ldapIdentityProvider.Name,
},
@ -1968,7 +1968,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "can-find-me",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -1998,7 +1998,7 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) {
{
DisplayName: "can-find-me",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String(apiGroupSupervisor),
APIGroup: ptr.To(apiGroupSupervisor),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},

View File

@ -31,7 +31,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
authv1alpha "go.pinniped.dev/generated/latest/apis/concierge/authentication/v1alpha1"
configv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1"
@ -1283,7 +1283,7 @@ func TestE2EFullIntegration_Browser(t *testing.T) {
{
DisplayName: ldapIDPDisplayName,
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "LDAPIdentityProvider",
Name: createdLDAPProvider.Name,
},
@ -1320,7 +1320,7 @@ func TestE2EFullIntegration_Browser(t *testing.T) {
{
DisplayName: oidcIDPDisplayName,
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: createdOIDCProvider.Name,
},

View File

@ -15,7 +15,7 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/util/retry"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1"
idpv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/idp/v1alpha1"
@ -104,7 +104,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
{
DisplayName: "idp1",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: oidcIDP1Meta.Name,
},
@ -113,7 +113,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
{
DisplayName: "idp2",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: oidcIDP2Meta.Name,
},
@ -204,7 +204,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
{
DisplayName: "not unique",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("this is the wrong api group"),
APIGroup: ptr.To("this is the wrong api group"),
Kind: "OIDCIdentityProvider",
Name: "will not be found",
},
@ -228,7 +228,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
{ // this identity provider should be valid
DisplayName: "unique",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -236,7 +236,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
{
DisplayName: "not unique",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "this is the wrong kind",
Name: "also will not be found",
},
@ -442,7 +442,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
DisplayName: "now made unique",
// Fix the objectRef.
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
},
@ -520,7 +520,7 @@ func TestSupervisorFederationDomainStatus_Disruptive(t *testing.T) {
require.NoError(t, err)
gotFD.Spec.IdentityProviders[2].ObjectRef = corev1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: oidcIdentityProvider.Name,
}
@ -597,7 +597,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
},
},
@ -618,7 +618,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Constants: []v1alpha1.FederationDomainTransformsConstant{
@ -647,7 +647,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Constants: []v1alpha1.FederationDomainTransformsConstant{
@ -673,7 +673,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Constants: []v1alpha1.FederationDomainTransformsConstant{
@ -706,7 +706,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Constants: []v1alpha1.FederationDomainTransformsConstant{
@ -748,7 +748,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Constants: []v1alpha1.FederationDomainTransformsConstant{
@ -776,7 +776,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Expressions: []v1alpha1.FederationDomainTransformsExpression{
@ -805,7 +805,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Expressions: []v1alpha1.FederationDomainTransformsExpression{
@ -831,7 +831,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Examples: []v1alpha1.FederationDomainTransformsExample{
@ -867,7 +867,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
},
},
@ -884,7 +884,7 @@ func TestSupervisorFederationDomainCRDValidations_Parallel(t *testing.T) {
{
DisplayName: "foo",
ObjectRef: corev1.TypedLocalObjectReference{
APIGroup: pointer.String("required in older versions of Kubernetes for each item in the identityProviders slice"),
APIGroup: ptr.To("required in older versions of Kubernetes for each item in the identityProviders slice"),
},
Transforms: v1alpha1.FederationDomainTransforms{
Constants: []v1alpha1.FederationDomainTransformsConstant{

View File

@ -26,7 +26,7 @@ import (
"golang.org/x/oauth2"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"k8s.io/utils/strings/slices"
configv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1"
@ -1870,7 +1870,7 @@ func TestSupervisorLogin_Browser(t *testing.T) {
{
DisplayName: displayName,
ObjectRef: v1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "OIDCIdentityProvider",
Name: idpName,
},
@ -1927,7 +1927,7 @@ func TestSupervisorLogin_Browser(t *testing.T) {
{
DisplayName: displayName,
ObjectRef: v1.TypedLocalObjectReference{
APIGroup: pointer.String("idp.supervisor." + env.APIGroupSuffix),
APIGroup: ptr.To("idp.supervisor." + env.APIGroupSuffix),
Kind: "LDAPIdentityProvider",
Name: idpName,
},