Merge pull request #114902 from TommyStarK/pkg-apis/replace-deprecated-pointer-function
pkg/apis: Replace deprecated pointer function
This commit is contained in:
@@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
func TestV12StatefulSetSpecConversion(t *testing.T) {
|
||||
replicas := utilpointer.Int32Ptr(2)
|
||||
replicas := utilpointer.Int32(2)
|
||||
selector := &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}
|
||||
appsv1Template := v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
|
||||
@@ -177,7 +177,7 @@ func TestV1StatefulSetStatusConversion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestV1StatefulSetUpdateStrategyConversion(t *testing.T) {
|
||||
partition := utilpointer.Int32Ptr(2)
|
||||
partition := utilpointer.Int32(2)
|
||||
appsv1rollingUpdate := new(appsv1.RollingUpdateStatefulSetStrategy)
|
||||
appsv1rollingUpdate.Partition = partition
|
||||
appsrollingUpdate := new(apps.RollingUpdateStatefulSetStrategy)
|
||||
@@ -259,7 +259,7 @@ func TestV1RollingUpdateDaemonSetConversion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestV1DeploymentConversion(t *testing.T) {
|
||||
replica := utilpointer.Int32Ptr(2)
|
||||
replica := utilpointer.Int32(2)
|
||||
rollbackTo := new(apps.RollbackConfig)
|
||||
rollbackTo.Revision = int64(2)
|
||||
testcases := map[string]struct {
|
||||
@@ -338,9 +338,9 @@ func TestV1DeploymentConversion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestV1DeploymentSpecConversion(t *testing.T) {
|
||||
replica := utilpointer.Int32Ptr(2)
|
||||
revisionHistoryLimit := utilpointer.Int32Ptr(2)
|
||||
progressDeadlineSeconds := utilpointer.Int32Ptr(2)
|
||||
replica := utilpointer.Int32(2)
|
||||
revisionHistoryLimit := utilpointer.Int32(2)
|
||||
progressDeadlineSeconds := utilpointer.Int32(2)
|
||||
|
||||
testcases := map[string]struct {
|
||||
deploymentSpec1 *apps.DeploymentSpec
|
||||
|
@@ -86,7 +86,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -99,7 +99,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
},
|
||||
Spec: appsv1.DaemonSetSpec{
|
||||
Template: defaultTemplate,
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
RevisionHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
expected: &appsv1.DaemonSet{
|
||||
@@ -117,7 +117,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
RevisionHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -136,7 +136,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
UpdateStrategy: appsv1.DaemonSetUpdateStrategy{
|
||||
Type: appsv1.OnDeleteDaemonSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -154,7 +154,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -233,7 +233,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: &defaultPartition,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -259,7 +259,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
UpdateStrategy: appsv1.StatefulSetUpdateStrategy{
|
||||
Type: appsv1.OnDeleteStatefulSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -286,7 +286,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: &defaultPartition,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -317,7 +317,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: ¬TheDefaultPartition,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -346,7 +346,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
WhenDeleted: appsv1.RetainPersistentVolumeClaimRetentionPolicyType,
|
||||
WhenScaled: appsv1.RetainPersistentVolumeClaimRetentionPolicyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enablePVCDeletionPolicy: true,
|
||||
@@ -379,7 +379,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
WhenDeleted: appsv1.RetainPersistentVolumeClaimRetentionPolicyType,
|
||||
WhenScaled: appsv1.DeletePersistentVolumeClaimRetentionPolicyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enablePVCDeletionPolicy: true,
|
||||
@@ -412,7 +412,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
WhenDeleted: appsv1.DeletePersistentVolumeClaimRetentionPolicyType,
|
||||
WhenScaled: appsv1.RetainPersistentVolumeClaimRetentionPolicyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enablePVCDeletionPolicy: true,
|
||||
@@ -444,7 +444,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
PersistentVolumeClaimRetentionPolicy: &appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy{
|
||||
WhenScaled: appsv1.DeletePersistentVolumeClaimRetentionPolicyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enablePVCDeletionPolicy: false,
|
||||
@@ -470,7 +470,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: getPartition(0),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: false,
|
||||
@@ -503,7 +503,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(1),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: false,
|
||||
@@ -536,7 +536,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(3),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: false,
|
||||
@@ -563,7 +563,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(1),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: true,
|
||||
@@ -596,7 +596,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(3),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: true,
|
||||
@@ -643,7 +643,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
original: &appsv1.Deployment{},
|
||||
expected: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(1),
|
||||
Replicas: utilpointer.Int32(1),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1.RollingUpdateDeployment{
|
||||
@@ -651,8 +651,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -660,7 +660,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
RollingUpdate: &appsv1.RollingUpdateDeployment{
|
||||
MaxSurge: &differentIntOrString,
|
||||
@@ -670,7 +670,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1.RollingUpdateDeployment{
|
||||
@@ -678,8 +678,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -687,7 +687,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: nil,
|
||||
@@ -696,7 +696,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1.RollingUpdateDeployment{
|
||||
@@ -704,8 +704,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -713,21 +713,21 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(0),
|
||||
RevisionHistoryLimit: utilpointer.Int32(0),
|
||||
},
|
||||
},
|
||||
expected: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(0),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(0),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -735,22 +735,22 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
},
|
||||
},
|
||||
expected: &appsv1.Deployment{
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1.DeploymentStrategy{
|
||||
Type: appsv1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -807,7 +807,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
|
||||
{
|
||||
rs: appsv1.ReplicaSet{
|
||||
Spec: appsv1.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(0),
|
||||
Replicas: utilpointer.Int32(0),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -822,7 +822,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
|
||||
{
|
||||
rs: appsv1.ReplicaSet{
|
||||
Spec: appsv1.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -865,7 +865,7 @@ func TestDefaultRequestIsNotSetForReplicaSet(t *testing.T) {
|
||||
}
|
||||
rs := &appsv1.ReplicaSet{
|
||||
Spec: appsv1.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
|
@@ -54,7 +54,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
original: &appsv1beta1.Deployment{},
|
||||
expected: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(1),
|
||||
Replicas: utilpointer.Int32(1),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1beta1.RollingUpdateDeployment{
|
||||
@@ -62,8 +62,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -71,7 +71,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
RollingUpdate: &appsv1beta1.RollingUpdateDeployment{
|
||||
MaxSurge: &differentIntOrString,
|
||||
@@ -81,7 +81,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1beta1.RollingUpdateDeployment{
|
||||
@@ -89,8 +89,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -98,7 +98,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: nil,
|
||||
@@ -107,7 +107,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1beta1.RollingUpdateDeployment{
|
||||
@@ -115,8 +115,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -124,21 +124,21 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(0),
|
||||
RevisionHistoryLimit: utilpointer.Int32(0),
|
||||
},
|
||||
},
|
||||
expected: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(0),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(0),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -146,22 +146,22 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
},
|
||||
},
|
||||
expected: &appsv1beta1.Deployment{
|
||||
Spec: appsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta1.DeploymentStrategy{
|
||||
Type: appsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
|
@@ -33,7 +33,7 @@ import (
|
||||
)
|
||||
|
||||
func TestV1beta2StatefulSetSpecConversion(t *testing.T) {
|
||||
replicas := utilpointer.Int32Ptr(2)
|
||||
replicas := utilpointer.Int32(2)
|
||||
selector := &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}
|
||||
v1beta2Template := v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
|
||||
@@ -104,7 +104,7 @@ func TestV1beta2StatefulSetSpecConversion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestV1beta2StatefulSetUpdateStrategyConversion(t *testing.T) {
|
||||
partition := utilpointer.Int32Ptr(2)
|
||||
partition := utilpointer.Int32(2)
|
||||
v1beta2rollingUpdate := new(v1beta2.RollingUpdateStatefulSetStrategy)
|
||||
v1beta2rollingUpdate.Partition = partition
|
||||
appsrollingUpdate := new(apps.RollingUpdateStatefulSetStrategy)
|
||||
@@ -261,7 +261,7 @@ func TestV1beta2StatefulSetStatusConversion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestV1beta2DeploymentConversion(t *testing.T) {
|
||||
replica := utilpointer.Int32Ptr(2)
|
||||
replica := utilpointer.Int32(2)
|
||||
rollbackTo := new(apps.RollbackConfig)
|
||||
rollbackTo.Revision = int64(2)
|
||||
testcases := map[string]struct {
|
||||
@@ -391,9 +391,9 @@ func TestV1beta2ScaleStatusConversion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestV1beta2DeploymentSpecConversion(t *testing.T) {
|
||||
replica := utilpointer.Int32Ptr(2)
|
||||
revisionHistoryLimit := utilpointer.Int32Ptr(2)
|
||||
progressDeadlineSeconds := utilpointer.Int32Ptr(2)
|
||||
replica := utilpointer.Int32(2)
|
||||
revisionHistoryLimit := utilpointer.Int32(2)
|
||||
progressDeadlineSeconds := utilpointer.Int32(2)
|
||||
|
||||
testcases := map[string]struct {
|
||||
deploymentSpec1 *apps.DeploymentSpec
|
||||
|
@@ -86,7 +86,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -99,7 +99,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
},
|
||||
Spec: appsv1beta2.DaemonSetSpec{
|
||||
Template: defaultTemplate,
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
RevisionHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
expected: &appsv1beta2.DaemonSet{
|
||||
@@ -117,7 +117,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
RevisionHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -136,7 +136,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
UpdateStrategy: appsv1beta2.DaemonSetUpdateStrategy{
|
||||
Type: appsv1beta2.OnDeleteDaemonSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -154,7 +154,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -232,7 +232,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: &defaultPartition,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -258,7 +258,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
UpdateStrategy: appsv1beta2.StatefulSetUpdateStrategy{
|
||||
Type: appsv1beta2.OnDeleteStatefulSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -285,7 +285,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: &defaultPartition,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -310,7 +310,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
Partition: getPartition(0),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: false,
|
||||
@@ -343,7 +343,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(1),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: false,
|
||||
@@ -376,7 +376,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(3),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: false,
|
||||
@@ -403,7 +403,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(1),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: true,
|
||||
@@ -436,7 +436,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
|
||||
MaxUnavailable: getMaxUnavailable(3),
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
enableMaxUnavailablePolicy: true,
|
||||
@@ -481,7 +481,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
original: &appsv1beta2.Deployment{},
|
||||
expected: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(1),
|
||||
Replicas: utilpointer.Int32(1),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1beta2.RollingUpdateDeployment{
|
||||
@@ -489,8 +489,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -498,7 +498,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
RollingUpdate: &appsv1beta2.RollingUpdateDeployment{
|
||||
MaxSurge: &differentIntOrString,
|
||||
@@ -508,7 +508,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1beta2.RollingUpdateDeployment{
|
||||
@@ -516,8 +516,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -525,7 +525,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: nil,
|
||||
@@ -534,7 +534,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &appsv1beta2.RollingUpdateDeployment{
|
||||
@@ -542,8 +542,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -551,21 +551,21 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RecreateDeploymentStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(0),
|
||||
RevisionHistoryLimit: utilpointer.Int32(0),
|
||||
},
|
||||
},
|
||||
expected: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RecreateDeploymentStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(0),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(600),
|
||||
RevisionHistoryLimit: utilpointer.Int32(0),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(600),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -573,22 +573,22 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
{
|
||||
original: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
},
|
||||
},
|
||||
expected: &appsv1beta2.Deployment{
|
||||
Spec: appsv1beta2.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: appsv1beta2.DeploymentStrategy{
|
||||
Type: appsv1beta2.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(2),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(2),
|
||||
Template: defaultTemplate,
|
||||
},
|
||||
},
|
||||
@@ -645,7 +645,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
|
||||
{
|
||||
rs: appsv1beta2.ReplicaSet{
|
||||
Spec: appsv1beta2.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(0),
|
||||
Replicas: utilpointer.Int32(0),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -660,7 +660,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
|
||||
{
|
||||
rs: appsv1beta2.ReplicaSet{
|
||||
Spec: appsv1beta2.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -703,7 +703,7 @@ func TestDefaultRequestIsNotSetForReplicaSet(t *testing.T) {
|
||||
}
|
||||
rs := &appsv1beta2.ReplicaSet{
|
||||
Spec: appsv1beta2.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
|
Reference in New Issue
Block a user