Merge pull request #114817 from TommyStarK/plugin-pkg-admission/replace-deprecated-pointer-function

plugin/pkg/admission: Replace deprecated pointer function
This commit is contained in:
Kubernetes Prow Robot 2023-01-04 14:30:44 -08:00 committed by GitHub
commit 76e881d4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -134,30 +134,30 @@ func TestAdmission(t *testing.T) {
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: nil, classField: nil,
classAnnotation: nil, classAnnotation: nil,
expectedClass: utilpointer.StringPtr(defaultClass1.Name), expectedClass: utilpointer.String(defaultClass1.Name),
expectedError: nil, expectedError: nil,
}, },
{ {
name: "one default, no modification of Ingress with class field=''", name: "one default, no modification of Ingress with class field=''",
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: utilpointer.StringPtr(""), classField: utilpointer.String(""),
classAnnotation: nil, classAnnotation: nil,
expectedClass: utilpointer.StringPtr(""), expectedClass: utilpointer.String(""),
expectedError: nil, expectedError: nil,
}, },
{ {
name: "one default, no modification of Ingress with class field='foo'", name: "one default, no modification of Ingress with class field='foo'",
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: utilpointer.StringPtr("foo"), classField: utilpointer.String("foo"),
classAnnotation: nil, classAnnotation: nil,
expectedClass: utilpointer.StringPtr("foo"), expectedClass: utilpointer.String("foo"),
expectedError: nil, expectedError: nil,
}, },
{ {
name: "one default, no modification of Ingress with class annotation='foo'", name: "one default, no modification of Ingress with class annotation='foo'",
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: nil, classField: nil,
classAnnotation: utilpointer.StringPtr("foo"), classAnnotation: utilpointer.String("foo"),
expectedClass: nil, expectedClass: nil,
expectedError: nil, expectedError: nil,
}, },
@ -166,15 +166,15 @@ func TestAdmission(t *testing.T) {
classes: []*networkingv1.IngressClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: nil, classField: nil,
classAnnotation: nil, classAnnotation: nil,
expectedClass: utilpointer.StringPtr(defaultClass1.Name), expectedClass: utilpointer.String(defaultClass1.Name),
expectedError: nil, expectedError: nil,
}, },
{ {
name: "two defaults, no modification with Ingress with class field=''", name: "two defaults, no modification with Ingress with class field=''",
classes: []*networkingv1.IngressClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: utilpointer.StringPtr(""), classField: utilpointer.String(""),
classAnnotation: nil, classAnnotation: nil,
expectedClass: utilpointer.StringPtr(""), expectedClass: utilpointer.String(""),
expectedError: nil, expectedError: nil,
}, },
{ {
@ -182,7 +182,7 @@ func TestAdmission(t *testing.T) {
classes: []*networkingv1.IngressClass{defaultClassWithCreateTime1, defaultClassWithCreateTime2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault}, classes: []*networkingv1.IngressClass{defaultClassWithCreateTime1, defaultClassWithCreateTime2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
classField: nil, classField: nil,
classAnnotation: nil, classAnnotation: nil,
expectedClass: utilpointer.StringPtr(defaultClassWithCreateTime1.Name), expectedClass: utilpointer.String(defaultClassWithCreateTime1.Name),
expectedError: nil, expectedError: nil,
}, },
} }

View File

@ -297,8 +297,8 @@ func Test_nodePlugin_Admit(t *testing.T) {
Namespace: api.NamespaceNodeLease, Namespace: api.NamespaceNodeLease,
}, },
Spec: coordination.LeaseSpec{ Spec: coordination.LeaseSpec{
HolderIdentity: pointer.StringPtr("mynode"), HolderIdentity: pointer.String("mynode"),
LeaseDurationSeconds: pointer.Int32Ptr(40), LeaseDurationSeconds: pointer.Int32(40),
RenewTime: &metav1.MicroTime{Time: time.Now()}, RenewTime: &metav1.MicroTime{Time: time.Now()},
}, },
} }
@ -308,8 +308,8 @@ func Test_nodePlugin_Admit(t *testing.T) {
Namespace: "foo", Namespace: "foo",
}, },
Spec: coordination.LeaseSpec{ Spec: coordination.LeaseSpec{
HolderIdentity: pointer.StringPtr("mynode"), HolderIdentity: pointer.String("mynode"),
LeaseDurationSeconds: pointer.Int32Ptr(40), LeaseDurationSeconds: pointer.Int32(40),
RenewTime: &metav1.MicroTime{Time: time.Now()}, RenewTime: &metav1.MicroTime{Time: time.Now()},
}, },
} }
@ -319,8 +319,8 @@ func Test_nodePlugin_Admit(t *testing.T) {
Namespace: api.NamespaceNodeLease, Namespace: api.NamespaceNodeLease,
}, },
Spec: coordination.LeaseSpec{ Spec: coordination.LeaseSpec{
HolderIdentity: pointer.StringPtr("mynode"), HolderIdentity: pointer.String("mynode"),
LeaseDurationSeconds: pointer.Int32Ptr(40), LeaseDurationSeconds: pointer.Int32(40),
RenewTime: &metav1.MicroTime{Time: time.Now()}, RenewTime: &metav1.MicroTime{Time: time.Now()},
}, },
} }