mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	pkg/controller: Replace deprecated func usage from the k8s.io/utils/pointer pkg
				
					
				
			This commit is contained in:
		@@ -27,7 +27,7 @@ import (
 | 
			
		||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
			
		||||
	"k8s.io/component-base/featuregate"
 | 
			
		||||
	featuregatetesting "k8s.io/component-base/featuregate/testing"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func newPod(podName string, nodeName string, label map[string]string) *v1.Pod {
 | 
			
		||||
@@ -51,8 +51,8 @@ func newPod(podName string, nodeName string, label map[string]string) *v1.Pod {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestIsPodUpdated(t *testing.T) {
 | 
			
		||||
	templateGeneration := utilpointer.Int64Ptr(12345)
 | 
			
		||||
	badGeneration := utilpointer.Int64Ptr(12350)
 | 
			
		||||
	templateGeneration := pointer.Int64(12345)
 | 
			
		||||
	badGeneration := pointer.Int64(12350)
 | 
			
		||||
	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 +148,8 @@ func TestCreatePodTemplate(t *testing.T) {
 | 
			
		||||
		hash               string
 | 
			
		||||
		expectUniqueLabel  bool
 | 
			
		||||
	}{
 | 
			
		||||
		{utilpointer.Int64Ptr(1), "", false},
 | 
			
		||||
		{utilpointer.Int64Ptr(2), "3242341807", true},
 | 
			
		||||
		{pointer.Int64(1), "", false},
 | 
			
		||||
		{pointer.Int64(2), "3242341807", true},
 | 
			
		||||
	}
 | 
			
		||||
	for _, test := range tests {
 | 
			
		||||
		podTemplateSpec := v1.PodTemplateSpec{}
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,7 @@ import (
 | 
			
		||||
	_ "k8s.io/kubernetes/pkg/apis/core/install"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller"
 | 
			
		||||
	clocktesting "k8s.io/utils/clock/testing"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type pdbStates map[string]policy.PodDisruptionBudget
 | 
			
		||||
@@ -507,7 +507,7 @@ func TestIntegerMaxUnavailableWithScaling(t *testing.T) {
 | 
			
		||||
	ps.VerifyPdbStatus(t, pdbName, 0, 1, 5, 7, map[string]metav1.Time{})
 | 
			
		||||
 | 
			
		||||
	// Update scale of ReplicaSet and check PDB
 | 
			
		||||
	rs.Spec.Replicas = utilpointer.Int32Ptr(5)
 | 
			
		||||
	rs.Spec.Replicas = pointer.Int32(5)
 | 
			
		||||
	update(t, dc.rsStore, rs)
 | 
			
		||||
 | 
			
		||||
	dc.sync(ctx, pdbName)
 | 
			
		||||
@@ -533,7 +533,7 @@ func TestPercentageMaxUnavailableWithScaling(t *testing.T) {
 | 
			
		||||
	ps.VerifyPdbStatus(t, pdbName, 0, 1, 4, 7, map[string]metav1.Time{})
 | 
			
		||||
 | 
			
		||||
	// Update scale of ReplicaSet and check PDB
 | 
			
		||||
	rs.Spec.Replicas = utilpointer.Int32Ptr(3)
 | 
			
		||||
	rs.Spec.Replicas = pointer.Int32(3)
 | 
			
		||||
	update(t, dc.rsStore, rs)
 | 
			
		||||
 | 
			
		||||
	dc.sync(ctx, pdbName)
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ import (
 | 
			
		||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
			
		||||
	controllerpkg "k8s.io/kubernetes/pkg/controller"
 | 
			
		||||
	utilnet "k8s.io/utils/net"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var alwaysReady = func() bool { return true }
 | 
			
		||||
@@ -1942,7 +1942,7 @@ func TestSyncServiceOverCapacity(t *testing.T) {
 | 
			
		||||
		expectedAnnotation:  true,
 | 
			
		||||
	}, {
 | 
			
		||||
		name:                "annotation removed below capacity",
 | 
			
		||||
		startingAnnotation:  utilpointer.StringPtr("truncated"),
 | 
			
		||||
		startingAnnotation:  pointer.String("truncated"),
 | 
			
		||||
		numExisting:         maxCapacity - 1,
 | 
			
		||||
		numDesired:          maxCapacity - 1,
 | 
			
		||||
		numDesiredNotReady:  0,
 | 
			
		||||
@@ -1951,7 +1951,7 @@ func TestSyncServiceOverCapacity(t *testing.T) {
 | 
			
		||||
		expectedAnnotation:  false,
 | 
			
		||||
	}, {
 | 
			
		||||
		name:                "annotation was set to warning previously, annotation removed at capacity",
 | 
			
		||||
		startingAnnotation:  utilpointer.StringPtr("warning"),
 | 
			
		||||
		startingAnnotation:  pointer.String("warning"),
 | 
			
		||||
		numExisting:         maxCapacity,
 | 
			
		||||
		numDesired:          maxCapacity,
 | 
			
		||||
		numDesiredNotReady:  0,
 | 
			
		||||
@@ -1960,7 +1960,7 @@ func TestSyncServiceOverCapacity(t *testing.T) {
 | 
			
		||||
		expectedAnnotation:  false,
 | 
			
		||||
	}, {
 | 
			
		||||
		name:                "annotation was set to warning previously but still over capacity",
 | 
			
		||||
		startingAnnotation:  utilpointer.StringPtr("warning"),
 | 
			
		||||
		startingAnnotation:  pointer.String("warning"),
 | 
			
		||||
		numExisting:         maxCapacity + 1,
 | 
			
		||||
		numDesired:          maxCapacity + 1,
 | 
			
		||||
		numDesiredNotReady:  0,
 | 
			
		||||
@@ -1969,7 +1969,7 @@ func TestSyncServiceOverCapacity(t *testing.T) {
 | 
			
		||||
		expectedAnnotation:  true,
 | 
			
		||||
	}, {
 | 
			
		||||
		name:                "annotation removed at capacity",
 | 
			
		||||
		startingAnnotation:  utilpointer.StringPtr("truncated"),
 | 
			
		||||
		startingAnnotation:  pointer.String("truncated"),
 | 
			
		||||
		numExisting:         maxCapacity,
 | 
			
		||||
		numDesired:          maxCapacity,
 | 
			
		||||
		numDesiredNotReady:  0,
 | 
			
		||||
@@ -1978,7 +1978,7 @@ func TestSyncServiceOverCapacity(t *testing.T) {
 | 
			
		||||
		expectedAnnotation:  false,
 | 
			
		||||
	}, {
 | 
			
		||||
		name:                "no endpoints change, annotation value corrected",
 | 
			
		||||
		startingAnnotation:  utilpointer.StringPtr("invalid"),
 | 
			
		||||
		startingAnnotation:  pointer.String("invalid"),
 | 
			
		||||
		numExisting:         maxCapacity + 1,
 | 
			
		||||
		numDesired:          maxCapacity + 1,
 | 
			
		||||
		numDesiredNotReady:  0,
 | 
			
		||||
@@ -2133,7 +2133,7 @@ func TestTruncateEndpoints(t *testing.T) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestEndpointPortFromServicePort(t *testing.T) {
 | 
			
		||||
	http := utilpointer.StringPtr("http")
 | 
			
		||||
	http := pointer.String("http")
 | 
			
		||||
	testCases := map[string]struct {
 | 
			
		||||
		serviceAppProtocol           *string
 | 
			
		||||
		expectedEndpointsAppProtocol *string
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ import (
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller/endpointslice/topologycache"
 | 
			
		||||
	endpointutil "k8s.io/kubernetes/pkg/controller/util/endpoint"
 | 
			
		||||
	endpointsliceutil "k8s.io/kubernetes/pkg/controller/util/endpointslice"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Most of the tests related to EndpointSlice allocation can be found in reconciler_test.go
 | 
			
		||||
@@ -500,41 +500,41 @@ func TestSyncService(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpointPorts: []discovery.EndpointPort{
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("sctp-example"),
 | 
			
		||||
					Name:     pointer.String("sctp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolSCTP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(3456)),
 | 
			
		||||
					Port:     pointer.Int32(3456),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("udp-example"),
 | 
			
		||||
					Name:     pointer.String("udp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolUDP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(161)),
 | 
			
		||||
					Port:     pointer.Int32(161),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("tcp-example"),
 | 
			
		||||
					Name:     pointer.String("tcp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolTCP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(80)),
 | 
			
		||||
					Port:     pointer.Int32(80),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
						Ready:       pointer.Bool(true),
 | 
			
		||||
						Serving:     pointer.Bool(true),
 | 
			
		||||
						Terminating: pointer.Bool(false),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"10.0.0.1"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
						Ready:       pointer.Bool(true),
 | 
			
		||||
						Serving:     pointer.Bool(true),
 | 
			
		||||
						Terminating: pointer.Bool(false),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"10.0.0.2"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod1"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -617,31 +617,31 @@ func TestSyncService(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpointPorts: []discovery.EndpointPort{
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("sctp-example"),
 | 
			
		||||
					Name:     pointer.String("sctp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolSCTP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(3456)),
 | 
			
		||||
					Port:     pointer.Int32(3456),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("udp-example"),
 | 
			
		||||
					Name:     pointer.String("udp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolUDP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(161)),
 | 
			
		||||
					Port:     pointer.Int32(161),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("tcp-example"),
 | 
			
		||||
					Name:     pointer.String("tcp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolTCP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(80)),
 | 
			
		||||
					Port:     pointer.Int32(80),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
						Ready:       pointer.Bool(true),
 | 
			
		||||
						Serving:     pointer.Bool(true),
 | 
			
		||||
						Terminating: pointer.Bool(false),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"fd08::5678:0000:0000:9abc:def0"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod1"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -722,41 +722,41 @@ func TestSyncService(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpointPorts: []discovery.EndpointPort{
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("sctp-example"),
 | 
			
		||||
					Name:     pointer.String("sctp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolSCTP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(3456)),
 | 
			
		||||
					Port:     pointer.Int32(3456),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("udp-example"),
 | 
			
		||||
					Name:     pointer.String("udp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolUDP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(161)),
 | 
			
		||||
					Port:     pointer.Int32(161),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("tcp-example"),
 | 
			
		||||
					Name:     pointer.String("tcp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolTCP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(80)),
 | 
			
		||||
					Port:     pointer.Int32(80),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
						Ready:       pointer.Bool(true),
 | 
			
		||||
						Serving:     pointer.Bool(true),
 | 
			
		||||
						Terminating: pointer.Bool(false),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"10.0.0.1"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(false),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(true),
 | 
			
		||||
						Ready:       pointer.Bool(false),
 | 
			
		||||
						Serving:     pointer.Bool(true),
 | 
			
		||||
						Terminating: pointer.Bool(true),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"10.0.0.2"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod1"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -837,41 +837,41 @@ func TestSyncService(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpointPorts: []discovery.EndpointPort{
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("sctp-example"),
 | 
			
		||||
					Name:     pointer.String("sctp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolSCTP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(3456)),
 | 
			
		||||
					Port:     pointer.Int32(3456),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("udp-example"),
 | 
			
		||||
					Name:     pointer.String("udp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolUDP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(161)),
 | 
			
		||||
					Port:     pointer.Int32(161),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Name:     utilpointer.StringPtr("tcp-example"),
 | 
			
		||||
					Name:     pointer.String("tcp-example"),
 | 
			
		||||
					Protocol: protoPtr(v1.ProtocolTCP),
 | 
			
		||||
					Port:     utilpointer.Int32Ptr(int32(80)),
 | 
			
		||||
					Port:     pointer.Int32(80),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedEndpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
						Ready:       pointer.Bool(true),
 | 
			
		||||
						Serving:     pointer.Bool(true),
 | 
			
		||||
						Terminating: pointer.Bool(false),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"10.0.0.1"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Conditions: discovery.EndpointConditions{
 | 
			
		||||
						Ready:       utilpointer.BoolPtr(false),
 | 
			
		||||
						Serving:     utilpointer.BoolPtr(false),
 | 
			
		||||
						Terminating: utilpointer.BoolPtr(true),
 | 
			
		||||
						Ready:       pointer.Bool(false),
 | 
			
		||||
						Serving:     pointer.Bool(false),
 | 
			
		||||
						Terminating: pointer.Bool(true),
 | 
			
		||||
					},
 | 
			
		||||
					Addresses: []string{"10.0.0.2"},
 | 
			
		||||
					TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod1"},
 | 
			
		||||
					NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
					NodeName:  pointer.String("node-1"),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ import (
 | 
			
		||||
	discovery "k8s.io/api/discovery/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/types"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller/util/endpoint"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNumEndpointsAndSlices(t *testing.T) {
 | 
			
		||||
@@ -92,8 +92,8 @@ func expectNumEndpointsAndSlices(t *testing.T, c *Cache, desired int, actual int
 | 
			
		||||
func benchmarkUpdateServicePortCache(b *testing.B, num int) {
 | 
			
		||||
	c := NewCache(int32(100))
 | 
			
		||||
	ns := "benchmark"
 | 
			
		||||
	httpKey := endpoint.NewPortMapKey([]discovery.EndpointPort{{Port: utilpointer.Int32Ptr(80)}})
 | 
			
		||||
	httpsKey := endpoint.NewPortMapKey([]discovery.EndpointPort{{Port: utilpointer.Int32Ptr(443)}})
 | 
			
		||||
	httpKey := endpoint.NewPortMapKey([]discovery.EndpointPort{{Port: pointer.Int32(80)}})
 | 
			
		||||
	httpsKey := endpoint.NewPortMapKey([]discovery.EndpointPort{{Port: pointer.Int32(443)}})
 | 
			
		||||
	spCache := &ServicePortCache{items: map[endpoint.PortMapKey]EfficiencyInfo{
 | 
			
		||||
		httpKey: {
 | 
			
		||||
			Endpoints: 182,
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ import (
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller/endpointslice/metrics"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller/endpointslice/topologycache"
 | 
			
		||||
	endpointsliceutil "k8s.io/kubernetes/pkg/controller/util/endpointslice"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var defaultMaxEndpointsPerSlice = int32(100)
 | 
			
		||||
@@ -125,12 +125,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1.2.3.4"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -151,12 +151,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1.2.3.4"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -178,12 +178,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1.2.3.4"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -196,12 +196,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.4"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &corev1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: namespace,
 | 
			
		||||
@@ -220,12 +220,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1.2.3.4"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -238,12 +238,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.4"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &corev1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: namespace,
 | 
			
		||||
@@ -264,12 +264,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1.2.3.4"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -282,12 +282,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.4"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &corev1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: namespace,
 | 
			
		||||
@@ -308,12 +308,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1234::5678:0000:0000:9abc:def0"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -336,12 +336,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1234::5678:0000:0000:9abc:def0"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -363,12 +363,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1234::5678:0000:0000:9abc:def0"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -380,12 +380,12 @@ func TestReconcile1Pod(t *testing.T) {
 | 
			
		||||
					{
 | 
			
		||||
						Addresses: []string{"1.2.3.4"},
 | 
			
		||||
						Conditions: discovery.EndpointConditions{
 | 
			
		||||
							Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
							Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
							Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
							Ready:       pointer.Bool(true),
 | 
			
		||||
							Serving:     pointer.Bool(true),
 | 
			
		||||
							Terminating: pointer.Bool(false),
 | 
			
		||||
						},
 | 
			
		||||
						Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
						NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
						Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
						NodeName: pointer.String("node-1"),
 | 
			
		||||
						TargetRef: &corev1.ObjectReference{
 | 
			
		||||
							Kind:      "Pod",
 | 
			
		||||
							Namespace: namespace,
 | 
			
		||||
@@ -1192,9 +1192,9 @@ func TestReconcileEndpointSlicesNamedPorts(t *testing.T) {
 | 
			
		||||
	for i := range fetchedSlices {
 | 
			
		||||
		expectedSlices = append(expectedSlices, discovery.EndpointSlice{
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr(""),
 | 
			
		||||
				Name:     pointer.String(""),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(int32(8080 + i)),
 | 
			
		||||
				Port:     pointer.Int32(int32(8080 + i)),
 | 
			
		||||
			}},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
		})
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	discovery "k8s.io/api/discovery/v1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func Test_getTotalReadyEndpoints(t *testing.T) {
 | 
			
		||||
@@ -93,14 +93,14 @@ func sliceWithNEndpoints(ready, unready int) *discovery.EndpointSlice {
 | 
			
		||||
	for i := 0; i < ready; i++ {
 | 
			
		||||
		endpoints[i] = discovery.Endpoint{
 | 
			
		||||
			Addresses:  []string{fmt.Sprintf("10.1.2.%d", i)},
 | 
			
		||||
			Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
			Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for i := 0; i < unready; i++ {
 | 
			
		||||
		endpoints[ready+i] = discovery.Endpoint{
 | 
			
		||||
			Addresses:  []string{fmt.Sprintf("10.1.2.%d", ready+i)},
 | 
			
		||||
			Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(false)},
 | 
			
		||||
			Conditions: discovery.EndpointConditions{Ready: pointer.Bool(false)},
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import (
 | 
			
		||||
	discovery "k8s.io/api/discovery/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/api/resource"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestAddHints(t *testing.T) {
 | 
			
		||||
@@ -65,8 +65,8 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
			ToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
@@ -74,8 +74,8 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
		expectedSlicesToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedSlicesToUpdate: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -99,12 +99,12 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
			ToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
@@ -112,12 +112,12 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
		expectedSlicesToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Zone:       pointer.String("zone-b"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedSlicesToUpdate: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -140,12 +140,12 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
			ToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
@@ -158,14 +158,14 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
		expectedSlicesToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Zone:       pointer.String("zone-b"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedSlicesToUpdate: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -188,19 +188,19 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
			ToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.2.5"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(false)},
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(false)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses: []string{"10.1.2.6"},
 | 
			
		||||
					Zone:      utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Zone:      pointer.String("zone-b"),
 | 
			
		||||
				}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
@@ -213,22 +213,22 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
		expectedSlicesToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Zone:       pointer.String("zone-b"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.2.5"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Zone:       pointer.String("zone-b"),
 | 
			
		||||
				Hints:      nil,
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(false)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(false)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses: []string{"10.1.2.6"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Zone:      pointer.String("zone-b"),
 | 
			
		||||
				Hints:     nil,
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
@@ -253,51 +253,51 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
			ToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}, {
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.1.3.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-c"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-c"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.3.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-c"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-c"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.1.3.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}},
 | 
			
		||||
			ToUpdate: []*discovery.EndpointSlice{{
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.2.2.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.2.2.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}, {
 | 
			
		||||
				Endpoints: []discovery.Endpoint{{
 | 
			
		||||
					Addresses:  []string{"10.2.3.3"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.2.3.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-c"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-c"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}, {
 | 
			
		||||
					Addresses:  []string{"10.2.3.4"},
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
@@ -311,61 +311,61 @@ func TestAddHints(t *testing.T) {
 | 
			
		||||
		expectedSlicesToCreate: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.1.2.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.2.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Zone:       pointer.String("zone-b"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.1.3.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-c"),
 | 
			
		||||
				Zone:       pointer.String("zone-c"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-c"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.3.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-c"),
 | 
			
		||||
				Zone:       pointer.String("zone-c"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-c"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.1.3.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedSlicesToUpdate: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.2.2.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.2.2.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.2.3.3"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
				Zone:       pointer.String("zone-b"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.2.3.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-c"),
 | 
			
		||||
				Zone:       pointer.String("zone-c"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-c"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.2.3.4"},
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedEvents: []*EventBuilder{
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	discovery "k8s.io/api/discovery/v1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func Test_redistributeHints(t *testing.T) {
 | 
			
		||||
@@ -41,9 +41,9 @@ func Test_redistributeHints(t *testing.T) {
 | 
			
		||||
		name: "single endpoint",
 | 
			
		||||
		slices: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		givingZones:             map[string]int{"zone-a": 1},
 | 
			
		||||
@@ -53,17 +53,17 @@ func Test_redistributeHints(t *testing.T) {
 | 
			
		||||
		name: "endpoints from 1 zone redistributed to 2 other zones",
 | 
			
		||||
		slices: []*discovery.EndpointSlice{{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		givingZones:             map[string]int{"zone-a": 2},
 | 
			
		||||
@@ -215,9 +215,9 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		name: "single zone hint",
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
		allocations: map[string]Allocation{
 | 
			
		||||
@@ -231,15 +231,15 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		name: "single zone hint with 1 unready endpoint and 1 unknown endpoint",
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:       pointer.String("zone-a"),
 | 
			
		||||
				Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(false)},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(false)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Zone:  utilpointer.StringPtr("zone-a"),
 | 
			
		||||
				Zone:  pointer.String("zone-a"),
 | 
			
		||||
				Hints: &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
@@ -255,19 +255,19 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-b"),
 | 
			
		||||
					Zone:       pointer.String("zone-b"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-b"}}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -286,9 +286,9 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-non-existent"}}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -302,9 +302,9 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      nil,
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -318,9 +318,9 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -334,14 +334,14 @@ func Test_getHintsByZone(t *testing.T) {
 | 
			
		||||
		slice: discovery.EndpointSlice{
 | 
			
		||||
			Endpoints: []discovery.Endpoint{
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					Zone:       utilpointer.StringPtr("zone-a"),
 | 
			
		||||
					Zone:       pointer.String("zone-a"),
 | 
			
		||||
					Hints:      &discovery.EndpointHints{ForZones: []discovery.ForZone{{Name: "zone-a"}}},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
					Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/util/rand"
 | 
			
		||||
	"k8s.io/client-go/kubernetes/fake"
 | 
			
		||||
	k8stesting "k8s.io/client-go/testing"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNewEndpointSlice(t *testing.T) {
 | 
			
		||||
@@ -256,11 +256,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -276,11 +276,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -296,11 +296,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(false),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(false),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(false),
 | 
			
		||||
					Serving:     pointer.Bool(false),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -316,11 +316,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(false),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(false),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -337,12 +337,12 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -359,12 +359,12 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.4"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -381,13 +381,13 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Hostname: &readyPodHostname.Spec.Hostname,
 | 
			
		||||
				Zone:     utilpointer.StringPtr("us-central1-a"),
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:     pointer.String("us-central1-a"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -403,11 +403,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -423,11 +423,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(false),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready:       pointer.Bool(false),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -443,11 +443,11 @@ func TestPodToEndpoint(t *testing.T) {
 | 
			
		||||
			expectedEndpoint: discovery.Endpoint{
 | 
			
		||||
				Addresses: []string{"1.2.3.5"},
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(false),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(false),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready:       pointer.Bool(false),
 | 
			
		||||
					Serving:     pointer.Bool(false),
 | 
			
		||||
					Terminating: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
				TargetRef: &v1.ObjectReference{
 | 
			
		||||
					Kind:      "Pod",
 | 
			
		||||
					Namespace: ns,
 | 
			
		||||
@@ -527,7 +527,7 @@ func TestGetEndpointPorts(t *testing.T) {
 | 
			
		||||
						Port:        80,
 | 
			
		||||
						TargetPort:  intstr.FromInt(80),
 | 
			
		||||
						Protocol:    protoTCP,
 | 
			
		||||
						AppProtocol: utilpointer.StringPtr("example.com/custom-protocol"),
 | 
			
		||||
						AppProtocol: pointer.String("example.com/custom-protocol"),
 | 
			
		||||
					}},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
@@ -539,10 +539,10 @@ func TestGetEndpointPorts(t *testing.T) {
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedPorts: []*discovery.EndpointPort{{
 | 
			
		||||
				Name:        utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:        utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:        pointer.String("http"),
 | 
			
		||||
				Port:        pointer.Int32(80),
 | 
			
		||||
				Protocol:    &protoTCP,
 | 
			
		||||
				AppProtocol: utilpointer.StringPtr("example.com/custom-protocol"),
 | 
			
		||||
				AppProtocol: pointer.String("example.com/custom-protocol"),
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
		"service with named port and AppProtocol on one port": {
 | 
			
		||||
@@ -557,7 +557,7 @@ func TestGetEndpointPorts(t *testing.T) {
 | 
			
		||||
						Name:        "https",
 | 
			
		||||
						Protocol:    protoTCP,
 | 
			
		||||
						TargetPort:  intstr.FromString("https"),
 | 
			
		||||
						AppProtocol: utilpointer.StringPtr("https"),
 | 
			
		||||
						AppProtocol: pointer.String("https"),
 | 
			
		||||
					}},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
@@ -573,14 +573,14 @@ func TestGetEndpointPorts(t *testing.T) {
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedPorts: []*discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}, {
 | 
			
		||||
				Name:        utilpointer.StringPtr("https"),
 | 
			
		||||
				Port:        utilpointer.Int32Ptr(443),
 | 
			
		||||
				Name:        pointer.String("https"),
 | 
			
		||||
				Port:        pointer.Int32(443),
 | 
			
		||||
				Protocol:    &protoTCP,
 | 
			
		||||
				AppProtocol: utilpointer.StringPtr("https"),
 | 
			
		||||
				AppProtocol: pointer.String("https"),
 | 
			
		||||
			}},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ import (
 | 
			
		||||
	"k8s.io/component-base/metrics/testutil"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller/endpointslicemirroring/metrics"
 | 
			
		||||
	endpointsliceutil "k8s.io/kubernetes/pkg/controller/util/endpointslice"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const defaultMaxEndpointsPerSubset = int32(1000)
 | 
			
		||||
@@ -83,7 +83,7 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -101,7 +101,7 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		endpointsDeletionPending: true,
 | 
			
		||||
@@ -127,14 +127,14 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}},
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.0.0.1"},
 | 
			
		||||
				Hostname:   utilpointer.StringPtr("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Hostname:   pointer.String("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedNumSlices:     1,
 | 
			
		||||
@@ -159,14 +159,14 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}},
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.0.0.1"},
 | 
			
		||||
				Hostname:   utilpointer.StringPtr("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Hostname:   pointer.String("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedNumSlices:     1,
 | 
			
		||||
@@ -192,14 +192,14 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}},
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.0.0.1"},
 | 
			
		||||
				Hostname:   utilpointer.StringPtr("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Hostname:   pointer.String("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedNumSlices:     1,
 | 
			
		||||
@@ -219,11 +219,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -245,11 +245,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			NotReadyAddresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -271,20 +271,20 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.1.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.1.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
			NotReadyAddresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -306,11 +306,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -325,15 +325,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.3",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -355,11 +355,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -374,15 +374,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.3",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{{
 | 
			
		||||
@@ -391,12 +391,12 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}, {
 | 
			
		||||
				Name:     utilpointer.StringPtr("https"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(443),
 | 
			
		||||
				Name:     pointer.String("https"),
 | 
			
		||||
				Port:     pointer.Int32(443),
 | 
			
		||||
				Protocol: &protoUDP,
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
@@ -418,11 +418,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -437,15 +437,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.3",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{{
 | 
			
		||||
@@ -454,20 +454,20 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}, {
 | 
			
		||||
				Name:     utilpointer.StringPtr("https"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(443),
 | 
			
		||||
				Name:     pointer.String("https"),
 | 
			
		||||
				Port:     pointer.Int32(443),
 | 
			
		||||
				Protocol: &protoUDP,
 | 
			
		||||
			}},
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses: []string{"10.0.0.2"},
 | 
			
		||||
				Hostname:  utilpointer.StringPtr("pod-2"),
 | 
			
		||||
				Hostname:  pointer.String("pod-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses: []string{"10.0.0.1", "10.0.0.3"},
 | 
			
		||||
				Hostname:  utilpointer.StringPtr("pod-1"),
 | 
			
		||||
				Hostname:  pointer.String("pod-1"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedNumSlices:     2,
 | 
			
		||||
@@ -488,11 +488,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -507,15 +507,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.3",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{{
 | 
			
		||||
@@ -524,24 +524,24 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}, {
 | 
			
		||||
				Name:     utilpointer.StringPtr("https"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(443),
 | 
			
		||||
				Name:     pointer.String("https"),
 | 
			
		||||
				Port:     pointer.Int32(443),
 | 
			
		||||
				Protocol: &protoUDP,
 | 
			
		||||
			}},
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.0.0.1"},
 | 
			
		||||
				Hostname:   utilpointer.StringPtr("pod-1"),
 | 
			
		||||
				NodeName:   utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Hostname:   pointer.String("pod-1"),
 | 
			
		||||
				NodeName:   pointer.String("node-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}, {
 | 
			
		||||
				Addresses:  []string{"10.0.0.2"},
 | 
			
		||||
				Hostname:   utilpointer.StringPtr("pod-2"),
 | 
			
		||||
				NodeName:   utilpointer.StringPtr("node-2"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Hostname:   pointer.String("pod-2"),
 | 
			
		||||
				NodeName:   pointer.String("node-2"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedNumSlices:     2,
 | 
			
		||||
@@ -562,11 +562,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "2001:db8:2222:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -581,15 +581,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "2001:db8:3333:4444:5555:6666:7777:8888",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -611,11 +611,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "2001:db8:1111:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "2001:db8:2222:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -630,15 +630,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "2001:db8:3333:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "2001:db8:4444:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "2001:db8:5555:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -660,11 +660,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "2001:db8:1111:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "this-is-not-an-ip",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -679,15 +679,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "this-is-also-not-an-ip",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "2001:db8:4444:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "2001:db8:5555:3333:4444:5555:6666:7777",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -709,11 +709,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "this-is-not-an-ip1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "this-is-not-an-ip12",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -728,15 +728,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "this-is-not-an-ip11",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "this-is-not-an-ip12",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "this-is-not-an-ip3",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -758,11 +758,11 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.0.1",
 | 
			
		||||
				Hostname: "pod-1",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.0.2",
 | 
			
		||||
				Hostname: "pod-2",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}},
 | 
			
		||||
		}, {
 | 
			
		||||
			Ports: []corev1.EndpointPort{{
 | 
			
		||||
@@ -777,15 +777,15 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			Addresses: []corev1.EndpointAddress{{
 | 
			
		||||
				IP:       "10.0.1.1",
 | 
			
		||||
				Hostname: "pod-11",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName: pointer.String("node-1"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.2",
 | 
			
		||||
				Hostname: "pod-12",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName: pointer.String("node-2"),
 | 
			
		||||
			}, {
 | 
			
		||||
				IP:       "10.0.1.3",
 | 
			
		||||
				Hostname: "pod-13",
 | 
			
		||||
				NodeName: utilpointer.StringPtr("node-3"),
 | 
			
		||||
				NodeName: pointer.String("node-3"),
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		existingEndpointSlices: []*discovery.EndpointSlice{},
 | 
			
		||||
@@ -893,14 +893,14 @@ func TestReconcile(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			AddressType: discovery.AddressTypeIPv4,
 | 
			
		||||
			Ports: []discovery.EndpointPort{{
 | 
			
		||||
				Name:     utilpointer.StringPtr("http"),
 | 
			
		||||
				Port:     utilpointer.Int32Ptr(80),
 | 
			
		||||
				Name:     pointer.String("http"),
 | 
			
		||||
				Port:     pointer.Int32(80),
 | 
			
		||||
				Protocol: &protoTCP,
 | 
			
		||||
			}},
 | 
			
		||||
			Endpoints: []discovery.Endpoint{{
 | 
			
		||||
				Addresses:  []string{"10.0.0.1"},
 | 
			
		||||
				Hostname:   utilpointer.StringPtr("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)},
 | 
			
		||||
				Hostname:   pointer.String("pod-1"),
 | 
			
		||||
				Conditions: discovery.EndpointConditions{Ready: pointer.Bool(true)},
 | 
			
		||||
			}},
 | 
			
		||||
		}},
 | 
			
		||||
		expectedNumSlices:     1,
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	v1 "k8s.io/api/core/v1"
 | 
			
		||||
	discovery "k8s.io/api/discovery/v1"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
@@ -29,7 +29,7 @@ import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/util/rand"
 | 
			
		||||
	"k8s.io/client-go/kubernetes/fake"
 | 
			
		||||
	k8stesting "k8s.io/client-go/testing"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNewEndpointSlice(t *testing.T) {
 | 
			
		||||
@@ -193,7 +193,7 @@ func TestAddressToEndpoint(t *testing.T) {
 | 
			
		||||
	epAddress := v1.EndpointAddress{
 | 
			
		||||
		IP:       "10.1.2.3",
 | 
			
		||||
		Hostname: "foo",
 | 
			
		||||
		NodeName: utilpointer.StringPtr("node-abc"),
 | 
			
		||||
		NodeName: pointer.String("node-abc"),
 | 
			
		||||
		TargetRef: &v1.ObjectReference{
 | 
			
		||||
			APIVersion: "v1",
 | 
			
		||||
			Kind:       "Pod",
 | 
			
		||||
@@ -204,9 +204,9 @@ func TestAddressToEndpoint(t *testing.T) {
 | 
			
		||||
	ready := true
 | 
			
		||||
	expectedEndpoint := discovery.Endpoint{
 | 
			
		||||
		Addresses: []string{"10.1.2.3"},
 | 
			
		||||
		Hostname:  utilpointer.StringPtr("foo"),
 | 
			
		||||
		Hostname:  pointer.String("foo"),
 | 
			
		||||
		Conditions: discovery.EndpointConditions{
 | 
			
		||||
			Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
			Ready: pointer.BoolPtr(true),
 | 
			
		||||
		},
 | 
			
		||||
		TargetRef: &v1.ObjectReference{
 | 
			
		||||
			APIVersion: "v1",
 | 
			
		||||
@@ -214,7 +214,7 @@ func TestAddressToEndpoint(t *testing.T) {
 | 
			
		||||
			Namespace:  "default",
 | 
			
		||||
			Name:       "foo",
 | 
			
		||||
		},
 | 
			
		||||
		NodeName: utilpointer.StringPtr("node-abc"),
 | 
			
		||||
		NodeName: pointer.String("node-abc"),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ep := addressToEndpoint(epAddress, ready)
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ package v1alpha1
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RecommendedDefaultGarbageCollectorControllerConfiguration defaults a pointer to a
 | 
			
		||||
@@ -32,7 +32,7 @@ import (
 | 
			
		||||
// run it in your wrapper struct of this type in its `SetDefaults_` method.
 | 
			
		||||
func RecommendedDefaultGarbageCollectorControllerConfiguration(obj *kubectrlmgrconfigv1alpha1.GarbageCollectorControllerConfiguration) {
 | 
			
		||||
	if obj.EnableGarbageCollector == nil {
 | 
			
		||||
		obj.EnableGarbageCollector = utilpointer.BoolPtr(true)
 | 
			
		||||
		obj.EnableGarbageCollector = pointer.Bool(true)
 | 
			
		||||
	}
 | 
			
		||||
	if obj.ConcurrentGCSyncs == 0 {
 | 
			
		||||
		obj.ConcurrentGCSyncs = 20
 | 
			
		||||
 
 | 
			
		||||
@@ -489,7 +489,7 @@ func TestAbsentOwnerCache(t *testing.T) {
 | 
			
		||||
			Name:       "rc1",
 | 
			
		||||
			UID:        "1",
 | 
			
		||||
			APIVersion: "v1",
 | 
			
		||||
			Controller: pointer.BoolPtr(true),
 | 
			
		||||
			Controller: pointer.Bool(true),
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
	rc1Pod2 := getPod("rc1Pod2", []metav1.OwnerReference{
 | 
			
		||||
@@ -498,7 +498,7 @@ func TestAbsentOwnerCache(t *testing.T) {
 | 
			
		||||
			Name:       "rc1",
 | 
			
		||||
			UID:        "1",
 | 
			
		||||
			APIVersion: "v1",
 | 
			
		||||
			Controller: pointer.BoolPtr(false),
 | 
			
		||||
			Controller: pointer.Bool(false),
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
	rc2Pod1 := getPod("rc2Pod1", []metav1.OwnerReference{
 | 
			
		||||
 
 | 
			
		||||
@@ -220,7 +220,7 @@ func TestCalculateSucceededIndexes(t *testing.T) {
 | 
			
		||||
					CompletedIndexes: tc.prevSucceeded,
 | 
			
		||||
				},
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					Completions: pointer.Int32Ptr(tc.completions),
 | 
			
		||||
					Completions: pointer.Int32(tc.completions),
 | 
			
		||||
				},
 | 
			
		||||
			}
 | 
			
		||||
			if tc.trackingWithFinalizers {
 | 
			
		||||
 
 | 
			
		||||
@@ -739,7 +739,7 @@ func TestControllerSyncJob(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
				// job & pods setup
 | 
			
		||||
				job := newJob(tc.parallelism, tc.completions, tc.backoffLimit, tc.completionMode)
 | 
			
		||||
				job.Spec.Suspend = pointer.BoolPtr(tc.suspend)
 | 
			
		||||
				job.Spec.Suspend = pointer.Bool(tc.suspend)
 | 
			
		||||
				key, err := controller.KeyFunc(job)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					t.Errorf("Unexpected error getting job key: %v", err)
 | 
			
		||||
@@ -931,7 +931,7 @@ func TestSyncJobLegacyTracking(t *testing.T) {
 | 
			
		||||
					Namespace: "ns",
 | 
			
		||||
				},
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					Parallelism: pointer.Int32Ptr(1),
 | 
			
		||||
					Parallelism: pointer.Int32(1),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -945,7 +945,7 @@ func TestSyncJobLegacyTracking(t *testing.T) {
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					Parallelism: pointer.Int32Ptr(1),
 | 
			
		||||
					Parallelism: pointer.Int32(1),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			wantUncounted: true,
 | 
			
		||||
@@ -960,7 +960,7 @@ func TestSyncJobLegacyTracking(t *testing.T) {
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					Parallelism: pointer.Int32Ptr(1),
 | 
			
		||||
					Parallelism: pointer.Int32(1),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
@@ -1423,7 +1423,7 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
 | 
			
		||||
			job: batch.Job{
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					CompletionMode: &indexedCompletion,
 | 
			
		||||
					Completions:    pointer.Int32Ptr(6),
 | 
			
		||||
					Completions:    pointer.Int32(6),
 | 
			
		||||
				},
 | 
			
		||||
				Status: batch.JobStatus{
 | 
			
		||||
					Active: 1,
 | 
			
		||||
@@ -1450,7 +1450,7 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
 | 
			
		||||
			job: batch.Job{
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					CompletionMode: &indexedCompletion,
 | 
			
		||||
					Completions:    pointer.Int32Ptr(6),
 | 
			
		||||
					Completions:    pointer.Int32(6),
 | 
			
		||||
				},
 | 
			
		||||
				Status: batch.JobStatus{
 | 
			
		||||
					Active: 1,
 | 
			
		||||
@@ -1482,7 +1482,7 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
 | 
			
		||||
			job: batch.Job{
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					CompletionMode: &indexedCompletion,
 | 
			
		||||
					Completions:    pointer.Int32Ptr(7),
 | 
			
		||||
					Completions:    pointer.Int32(7),
 | 
			
		||||
				},
 | 
			
		||||
				Status: batch.JobStatus{
 | 
			
		||||
					Failed:           2,
 | 
			
		||||
@@ -1560,7 +1560,7 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
 | 
			
		||||
			job: batch.Job{
 | 
			
		||||
				Spec: batch.JobSpec{
 | 
			
		||||
					CompletionMode: &indexedCompletion,
 | 
			
		||||
					Completions:    pointer.Int32Ptr(501),
 | 
			
		||||
					Completions:    pointer.Int32(501),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			pods: func() []*v1.Pod {
 | 
			
		||||
@@ -1762,7 +1762,7 @@ func TestSyncJobPastDeadline(t *testing.T) {
 | 
			
		||||
			// job & pods setup
 | 
			
		||||
			job := newJob(tc.parallelism, tc.completions, tc.backoffLimit, batch.NonIndexedCompletion)
 | 
			
		||||
			job.Spec.ActiveDeadlineSeconds = &tc.activeDeadlineSeconds
 | 
			
		||||
			job.Spec.Suspend = pointer.BoolPtr(tc.suspend)
 | 
			
		||||
			job.Spec.Suspend = pointer.Bool(tc.suspend)
 | 
			
		||||
			start := metav1.Unix(metav1.Now().Time.Unix()-tc.startTime, 0)
 | 
			
		||||
			job.Status.StartTime = &start
 | 
			
		||||
			sharedInformerFactory.Batch().V1().Jobs().Informer().GetIndexer().Add(job)
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RecommendedDefaultNodeLifecycleControllerConfiguration defaults a pointer to a
 | 
			
		||||
@@ -45,6 +45,6 @@ func RecommendedDefaultNodeLifecycleControllerConfiguration(obj *kubectrlmgrconf
 | 
			
		||||
		obj.NodeStartupGracePeriod = metav1.Duration{Duration: 60 * time.Second}
 | 
			
		||||
	}
 | 
			
		||||
	if obj.EnableTaintManager == nil {
 | 
			
		||||
		obj.EnableTaintManager = utilpointer.BoolPtr(true)
 | 
			
		||||
		obj.EnableTaintManager = pointer.Bool(true)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ func createNodeLease(nodeName string, renewTime metav1.MicroTime) *coordv1.Lease
 | 
			
		||||
			Namespace: v1.NamespaceNodeLease,
 | 
			
		||||
		},
 | 
			
		||||
		Spec: coordv1.LeaseSpec{
 | 
			
		||||
			HolderIdentity: pointer.StringPtr(nodeName),
 | 
			
		||||
			HolderIdentity: pointer.String(nodeName),
 | 
			
		||||
			RenewTime:      &renewTime,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ import (
 | 
			
		||||
	metricsfake "k8s.io/metrics/pkg/client/clientset/versioned/fake"
 | 
			
		||||
	cmfake "k8s.io/metrics/pkg/client/custom_metrics/fake"
 | 
			
		||||
	emfake "k8s.io/metrics/pkg/client/external_metrics/fake"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
 | 
			
		||||
@@ -821,7 +821,7 @@ func TestScaleUpContainer(t *testing.T) {
 | 
			
		||||
				Name: v1.ResourceCPU,
 | 
			
		||||
				Target: autoscalingv2.MetricTarget{
 | 
			
		||||
					Type:               autoscalingv2.UtilizationMetricType,
 | 
			
		||||
					AverageUtilization: utilpointer.Int32Ptr(30),
 | 
			
		||||
					AverageUtilization: pointer.Int32(30),
 | 
			
		||||
				},
 | 
			
		||||
				Container: "container1",
 | 
			
		||||
			},
 | 
			
		||||
@@ -1355,7 +1355,7 @@ func TestScaleDownContainerResource(t *testing.T) {
 | 
			
		||||
				Name:      v1.ResourceCPU,
 | 
			
		||||
				Target: autoscalingv2.MetricTarget{
 | 
			
		||||
					Type:               autoscalingv2.UtilizationMetricType,
 | 
			
		||||
					AverageUtilization: utilpointer.Int32Ptr(50),
 | 
			
		||||
					AverageUtilization: pointer.Int32(50),
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		}},
 | 
			
		||||
@@ -3142,7 +3142,7 @@ func TestCalculateScaleUpLimitWithScalingRules(t *testing.T) {
 | 
			
		||||
	policy := autoscalingv2.MinChangePolicySelect
 | 
			
		||||
 | 
			
		||||
	calculated := calculateScaleUpLimitWithScalingRules(1, []timestampedScaleEvent{}, []timestampedScaleEvent{}, &autoscalingv2.HPAScalingRules{
 | 
			
		||||
		StabilizationWindowSeconds: utilpointer.Int32Ptr(300),
 | 
			
		||||
		StabilizationWindowSeconds: pointer.Int32(300),
 | 
			
		||||
		SelectPolicy:               &policy,
 | 
			
		||||
		Policies: []autoscalingv2.HPAScalingPolicy{
 | 
			
		||||
			{
 | 
			
		||||
@@ -3164,7 +3164,7 @@ func TestCalculateScaleDownLimitWithBehaviors(t *testing.T) {
 | 
			
		||||
	policy := autoscalingv2.MinChangePolicySelect
 | 
			
		||||
 | 
			
		||||
	calculated := calculateScaleDownLimitWithBehaviors(5, []timestampedScaleEvent{}, []timestampedScaleEvent{}, &autoscalingv2.HPAScalingRules{
 | 
			
		||||
		StabilizationWindowSeconds: utilpointer.Int32Ptr(300),
 | 
			
		||||
		StabilizationWindowSeconds: pointer.Int32(300),
 | 
			
		||||
		SelectPolicy:               &policy,
 | 
			
		||||
		Policies: []autoscalingv2.HPAScalingPolicy{
 | 
			
		||||
			{
 | 
			
		||||
@@ -3185,7 +3185,7 @@ func TestCalculateScaleDownLimitWithBehaviors(t *testing.T) {
 | 
			
		||||
func generateScalingRules(pods, podsPeriod, percent, percentPeriod, stabilizationWindow int32) *autoscalingv2.HPAScalingRules {
 | 
			
		||||
	policy := autoscalingv2.MaxChangePolicySelect
 | 
			
		||||
	directionBehavior := autoscalingv2.HPAScalingRules{
 | 
			
		||||
		StabilizationWindowSeconds: utilpointer.Int32Ptr(stabilizationWindow),
 | 
			
		||||
		StabilizationWindowSeconds: pointer.Int32(stabilizationWindow),
 | 
			
		||||
		SelectPolicy:               &policy,
 | 
			
		||||
	}
 | 
			
		||||
	if pods != 0 {
 | 
			
		||||
 
 | 
			
		||||
@@ -22,9 +22,9 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	batch "k8s.io/api/batch/v1"
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	v1 "k8s.io/api/core/v1"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func newJob(completionTime, failedTime metav1.Time, ttl *int32) *batch.Job {
 | 
			
		||||
@@ -91,7 +91,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			name:         "Error case: Job unfinished",
 | 
			
		||||
			ttl:          utilpointer.Int32Ptr(100),
 | 
			
		||||
			ttl:          pointer.Int32(100),
 | 
			
		||||
			since:        &now.Time,
 | 
			
		||||
			expectErr:    true,
 | 
			
		||||
			expectErrStr: "should not be cleaned up",
 | 
			
		||||
@@ -106,7 +106,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
		{
 | 
			
		||||
			name:             "Job completed now, 0s TTL",
 | 
			
		||||
			completionTime:   now,
 | 
			
		||||
			ttl:              utilpointer.Int32Ptr(0),
 | 
			
		||||
			ttl:              pointer.Int32(0),
 | 
			
		||||
			since:            &now.Time,
 | 
			
		||||
			expectedTimeLeft: durationPointer(0),
 | 
			
		||||
			expectedExpireAt: now.Time,
 | 
			
		||||
@@ -114,7 +114,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
		{
 | 
			
		||||
			name:             "Job completed now, 10s TTL",
 | 
			
		||||
			completionTime:   now,
 | 
			
		||||
			ttl:              utilpointer.Int32Ptr(10),
 | 
			
		||||
			ttl:              pointer.Int32(10),
 | 
			
		||||
			since:            &now.Time,
 | 
			
		||||
			expectedTimeLeft: durationPointer(10),
 | 
			
		||||
			expectedExpireAt: now.Add(10 * time.Second),
 | 
			
		||||
@@ -122,7 +122,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
		{
 | 
			
		||||
			name:             "Job completed 10s ago, 15s TTL",
 | 
			
		||||
			completionTime:   metav1.NewTime(now.Add(-10 * time.Second)),
 | 
			
		||||
			ttl:              utilpointer.Int32Ptr(15),
 | 
			
		||||
			ttl:              pointer.Int32(15),
 | 
			
		||||
			since:            &now.Time,
 | 
			
		||||
			expectedTimeLeft: durationPointer(5),
 | 
			
		||||
			expectedExpireAt: now.Add(5 * time.Second),
 | 
			
		||||
@@ -137,7 +137,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
		{
 | 
			
		||||
			name:             "Job failed now, 0s TTL",
 | 
			
		||||
			failedTime:       now,
 | 
			
		||||
			ttl:              utilpointer.Int32Ptr(0),
 | 
			
		||||
			ttl:              pointer.Int32(0),
 | 
			
		||||
			since:            &now.Time,
 | 
			
		||||
			expectedTimeLeft: durationPointer(0),
 | 
			
		||||
			expectedExpireAt: now.Time,
 | 
			
		||||
@@ -145,7 +145,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
		{
 | 
			
		||||
			name:             "Job failed now, 10s TTL",
 | 
			
		||||
			failedTime:       now,
 | 
			
		||||
			ttl:              utilpointer.Int32Ptr(10),
 | 
			
		||||
			ttl:              pointer.Int32(10),
 | 
			
		||||
			since:            &now.Time,
 | 
			
		||||
			expectedTimeLeft: durationPointer(10),
 | 
			
		||||
			expectedExpireAt: now.Add(10 * time.Second),
 | 
			
		||||
@@ -153,7 +153,7 @@ func TestTimeLeft(t *testing.T) {
 | 
			
		||||
		{
 | 
			
		||||
			name:             "Job failed 10s ago, 15s TTL",
 | 
			
		||||
			failedTime:       metav1.NewTime(now.Add(-10 * time.Second)),
 | 
			
		||||
			ttl:              utilpointer.Int32Ptr(15),
 | 
			
		||||
			ttl:              pointer.Int32(15),
 | 
			
		||||
			since:            &now.Time,
 | 
			
		||||
			expectedTimeLeft: durationPointer(5),
 | 
			
		||||
			expectedExpireAt: now.Add(5 * time.Second),
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ import (
 | 
			
		||||
	"k8s.io/apimachinery/pkg/util/sets"
 | 
			
		||||
	"k8s.io/client-go/informers"
 | 
			
		||||
	"k8s.io/client-go/kubernetes/fake"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestDetermineNeededServiceUpdates(t *testing.T) {
 | 
			
		||||
@@ -674,19 +674,19 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "No change",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: true,
 | 
			
		||||
		},
 | 
			
		||||
@@ -694,19 +694,19 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "NodeName changed",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-2"),
 | 
			
		||||
				NodeName:  pointer.String("node-2"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: false,
 | 
			
		||||
		},
 | 
			
		||||
@@ -714,19 +714,19 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Zone changed",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-2"),
 | 
			
		||||
				Zone:      pointer.String("zone-2"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: false,
 | 
			
		||||
		},
 | 
			
		||||
@@ -734,21 +734,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Ready condition changed",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: false,
 | 
			
		||||
		},
 | 
			
		||||
@@ -756,25 +756,25 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Serving condition changed from nil to true",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     nil,
 | 
			
		||||
					Terminating: nil,
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: false,
 | 
			
		||||
		},
 | 
			
		||||
@@ -782,25 +782,25 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Serving condition changed from false to true",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(false),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(false),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready:       utilpointer.BoolPtr(true),
 | 
			
		||||
					Serving:     utilpointer.BoolPtr(true),
 | 
			
		||||
					Terminating: utilpointer.BoolPtr(false),
 | 
			
		||||
					Ready:       pointer.Bool(true),
 | 
			
		||||
					Serving:     pointer.Bool(true),
 | 
			
		||||
					Terminating: pointer.Bool(false),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: false,
 | 
			
		||||
		},
 | 
			
		||||
@@ -808,21 +808,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Pod name changed",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod1"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: false,
 | 
			
		||||
		},
 | 
			
		||||
@@ -830,21 +830,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Pod resourceVersion changed",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: "1"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: "2"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: true,
 | 
			
		||||
		},
 | 
			
		||||
@@ -852,21 +852,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
 | 
			
		||||
			name: "Pod resourceVersion removed",
 | 
			
		||||
			ep1: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: "1"},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			ep2: &discovery.Endpoint{
 | 
			
		||||
				Conditions: discovery.EndpointConditions{
 | 
			
		||||
					Ready: utilpointer.BoolPtr(true),
 | 
			
		||||
					Ready: pointer.Bool(true),
 | 
			
		||||
				},
 | 
			
		||||
				Addresses: []string{"10.0.0.1"},
 | 
			
		||||
				TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: ""},
 | 
			
		||||
				Zone:      utilpointer.StringPtr("zone-1"),
 | 
			
		||||
				NodeName:  utilpointer.StringPtr("node-1"),
 | 
			
		||||
				Zone:      pointer.String("zone-1"),
 | 
			
		||||
				NodeName:  pointer.String("node-1"),
 | 
			
		||||
			},
 | 
			
		||||
			expected: true,
 | 
			
		||||
		},
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
 | 
			
		||||
	utilpointer "k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RecommendedDefaultPersistentVolumeBinderControllerConfiguration defaults a pointer to a
 | 
			
		||||
@@ -58,10 +58,10 @@ func RecommendedDefaultPersistentVolumeBinderControllerConfiguration(obj *kubect
 | 
			
		||||
// this defaulting method run it in your wrapper struct of this type in its `SetDefaults_` method.
 | 
			
		||||
func RecommendedDefaultVolumeConfiguration(obj *kubectrlmgrconfigv1alpha1.VolumeConfiguration) {
 | 
			
		||||
	if obj.EnableHostPathProvisioning == nil {
 | 
			
		||||
		obj.EnableHostPathProvisioning = utilpointer.BoolPtr(false)
 | 
			
		||||
		obj.EnableHostPathProvisioning = pointer.Bool(false)
 | 
			
		||||
	}
 | 
			
		||||
	if obj.EnableDynamicProvisioning == nil {
 | 
			
		||||
		obj.EnableDynamicProvisioning = utilpointer.BoolPtr(true)
 | 
			
		||||
		obj.EnableDynamicProvisioning = pointer.Bool(true)
 | 
			
		||||
	}
 | 
			
		||||
	if obj.FlexVolumePluginDir == "" {
 | 
			
		||||
		obj.FlexVolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user