This commit does two things in pkg package:

1. Remove unused ptr functions.
2. Replace ptr functions with k8s.io/utils/pointer
k3s-v1.15.3
WanLinghao 2019-02-23 13:06:47 +08:00
parent 4a1da48d11
commit d0138ca3fe
20 changed files with 75 additions and 97 deletions

View File

@ -23,6 +23,7 @@ go_test(
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//vendor/github.com/stretchr/testify/require:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -24,6 +24,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/apis/auditregistration"
utilpointer "k8s.io/utils/pointer"
)
func TestValidateAuditSink(t *testing.T) {
@ -133,8 +134,6 @@ func TestValidatePolicy(t *testing.T) {
}
}
func strPtr(s string) *string { return &s }
func TestValidateWebhookConfiguration(t *testing.T) {
tests := []struct {
name string
@ -157,7 +156,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Name: "n",
Port: 443,
},
URL: strPtr("example.com/k8s/webhook"),
URL: utilpointer.StringPtr("example.com/k8s/webhook"),
},
},
expectedError: `webhook.clientConfig: Required value: exactly one of url or service is required`,
@ -166,7 +165,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
name: "blank URL",
config: auditregistration.Webhook{
ClientConfig: auditregistration.WebhookClientConfig{
URL: strPtr(""),
URL: utilpointer.StringPtr(""),
},
},
expectedError: `webhook.clientConfig.url: Invalid value: "": host must be provided`,
@ -175,7 +174,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
name: "missing host",
config: auditregistration.Webhook{
ClientConfig: auditregistration.WebhookClientConfig{
URL: strPtr("https:///fancy/webhook"),
URL: utilpointer.StringPtr("https:///fancy/webhook"),
},
},
expectedError: `host must be provided`,
@ -184,7 +183,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
name: "fragment",
config: auditregistration.Webhook{
ClientConfig: auditregistration.WebhookClientConfig{
URL: strPtr("https://example.com/#bookmark"),
URL: utilpointer.StringPtr("https://example.com/#bookmark"),
},
},
expectedError: `"bookmark": fragments are not permitted`,
@ -193,7 +192,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
name: "query",
config: auditregistration.Webhook{
ClientConfig: auditregistration.WebhookClientConfig{
URL: strPtr("https://example.com?arg=value"),
URL: utilpointer.StringPtr("https://example.com?arg=value"),
},
},
expectedError: `"arg=value": query parameters are not permitted`,
@ -202,7 +201,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
name: "user",
config: auditregistration.Webhook{
ClientConfig: auditregistration.WebhookClientConfig{
URL: strPtr("https://harry.potter@example.com/"),
URL: utilpointer.StringPtr("https://harry.potter@example.com/"),
},
},
expectedError: `"harry.potter": user information is not permitted`,
@ -211,7 +210,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
name: "just totally wrong",
config: auditregistration.Webhook{
ClientConfig: auditregistration.WebhookClientConfig{
URL: strPtr("arg#backwards=thisis?html.index/port:host//:https"),
URL: utilpointer.StringPtr("arg#backwards=thisis?html.index/port:host//:https"),
},
},
expectedError: `host must be provided`,
@ -223,7 +222,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("foo/"),
Path: utilpointer.StringPtr("foo/"),
Port: 443,
},
},
@ -237,7 +236,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("foo/"),
Path: utilpointer.StringPtr("foo/"),
Port: 65536,
},
},
@ -251,7 +250,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("foo/"),
Path: utilpointer.StringPtr("foo/"),
Port: 0,
},
},
@ -265,7 +264,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("/"),
Path: utilpointer.StringPtr("/"),
Port: 443,
},
},
@ -279,7 +278,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("/foo"),
Path: utilpointer.StringPtr("/foo"),
Port: 443,
},
},
@ -293,7 +292,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("//"),
Path: utilpointer.StringPtr("//"),
Port: 443,
},
},
@ -307,7 +306,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("/foo//bar/"),
Path: utilpointer.StringPtr("/foo//bar/"),
Port: 443,
},
},
@ -320,7 +319,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("/foo/bar//"),
Path: utilpointer.StringPtr("/foo/bar//"),
Port: 443,
},
},
@ -334,7 +333,7 @@ func TestValidateWebhookConfiguration(t *testing.T) {
Service: &auditregistration.ServiceReference{
Namespace: "ns",
Name: "n",
Path: strPtr("/apis/foo.bar/v1alpha1/--bad"),
Path: utilpointer.StringPtr("/apis/foo.bar/v1alpha1/--bad"),
Port: 443,
},
},

View File

@ -12560,7 +12560,7 @@ func TestValidateSecurityContext(t *testing.T) {
runAsUser := int64(1)
fullValidSC := func() *core.SecurityContext {
return &core.SecurityContext{
Privileged: boolPtr(false),
Privileged: utilpointer.BoolPtr(false),
Capabilities: &core.Capabilities{
Add: []core.Capability{"foo"},
Drop: []core.Capability{"bar"},
@ -12605,19 +12605,19 @@ func TestValidateSecurityContext(t *testing.T) {
}
privRequestWithGlobalDeny := fullValidSC()
privRequestWithGlobalDeny.Privileged = boolPtr(true)
privRequestWithGlobalDeny.Privileged = utilpointer.BoolPtr(true)
negativeRunAsUser := fullValidSC()
negativeUser := int64(-1)
negativeRunAsUser.RunAsUser = &negativeUser
privWithoutEscalation := fullValidSC()
privWithoutEscalation.Privileged = boolPtr(true)
privWithoutEscalation.AllowPrivilegeEscalation = boolPtr(false)
privWithoutEscalation.Privileged = utilpointer.BoolPtr(true)
privWithoutEscalation.AllowPrivilegeEscalation = utilpointer.BoolPtr(false)
capSysAdminWithoutEscalation := fullValidSC()
capSysAdminWithoutEscalation.Capabilities.Add = []core.Capability{"CAP_SYS_ADMIN"}
capSysAdminWithoutEscalation.AllowPrivilegeEscalation = boolPtr(false)
capSysAdminWithoutEscalation.AllowPrivilegeEscalation = utilpointer.BoolPtr(false)
errorCases := map[string]struct {
sc *core.SecurityContext
@ -13145,7 +13145,3 @@ func TestValidateOrSetClientIPAffinityConfig(t *testing.T) {
}
}
}
func boolPtr(b bool) *bool {
return &b
}

View File

@ -55,6 +55,7 @@ go_test(
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -28,10 +28,9 @@ import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utilpointer "k8s.io/utils/pointer"
)
func boolptr(b bool) *bool { return &b }
func TestGetJobFromTemplate(t *testing.T) {
// getJobFromTemplate() needs to take the job template and copy the labels and annotations
// and other fields, and add a created-by reference.
@ -134,7 +133,7 @@ func TestGetParentUIDFromJob(t *testing.T) {
{
Kind: "CronJob",
UID: types.UID("5ef034e0-1890-11e6-8935-42010af0003e"),
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
},
})
@ -158,19 +157,19 @@ func TestGroupJobsByParent(t *testing.T) {
ownerReference1 := metav1.OwnerReference{
Kind: "CronJob",
UID: uid1,
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
}
ownerReference2 := metav1.OwnerReference{
Kind: "CronJob",
UID: uid2,
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
}
ownerReference3 := metav1.OwnerReference{
Kind: "CronJob",
UID: uid3,
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
}
{

View File

@ -46,5 +46,6 @@ go_test(
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature/testing:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -28,6 +28,7 @@ import (
utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing"
"k8s.io/kubernetes/pkg/features"
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
utilpointer "k8s.io/utils/pointer"
)
func newPod(podName string, nodeName string, label map[string]string) *v1.Pod {
@ -51,8 +52,8 @@ func newPod(podName string, nodeName string, label map[string]string) *v1.Pod {
}
func TestIsPodUpdated(t *testing.T) {
templateGeneration := int64Ptr(12345)
badGeneration := int64Ptr(12345)
templateGeneration := utilpointer.Int64Ptr(12345)
badGeneration := utilpointer.Int64Ptr(12345)
hash := "55555"
labels := map[string]string{extensions.DaemonSetTemplateGenerationKey: fmt.Sprint(templateGeneration), extensions.DefaultDaemonSetUniqueLabelKey: hash}
labelsNoHash := map[string]string{extensions.DaemonSetTemplateGenerationKey: fmt.Sprint(templateGeneration)}
@ -148,8 +149,8 @@ func TestCreatePodTemplate(t *testing.T) {
hash string
expectUniqueLabel bool
}{
{int64Ptr(1), "", false},
{int64Ptr(2), "3242341807", true},
{utilpointer.Int64Ptr(1), "", false},
{utilpointer.Int64Ptr(2), "3242341807", true},
}
for _, test := range tests {
podTemplateSpec := v1.PodTemplateSpec{}
@ -168,11 +169,6 @@ func TestCreatePodTemplate(t *testing.T) {
}
}
func int64Ptr(i int) *int64 {
li := int64(i)
return &li
}
func TestReplaceDaemonSetPodNodeNameNodeAffinity(t *testing.T) {
tests := []struct {
affinity *v1.Affinity

View File

@ -36,6 +36,7 @@ go_test(
"//staging/src/k8s.io/api/batch/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -24,6 +24,7 @@ import (
batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilpointer "k8s.io/utils/pointer"
)
func newJob(completionTime, failedTime metav1.Time, ttl *int32) *batch.Job {
@ -74,10 +75,6 @@ func durationPointer(n int) *time.Duration {
return &s
}
func int32Ptr(n int32) *int32 {
return &n
}
func TestTimeLeft(t *testing.T) {
now := metav1.Now()
@ -93,7 +90,7 @@ func TestTimeLeft(t *testing.T) {
}{
{
name: "Error case: Job unfinished",
ttl: int32Ptr(100),
ttl: utilpointer.Int32Ptr(100),
since: &now.Time,
expectErr: true,
expectErrStr: "should not be cleaned up",
@ -108,21 +105,21 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job completed now, 0s TTL",
completionTime: now,
ttl: int32Ptr(0),
ttl: utilpointer.Int32Ptr(0),
since: &now.Time,
expectedTimeLeft: durationPointer(0),
},
{
name: "Job completed now, 10s TTL",
completionTime: now,
ttl: int32Ptr(10),
ttl: utilpointer.Int32Ptr(10),
since: &now.Time,
expectedTimeLeft: durationPointer(10),
},
{
name: "Job completed 10s ago, 15s TTL",
completionTime: metav1.NewTime(now.Add(-10 * time.Second)),
ttl: int32Ptr(15),
ttl: utilpointer.Int32Ptr(15),
since: &now.Time,
expectedTimeLeft: durationPointer(5),
},
@ -136,21 +133,21 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job failed now, 0s TTL",
failedTime: now,
ttl: int32Ptr(0),
ttl: utilpointer.Int32Ptr(0),
since: &now.Time,
expectedTimeLeft: durationPointer(0),
},
{
name: "Job failed now, 10s TTL",
failedTime: now,
ttl: int32Ptr(10),
ttl: utilpointer.Int32Ptr(10),
since: &now.Time,
expectedTimeLeft: durationPointer(10),
},
{
name: "Job failed 10s ago, 15s TTL",
failedTime: metav1.NewTime(now.Add(-10 * time.Second)),
ttl: int32Ptr(15),
ttl: utilpointer.Int32Ptr(15),
since: &now.Time,
expectedTimeLeft: durationPointer(5),
},

View File

@ -89,6 +89,7 @@ go_library(
"//staging/src/k8s.io/client-go/scale:go_default_library",
"//staging/src/k8s.io/client-go/util/retry:go_default_library",
"//vendor/k8s.io/utils/integer:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -75,6 +75,7 @@ go_test(
"//staging/src/k8s.io/client-go/testing:go_default_library",
"//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library",
"//vendor/github.com/spf13/cobra:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -50,6 +50,7 @@ import (
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
"k8s.io/kubernetes/pkg/kubectl/scheme"
utilpointer "k8s.io/utils/pointer"
)
var (
@ -1251,7 +1252,7 @@ func TestForceApply(t *testing.T) {
var bodyRC io.ReadCloser
if isScaledDownToZero {
rcObj := readReplicationControllerFromFile(t, filenameRC)
rcObj.Spec.Replicas = cmdtesting.Int32ptr(0)
rcObj.Spec.Replicas = utilpointer.Int32Ptr(0)
rcBytes, err := runtime.Encode(codec, rcObj)
if err != nil {
t.Fatal(err)

View File

@ -50,6 +50,7 @@ go_test(
"//staging/src/k8s.io/cli-runtime/pkg/printers:go_default_library",
"//staging/src/k8s.io/client-go/rest/fake:go_default_library",
"//vendor/github.com/spf13/cobra:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -51,6 +51,7 @@ import (
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/drain"
"k8s.io/kubernetes/pkg/kubectl/scheme"
utilpointer "k8s.io/utils/pointer"
)
const (
@ -61,8 +62,6 @@ const (
var node *corev1.Node
var cordonedNode *corev1.Node
func boolptr(b bool) *bool { return &b }
func TestMain(m *testing.M) {
// Create a node.
node = &corev1.Node{
@ -286,8 +285,8 @@ func TestDrain(t *testing.T) {
Kind: "ReplicationController",
Name: "rc",
UID: "123",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},
@ -318,8 +317,8 @@ func TestDrain(t *testing.T) {
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},
@ -339,8 +338,8 @@ func TestDrain(t *testing.T) {
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},
@ -363,8 +362,8 @@ func TestDrain(t *testing.T) {
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},
@ -413,8 +412,8 @@ func TestDrain(t *testing.T) {
APIVersion: "v1",
Kind: "Job",
Name: "job",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},
@ -440,8 +439,8 @@ func TestDrain(t *testing.T) {
APIVersion: "v1",
Kind: "Job",
Name: "job",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},
@ -482,8 +481,8 @@ func TestDrain(t *testing.T) {
APIVersion: "v1",
Kind: "ReplicaSet",
Name: "rs",
BlockOwnerDeletion: boolptr(true),
Controller: boolptr(true),
BlockOwnerDeletion: utilpointer.BoolPtr(true),
Controller: utilpointer.BoolPtr(true),
},
},
},

View File

@ -139,8 +139,3 @@ func InitTestErrorHandler(t *testing.T) {
t.Errorf("Error running command (exit code %d): %s", code, str)
})
}
func Int32ptr(val int) *int32 {
t := int32(val)
return &t
}

View File

@ -3088,12 +3088,6 @@ func TestDescribeStatefulSet(t *testing.T) {
}
}
// boolPtr returns a pointer to a bool
func boolPtr(b bool) *bool {
o := b
return &o
}
func TestControllerRef(t *testing.T) {
var replicas int32 = 1
f := fake.NewSimpleClientset(
@ -3123,7 +3117,7 @@ func TestControllerRef(t *testing.T) {
Name: "barpod",
Namespace: "foo",
Labels: map[string]string{"abc": "xyz"},
OwnerReferences: []metav1.OwnerReference{{Name: "bar", UID: "123456", Controller: boolPtr(true)}},
OwnerReferences: []metav1.OwnerReference{{Name: "bar", UID: "123456", Controller: utilpointer.BoolPtr(true)}},
},
TypeMeta: metav1.TypeMeta{
Kind: "Pod",
@ -3160,7 +3154,7 @@ func TestControllerRef(t *testing.T) {
Name: "buzpod",
Namespace: "foo",
Labels: map[string]string{"abc": "xyz"},
OwnerReferences: []metav1.OwnerReference{{Name: "buz", UID: "654321", Controller: boolPtr(true)}},
OwnerReferences: []metav1.OwnerReference{{Name: "buz", UID: "654321", Controller: utilpointer.BoolPtr(true)}},
},
TypeMeta: metav1.TypeMeta{
Kind: "Pod",

View File

@ -38,13 +38,9 @@ import (
deploymentutil "k8s.io/kubernetes/pkg/kubectl/util/deployment"
"k8s.io/kubernetes/pkg/kubectl/util/podutils"
"k8s.io/utils/integer"
utilpointer "k8s.io/utils/pointer"
)
func newInt32Ptr(val int) *int32 {
ret := int32(val)
return &ret
}
func valOrZero(val *int32) int32 {
if val == nil {
return int32(0)
@ -393,12 +389,12 @@ func (r *RollingUpdater) scaleDown(newRc, oldRc *corev1.ReplicationController, d
nextOldVal := valOrZero(oldRc.Spec.Replicas) - decrement
oldRc.Spec.Replicas = &nextOldVal
if valOrZero(oldRc.Spec.Replicas) < 0 {
oldRc.Spec.Replicas = newInt32Ptr(0)
oldRc.Spec.Replicas = utilpointer.Int32Ptr(0)
}
// If the new is already fully scaled and available up to the desired size, go
// ahead and scale old all the way down.
if valOrZero(newRc.Spec.Replicas) == desired && newAvailable == desired {
oldRc.Spec.Replicas = newInt32Ptr(0)
oldRc.Spec.Replicas = utilpointer.Int32Ptr(0)
}
// Perform the scale-down.
fmt.Fprintf(config.Out, "Scaling %s down to %d\n", oldRc.Name, valOrZero(oldRc.Spec.Replicas))
@ -482,7 +478,7 @@ func (r *RollingUpdater) getOrCreateTargetControllerWithClient(controller *corev
}
controller.Annotations[desiredReplicasAnnotation] = fmt.Sprintf("%d", valOrZero(controller.Spec.Replicas))
controller.Annotations[sourceIDAnnotation] = sourceID
controller.Spec.Replicas = newInt32Ptr(0)
controller.Spec.Replicas = utilpointer.Int32Ptr(0)
newRc, err := r.rcClient.ReplicationControllers(r.ns).Create(controller)
return newRc, false, err
}

View File

@ -49,6 +49,7 @@ go_test(
"//vendor/k8s.io/klog:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
"//vendor/k8s.io/utils/exec/testing:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@ -41,6 +41,7 @@ import (
iptablestest "k8s.io/kubernetes/pkg/util/iptables/testing"
"k8s.io/utils/exec"
fakeexec "k8s.io/utils/exec/testing"
utilpointer "k8s.io/utils/pointer"
)
func checkAllLines(t *testing.T, table utiliptables.Table, save []byte, expectedLines map[utiliptables.Chain]string) {
@ -845,10 +846,6 @@ func TestNodePortReject(t *testing.T) {
}
}
func strPtr(s string) *string {
return &s
}
func TestOnlyLocalLoadBalancing(t *testing.T) {
ipt := iptablestest.NewFake()
fp := NewFakeProxier(ipt)
@ -895,7 +892,7 @@ func TestOnlyLocalLoadBalancing(t *testing.T) {
NodeName: nil,
}, {
IP: epIP2,
NodeName: strPtr(testHostname),
NodeName: utilpointer.StringPtr(testHostname),
}},
Ports: []v1.EndpointPort{{
Name: svcPortName.Port,
@ -989,7 +986,7 @@ func onlyLocalNodePorts(t *testing.T, fp *Proxier, ipt *iptablestest.FakeIPTable
NodeName: nil,
}, {
IP: epIP2,
NodeName: strPtr(testHostname),
NodeName: utilpointer.StringPtr(testHostname),
}},
Ports: []v1.EndpointPort{{
Name: svcPortName.Port,

View File

@ -28,6 +28,7 @@
- k8s.io/cli-runtime/pkg/printers
- k8s.io/cli-runtime/pkg/resource
- k8s.io/cli-runtime/pkg/kustomize
- k8s.io/utils/pointer
- baseImportPath: "./vendor/k8s.io/apimachinery/"
allowedImports: