mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	convert int32 to pointer using library function
This commit is contained in:
		@@ -52,6 +52,7 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/features"
 | 
						"k8s.io/kubernetes/pkg/features"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/securitycontext"
 | 
						"k8s.io/kubernetes/pkg/securitycontext"
 | 
				
			||||||
	testingclock "k8s.io/utils/clock/testing"
 | 
						testingclock "k8s.io/utils/clock/testing"
 | 
				
			||||||
 | 
						"k8s.io/utils/pointer"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/stretchr/testify/assert"
 | 
						"github.com/stretchr/testify/assert"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -76,7 +77,7 @@ func newReplicationController(replicas int) *v1.ReplicationController {
 | 
				
			|||||||
			ResourceVersion: "18",
 | 
								ResourceVersion: "18",
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Spec: v1.ReplicationControllerSpec{
 | 
							Spec: v1.ReplicationControllerSpec{
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Selector: map[string]string{"foo": "bar"},
 | 
								Selector: map[string]string{"foo": "bar"},
 | 
				
			||||||
			Template: &v1.PodTemplateSpec{
 | 
								Template: &v1.PodTemplateSpec{
 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
									ObjectMeta: metav1.ObjectMeta{
 | 
				
			||||||
@@ -138,7 +139,7 @@ func newReplicaSet(name string, replicas int) *apps.ReplicaSet {
 | 
				
			|||||||
			ResourceVersion: "18",
 | 
								ResourceVersion: "18",
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Spec: apps.ReplicaSetSpec{
 | 
							Spec: apps.ReplicaSetSpec{
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
 | 
								Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
 | 
				
			||||||
			Template: v1.PodTemplateSpec{
 | 
								Template: v1.PodTemplateSpec{
 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
									ObjectMeta: metav1.ObjectMeta{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,6 +47,7 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/controller"
 | 
						"k8s.io/kubernetes/pkg/controller"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/controller/deployment/util"
 | 
						"k8s.io/kubernetes/pkg/controller/deployment/util"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/controller/testutil"
 | 
						"k8s.io/kubernetes/pkg/controller/testutil"
 | 
				
			||||||
 | 
						"k8s.io/utils/pointer"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
@@ -62,7 +63,7 @@ func rs(name string, replicas int, selector map[string]string, timestamp metav1.
 | 
				
			|||||||
			Namespace:         metav1.NamespaceDefault,
 | 
								Namespace:         metav1.NamespaceDefault,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Spec: apps.ReplicaSetSpec{
 | 
							Spec: apps.ReplicaSetSpec{
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Selector: &metav1.LabelSelector{MatchLabels: selector},
 | 
								Selector: &metav1.LabelSelector{MatchLabels: selector},
 | 
				
			||||||
			Template: v1.PodTemplateSpec{},
 | 
								Template: v1.PodTemplateSpec{},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
@@ -94,7 +95,7 @@ func newDeployment(name string, replicas int, revisionHistoryLimit *int32, maxSu
 | 
				
			|||||||
					MaxSurge:       func() *intstr.IntOrString { i := intstr.FromInt(0); return &i }(),
 | 
										MaxSurge:       func() *intstr.IntOrString { i := intstr.FromInt(0); return &i }(),
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Selector: &metav1.LabelSelector{MatchLabels: selector},
 | 
								Selector: &metav1.LabelSelector{MatchLabels: selector},
 | 
				
			||||||
			Template: v1.PodTemplateSpec{
 | 
								Template: v1.PodTemplateSpec{
 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
									ObjectMeta: metav1.ObjectMeta{
 | 
				
			||||||
@@ -132,7 +133,7 @@ func newReplicaSet(d *apps.Deployment, name string, replicas int) *apps.ReplicaS
 | 
				
			|||||||
		},
 | 
							},
 | 
				
			||||||
		Spec: apps.ReplicaSetSpec{
 | 
							Spec: apps.ReplicaSetSpec{
 | 
				
			||||||
			Selector: d.Spec.Selector,
 | 
								Selector: d.Spec.Selector,
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Template: d.Spec.Template,
 | 
								Template: d.Spec.Template,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,7 @@ import (
 | 
				
			|||||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
						"k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/types"
 | 
						"k8s.io/apimachinery/pkg/types"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/strategicpatch"
 | 
						"k8s.io/apimachinery/pkg/util/strategicpatch"
 | 
				
			||||||
 | 
						"k8s.io/utils/pointer"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestRealHistory_ListControllerRevisions(t *testing.T) {
 | 
					func TestRealHistory_ListControllerRevisions(t *testing.T) {
 | 
				
			||||||
@@ -1649,7 +1650,7 @@ func newStatefulSet(replicas int, name string, uid types.UID, labels map[string]
 | 
				
			|||||||
				MatchLabels:      nil,
 | 
									MatchLabels:      nil,
 | 
				
			||||||
				MatchExpressions: testMatchExpressions,
 | 
									MatchExpressions: testMatchExpressions,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Template: v1.PodTemplateSpec{
 | 
								Template: v1.PodTemplateSpec{
 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
									ObjectMeta: metav1.ObjectMeta{
 | 
				
			||||||
					Labels: labels,
 | 
										Labels: labels,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,7 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/controller"
 | 
						"k8s.io/kubernetes/pkg/controller"
 | 
				
			||||||
	. "k8s.io/kubernetes/pkg/controller/testutil"
 | 
						. "k8s.io/kubernetes/pkg/controller/testutil"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/securitycontext"
 | 
						"k8s.io/kubernetes/pkg/securitycontext"
 | 
				
			||||||
 | 
						"k8s.io/utils/pointer"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
@@ -101,7 +102,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *apps.ReplicaSet
 | 
				
			|||||||
			ResourceVersion: "18",
 | 
								ResourceVersion: "18",
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Spec: apps.ReplicaSetSpec{
 | 
							Spec: apps.ReplicaSetSpec{
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Selector: &metav1.LabelSelector{MatchLabels: selectorMap},
 | 
								Selector: &metav1.LabelSelector{MatchLabels: selectorMap},
 | 
				
			||||||
			Template: v1.PodTemplateSpec{
 | 
								Template: v1.PodTemplateSpec{
 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
									ObjectMeta: metav1.ObjectMeta{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,7 @@ import (
 | 
				
			|||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	podutil "k8s.io/kubernetes/pkg/api/v1/pod"
 | 
						podutil "k8s.io/kubernetes/pkg/api/v1/pod"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/controller/history"
 | 
						"k8s.io/kubernetes/pkg/controller/history"
 | 
				
			||||||
 | 
						"k8s.io/utils/pointer"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// noopRecorder is an EventRecorder that does nothing. record.FakeRecorder has a fixed
 | 
					// noopRecorder is an EventRecorder that does nothing. record.FakeRecorder has a fixed
 | 
				
			||||||
@@ -838,7 +839,7 @@ func newStatefulSetWithVolumes(replicas int, name string, petMounts []v1.VolumeM
 | 
				
			|||||||
			Selector: &metav1.LabelSelector{
 | 
								Selector: &metav1.LabelSelector{
 | 
				
			||||||
				MatchLabels: map[string]string{"foo": "bar"},
 | 
									MatchLabels: map[string]string{"foo": "bar"},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Replicas:             func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas:             pointer.Int32(int32(replicas)),
 | 
				
			||||||
			Template:             template,
 | 
								Template:             template,
 | 
				
			||||||
			VolumeClaimTemplates: claims,
 | 
								VolumeClaimTemplates: claims,
 | 
				
			||||||
			ServiceName:          "governingsvc",
 | 
								ServiceName:          "governingsvc",
 | 
				
			||||||
@@ -893,7 +894,7 @@ func newStatefulSetWithLabels(replicas int, name string, uid types.UID, labels m
 | 
				
			|||||||
				MatchLabels:      nil,
 | 
									MatchLabels:      nil,
 | 
				
			||||||
				MatchExpressions: testMatchExpressions,
 | 
									MatchExpressions: testMatchExpressions,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Replicas: func() *int32 { i := int32(replicas); return &i }(),
 | 
								Replicas: pointer.Int32(int32(replicas)),
 | 
				
			||||||
			PersistentVolumeClaimRetentionPolicy: &apps.StatefulSetPersistentVolumeClaimRetentionPolicy{
 | 
								PersistentVolumeClaimRetentionPolicy: &apps.StatefulSetPersistentVolumeClaimRetentionPolicy{
 | 
				
			||||||
				WhenScaled:  apps.RetainPersistentVolumeClaimRetentionPolicyType,
 | 
									WhenScaled:  apps.RetainPersistentVolumeClaimRetentionPolicyType,
 | 
				
			||||||
				WhenDeleted: apps.RetainPersistentVolumeClaimRetentionPolicyType,
 | 
									WhenDeleted: apps.RetainPersistentVolumeClaimRetentionPolicyType,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user