mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #114902 from TommyStarK/pkg-apis/replace-deprecated-pointer-function
pkg/apis: Replace deprecated pointer function
This commit is contained in:
commit
48e4052fc0
@ -90,6 +90,6 @@ func SetDefaults_Rule(obj *admissionregistrationv1.Rule) {
|
||||
// SetDefaults_ServiceReference sets defaults for Webhook's ServiceReference
|
||||
func SetDefaults_ServiceReference(obj *admissionregistrationv1.ServiceReference) {
|
||||
if obj.Port == nil {
|
||||
obj.Port = utilpointer.Int32Ptr(443)
|
||||
obj.Port = utilpointer.Int32(443)
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func TestDefaultAdmissionWebhook(t *testing.T) {
|
||||
Webhooks: []v1.MutatingWebhook{{
|
||||
ClientConfig: v1.WebhookClientConfig{
|
||||
Service: &v1.ServiceReference{
|
||||
Port: utilpointer.Int32Ptr(443), // defaulted
|
||||
Port: utilpointer.Int32(443), // defaulted
|
||||
},
|
||||
},
|
||||
FailurePolicy: &fail,
|
||||
|
@ -100,6 +100,6 @@ func SetDefaults_MutatingWebhook(obj *admissionregistrationv1beta1.MutatingWebho
|
||||
// SetDefaults_ServiceReference sets defaults for Webhook's ServiceReference
|
||||
func SetDefaults_ServiceReference(obj *admissionregistrationv1beta1.ServiceReference) {
|
||||
if obj.Port == nil {
|
||||
obj.Port = utilpointer.Int32Ptr(443)
|
||||
obj.Port = utilpointer.Int32(443)
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ func TestDefaultAdmissionWebhook(t *testing.T) {
|
||||
Webhooks: []v1beta1.MutatingWebhook{{
|
||||
ClientConfig: v1beta1.WebhookClientConfig{
|
||||
Service: &v1beta1.ServiceReference{
|
||||
Port: utilpointer.Int32Ptr(443), // defaulted
|
||||
Port: utilpointer.Int32(443), // defaulted
|
||||
},
|
||||
},
|
||||
FailurePolicy: &ignore,
|
||||
|
@ -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{
|
||||
|
@ -46,7 +46,7 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
"TestConversionWithCPUAverageValueAndUtilizationBoth1",
|
||||
args{
|
||||
in: &autoscaling.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -65,7 +65,7 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -73,9 +73,9 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
},
|
||||
out: &autoscalingv1.HorizontalPodAutoscalerSpec{},
|
||||
expectOut: &autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32Ptr(70),
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32(70),
|
||||
},
|
||||
s: nil,
|
||||
},
|
||||
@ -85,7 +85,7 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
"TestConversionWithCPUAverageValueAndUtilizationBoth2",
|
||||
args{
|
||||
in: &autoscaling.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -104,21 +104,21 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
out: &autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(2),
|
||||
MinReplicas: utilpointer.Int32(2),
|
||||
MaxReplicas: 4,
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32Ptr(60),
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32(60),
|
||||
},
|
||||
expectOut: &autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32Ptr(70),
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32(70),
|
||||
},
|
||||
s: nil,
|
||||
},
|
||||
@ -128,19 +128,19 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
"TestConversionWithoutMetrics",
|
||||
args{
|
||||
in: &autoscaling.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
Metrics: []autoscaling.MetricSpec{},
|
||||
},
|
||||
out: &autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 4,
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32Ptr(60),
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32(60),
|
||||
},
|
||||
expectOut: &autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32Ptr(60),
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32(60),
|
||||
},
|
||||
s: nil,
|
||||
},
|
||||
@ -150,7 +150,7 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
"TestConversionWithCPUUtilizationOnly",
|
||||
args{
|
||||
in: &autoscaling.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -159,7 +159,7 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(60),
|
||||
AverageUtilization: utilpointer.Int32(60),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -167,9 +167,9 @@ func TestConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAuto
|
||||
},
|
||||
out: &autoscalingv1.HorizontalPodAutoscalerSpec{},
|
||||
expectOut: &autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 3,
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32Ptr(60),
|
||||
TargetCPUUtilizationPercentage: utilpointer.Int32(60),
|
||||
},
|
||||
s: nil,
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ func TestSetDefaultHPA(t *testing.T) {
|
||||
{
|
||||
hpa: autoscalingv1.HorizontalPodAutoscaler{
|
||||
Spec: autoscalingv1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(3),
|
||||
MinReplicas: utilpointer.Int32(3),
|
||||
},
|
||||
},
|
||||
expectReplicas: 3,
|
||||
|
@ -65,13 +65,13 @@ func TestGenerateScaleDownRules(t *testing.T) {
|
||||
rateDownPodsPeriodSeconds: 2,
|
||||
rateDownPercent: 3,
|
||||
rateDownPercentPeriodSeconds: 4,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
selectPolicy: &maxPolicy,
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 1, PeriodSeconds: 2},
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 3, PeriodSeconds: 4},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxChangePolicySelect),
|
||||
},
|
||||
{
|
||||
@ -147,7 +147,7 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 4, PeriodSeconds: 15},
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 100, PeriodSeconds: 15},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(0),
|
||||
expectedStabilization: utilpointer.Int32(0),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxChangePolicySelect),
|
||||
},
|
||||
{
|
||||
@ -156,13 +156,13 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
rateUpPodsPeriodSeconds: 2,
|
||||
rateUpPercent: 3,
|
||||
rateUpPercentPeriodSeconds: 4,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
selectPolicy: &maxPolicy,
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 1, PeriodSeconds: 2},
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 3, PeriodSeconds: 4},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxChangePolicySelect),
|
||||
},
|
||||
{
|
||||
@ -173,7 +173,7 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 1, PeriodSeconds: 2},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(0),
|
||||
expectedStabilization: utilpointer.Int32(0),
|
||||
expectedSelectPolicy: string(autoscalingv2.MinChangePolicySelect),
|
||||
},
|
||||
{
|
||||
@ -183,29 +183,29 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 7, PeriodSeconds: 10},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(0),
|
||||
expectedStabilization: utilpointer.Int32(0),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxChangePolicySelect),
|
||||
},
|
||||
{
|
||||
annotation: "Pod policy and stabilization window are specified",
|
||||
rateUpPodsPeriodSeconds: 2,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
rateUpPods: 4,
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 4, PeriodSeconds: 2},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxChangePolicySelect),
|
||||
},
|
||||
{
|
||||
annotation: "Percent policy and stabilization window are specified",
|
||||
rateUpPercent: 7,
|
||||
rateUpPercentPeriodSeconds: 60,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 7, PeriodSeconds: 60},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxChangePolicySelect),
|
||||
},
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
|
||||
func TestSetDefaultHPA(t *testing.T) {
|
||||
utilizationDefaultVal := int32(autoscaling.DefaultCPUUtilization)
|
||||
defaultReplicas := utilpointer.Int32Ptr(1)
|
||||
defaultReplicas := utilpointer.Int32(1)
|
||||
defaultTemplate := []autoscalingv2beta1.MetricSpec{
|
||||
{
|
||||
Type: autoscalingv2beta1.ResourceMetricSourceType,
|
||||
@ -68,13 +68,13 @@ func TestSetDefaultHPA(t *testing.T) {
|
||||
{ // MinReplicas update
|
||||
original: &autoscalingv2beta1.HorizontalPodAutoscaler{
|
||||
Spec: autoscalingv2beta1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(3),
|
||||
MinReplicas: utilpointer.Int32(3),
|
||||
Metrics: defaultTemplate,
|
||||
},
|
||||
},
|
||||
expected: &autoscalingv2beta1.HorizontalPodAutoscaler{
|
||||
Spec: autoscalingv2beta1.HorizontalPodAutoscalerSpec{
|
||||
MinReplicas: utilpointer.Int32Ptr(3),
|
||||
MinReplicas: utilpointer.Int32(3),
|
||||
Metrics: defaultTemplate,
|
||||
},
|
||||
},
|
||||
|
@ -65,13 +65,13 @@ func TestGenerateScaleDownRules(t *testing.T) {
|
||||
rateDownPodsPeriodSeconds: 2,
|
||||
rateDownPercent: 3,
|
||||
rateDownPercentPeriodSeconds: 4,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
selectPolicy: &maxPolicy,
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 1, PeriodSeconds: 2},
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 3, PeriodSeconds: 4},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxPolicySelect),
|
||||
},
|
||||
{
|
||||
@ -147,7 +147,7 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 4, PeriodSeconds: 15},
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 100, PeriodSeconds: 15},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(0),
|
||||
expectedStabilization: utilpointer.Int32(0),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxPolicySelect),
|
||||
},
|
||||
{
|
||||
@ -156,13 +156,13 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
rateUpPodsPeriodSeconds: 2,
|
||||
rateUpPercent: 3,
|
||||
rateUpPercentPeriodSeconds: 4,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
selectPolicy: &maxPolicy,
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 1, PeriodSeconds: 2},
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 3, PeriodSeconds: 4},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxPolicySelect),
|
||||
},
|
||||
{
|
||||
@ -173,7 +173,7 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 1, PeriodSeconds: 2},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(0),
|
||||
expectedStabilization: utilpointer.Int32(0),
|
||||
expectedSelectPolicy: string(autoscalingv2.MinPolicySelect),
|
||||
},
|
||||
{
|
||||
@ -183,29 +183,29 @@ func TestGenerateScaleUpRules(t *testing.T) {
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 7, PeriodSeconds: 10},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(0),
|
||||
expectedStabilization: utilpointer.Int32(0),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxPolicySelect),
|
||||
},
|
||||
{
|
||||
annotation: "Pod policy and stabilization window are specified",
|
||||
rateUpPodsPeriodSeconds: 2,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
rateUpPods: 4,
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PodsScalingPolicy, Value: 4, PeriodSeconds: 2},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxPolicySelect),
|
||||
},
|
||||
{
|
||||
annotation: "Percent policy and stabilization window are specified",
|
||||
rateUpPercent: 7,
|
||||
rateUpPercentPeriodSeconds: 60,
|
||||
stabilizationSeconds: utilpointer.Int32Ptr(25),
|
||||
stabilizationSeconds: utilpointer.Int32(25),
|
||||
expectedPolicies: []autoscalingv2.HPAScalingPolicy{
|
||||
{Type: autoscalingv2.PercentScalingPolicy, Value: 7, PeriodSeconds: 60},
|
||||
},
|
||||
expectedStabilization: utilpointer.Int32Ptr(25),
|
||||
expectedStabilization: utilpointer.Int32(25),
|
||||
expectedSelectPolicy: string(autoscalingv2.MaxPolicySelect),
|
||||
},
|
||||
}
|
||||
|
@ -118,19 +118,19 @@ func TestValidateBehavior(t *testing.T) {
|
||||
},
|
||||
{
|
||||
ScaleUp: &autoscaling.HPAScalingRules{
|
||||
StabilizationWindowSeconds: utilpointer.Int32Ptr(3600),
|
||||
StabilizationWindowSeconds: utilpointer.Int32(3600),
|
||||
SelectPolicy: &minPolicy,
|
||||
Policies: simplePoliciesList,
|
||||
},
|
||||
ScaleDown: &autoscaling.HPAScalingRules{
|
||||
StabilizationWindowSeconds: utilpointer.Int32Ptr(0),
|
||||
StabilizationWindowSeconds: utilpointer.Int32(0),
|
||||
SelectPolicy: &disabledPolicy,
|
||||
Policies: simplePoliciesList,
|
||||
},
|
||||
},
|
||||
{
|
||||
ScaleUp: &autoscaling.HPAScalingRules{
|
||||
StabilizationWindowSeconds: utilpointer.Int32Ptr(120),
|
||||
StabilizationWindowSeconds: utilpointer.Int32(120),
|
||||
SelectPolicy: &maxPolicy,
|
||||
Policies: []autoscaling.HPAScalingPolicy{
|
||||
{
|
||||
@ -156,7 +156,7 @@ func TestValidateBehavior(t *testing.T) {
|
||||
},
|
||||
},
|
||||
ScaleDown: &autoscaling.HPAScalingRules{
|
||||
StabilizationWindowSeconds: utilpointer.Int32Ptr(120),
|
||||
StabilizationWindowSeconds: utilpointer.Int32(120),
|
||||
SelectPolicy: &maxPolicy,
|
||||
Policies: []autoscaling.HPAScalingPolicy{
|
||||
{
|
||||
@ -204,7 +204,7 @@ func TestValidateBehavior(t *testing.T) {
|
||||
{
|
||||
behavior: autoscaling.HorizontalPodAutoscalerBehavior{
|
||||
ScaleUp: &autoscaling.HPAScalingRules{
|
||||
StabilizationWindowSeconds: utilpointer.Int32Ptr(3601),
|
||||
StabilizationWindowSeconds: utilpointer.Int32(3601),
|
||||
SelectPolicy: &minPolicy,
|
||||
Policies: simplePoliciesList,
|
||||
},
|
||||
@ -319,7 +319,7 @@ func TestValidateBehavior(t *testing.T) {
|
||||
{
|
||||
behavior: autoscaling.HorizontalPodAutoscalerBehavior{
|
||||
ScaleDown: &autoscaling.HPAScalingRules{
|
||||
StabilizationWindowSeconds: utilpointer.Int32Ptr(3601),
|
||||
StabilizationWindowSeconds: utilpointer.Int32(3601),
|
||||
SelectPolicy: &minPolicy,
|
||||
Policies: simplePoliciesList,
|
||||
},
|
||||
@ -445,7 +445,7 @@ func prepareHPAWithBehavior(b autoscaling.HorizontalPodAutoscalerBehavior) autos
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -454,7 +454,7 @@ func prepareHPAWithBehavior(b autoscaling.HorizontalPodAutoscalerBehavior) autos
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -481,7 +481,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -490,7 +490,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -507,7 +507,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
},
|
||||
},
|
||||
@ -521,7 +521,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -547,7 +547,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -575,7 +575,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -585,7 +585,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-container",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -602,7 +602,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -629,7 +629,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -661,7 +661,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -690,7 +690,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -725,7 +725,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -734,7 +734,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -748,7 +748,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -758,7 +758,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -772,7 +772,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Kind: "..", Name: "myrc"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -781,7 +781,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -795,7 +795,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Kind: "..", Name: "myrc"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -805,7 +805,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -819,7 +819,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -828,7 +828,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -842,7 +842,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -852,7 +852,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -866,7 +866,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Kind: "ReplicationController", Name: ".."},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -875,7 +875,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -889,7 +889,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Kind: "ReplicationController", Name: ".."},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -899,7 +899,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -916,7 +916,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{},
|
||||
MinReplicas: utilpointer.Int32Ptr(-1),
|
||||
MinReplicas: utilpointer.Int32(-1),
|
||||
MaxReplicas: 5,
|
||||
},
|
||||
},
|
||||
@ -930,7 +930,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{},
|
||||
MinReplicas: utilpointer.Int32Ptr(7),
|
||||
MinReplicas: utilpointer.Int32(7),
|
||||
MaxReplicas: 5,
|
||||
},
|
||||
},
|
||||
@ -944,7 +944,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -953,7 +953,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI),
|
||||
},
|
||||
},
|
||||
@ -971,7 +971,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -981,7 +981,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI),
|
||||
},
|
||||
},
|
||||
@ -996,7 +996,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1004,7 +1004,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Resource: &autoscaling.ResourceMetricSource{
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1018,7 +1018,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1027,7 +1027,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1041,7 +1041,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1051,7 +1051,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(70),
|
||||
AverageUtilization: utilpointer.Int32(70),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1065,7 +1065,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1074,7 +1074,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(-10),
|
||||
AverageUtilization: utilpointer.Int32(-10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1088,7 +1088,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1098,7 +1098,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "test-application",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(-10),
|
||||
AverageUtilization: utilpointer.Int32(-10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1112,7 +1112,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1121,7 +1121,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Name: api.ResourceCPU,
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(-10),
|
||||
AverageUtilization: utilpointer.Int32(-10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1135,7 +1135,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1145,7 +1145,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
Container: "---***",
|
||||
Target: autoscaling.MetricTarget{
|
||||
Type: autoscaling.UtilizationMetricType,
|
||||
AverageUtilization: utilpointer.Int32Ptr(-10),
|
||||
AverageUtilization: utilpointer.Int32(-10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1159,7 +1159,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1181,7 +1181,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1204,7 +1204,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1227,7 +1227,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1251,7 +1251,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1279,7 +1279,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1307,7 +1307,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1333,7 +1333,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1358,7 +1358,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1385,7 +1385,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1410,7 +1410,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1436,7 +1436,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1462,7 +1462,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1489,7 +1489,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1515,7 +1515,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1540,7 +1540,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1562,7 +1562,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{},
|
||||
@ -1576,7 +1576,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1592,7 +1592,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1690,7 +1690,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault},
|
||||
Spec: autoscaling.HorizontalPodAutoscalerSpec{
|
||||
ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"},
|
||||
MinReplicas: utilpointer.Int32Ptr(1),
|
||||
MinReplicas: utilpointer.Int32(1),
|
||||
MaxReplicas: 5, Metrics: []autoscaling.MetricSpec{spec},
|
||||
},
|
||||
})
|
||||
@ -1723,7 +1723,7 @@ func prepareMinReplicasCases(t *testing.T, minReplicas int32) []autoscaling.Hori
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(minReplicas),
|
||||
MinReplicas: utilpointer.Int32(minReplicas),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1756,7 +1756,7 @@ func prepareMinReplicasCases(t *testing.T, minReplicas int32) []autoscaling.Hori
|
||||
Kind: "ReplicationController",
|
||||
Name: "myrc",
|
||||
},
|
||||
MinReplicas: utilpointer.Int32Ptr(minReplicas),
|
||||
MinReplicas: utilpointer.Int32(minReplicas),
|
||||
MaxReplicas: 5,
|
||||
Metrics: []autoscaling.MetricSpec{
|
||||
{
|
||||
@ -1810,7 +1810,7 @@ func TestValidateHorizontalPodAutoscalerScaleToZeroDisabled(t *testing.T) {
|
||||
nonZeroMinReplicasCases := prepareMinReplicasCases(t, 1)
|
||||
|
||||
for _, successCase := range nonZeroMinReplicasCases {
|
||||
successCase.Spec.MinReplicas = utilpointer.Int32Ptr(1)
|
||||
successCase.Spec.MinReplicas = utilpointer.Int32(1)
|
||||
if errs := ValidateHorizontalPodAutoscaler(&successCase); len(errs) != 0 {
|
||||
t.Errorf("expected success: %v", errs)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
j.Parallelism = ¶llelism
|
||||
j.BackoffLimit = &backoffLimit
|
||||
if c.Rand.Int31()%2 == 0 {
|
||||
j.ManualSelector = pointer.BoolPtr(true)
|
||||
j.ManualSelector = pointer.Bool(true)
|
||||
} else {
|
||||
j.ManualSelector = nil
|
||||
}
|
||||
@ -55,7 +55,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
j.CompletionMode = &mode
|
||||
// We're fuzzing the internal JobSpec type, not the v1 type, so we don't
|
||||
// need to fuzz the nil value.
|
||||
j.Suspend = pointer.BoolPtr(c.RandBool())
|
||||
j.Suspend = pointer.Bool(c.RandBool())
|
||||
},
|
||||
func(sj *batch.CronJobSpec, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(sj)
|
||||
|
@ -31,14 +31,14 @@ func SetDefaults_Job(obj *batchv1.Job) {
|
||||
// For a non-parallel job, you can leave both `.spec.completions` and
|
||||
// `.spec.parallelism` unset. When both are unset, both are defaulted to 1.
|
||||
if obj.Spec.Completions == nil && obj.Spec.Parallelism == nil {
|
||||
obj.Spec.Completions = utilpointer.Int32Ptr(1)
|
||||
obj.Spec.Parallelism = utilpointer.Int32Ptr(1)
|
||||
obj.Spec.Completions = utilpointer.Int32(1)
|
||||
obj.Spec.Parallelism = utilpointer.Int32(1)
|
||||
}
|
||||
if obj.Spec.Parallelism == nil {
|
||||
obj.Spec.Parallelism = utilpointer.Int32Ptr(1)
|
||||
obj.Spec.Parallelism = utilpointer.Int32(1)
|
||||
}
|
||||
if obj.Spec.BackoffLimit == nil {
|
||||
obj.Spec.BackoffLimit = utilpointer.Int32Ptr(6)
|
||||
obj.Spec.BackoffLimit = utilpointer.Int32(6)
|
||||
}
|
||||
labels := obj.Spec.Template.Labels
|
||||
if labels != nil && len(obj.Labels) == 0 {
|
||||
@ -49,7 +49,7 @@ func SetDefaults_Job(obj *batchv1.Job) {
|
||||
obj.Spec.CompletionMode = &mode
|
||||
}
|
||||
if obj.Spec.Suspend == nil {
|
||||
obj.Spec.Suspend = utilpointer.BoolPtr(false)
|
||||
obj.Spec.Suspend = utilpointer.Bool(false)
|
||||
}
|
||||
if obj.Spec.PodFailurePolicy != nil {
|
||||
for _, rule := range obj.Spec.PodFailurePolicy.Rules {
|
||||
@ -69,12 +69,12 @@ func SetDefaults_CronJob(obj *batchv1.CronJob) {
|
||||
obj.Spec.ConcurrencyPolicy = batchv1.AllowConcurrent
|
||||
}
|
||||
if obj.Spec.Suspend == nil {
|
||||
obj.Spec.Suspend = utilpointer.BoolPtr(false)
|
||||
obj.Spec.Suspend = utilpointer.Bool(false)
|
||||
}
|
||||
if obj.Spec.SuccessfulJobsHistoryLimit == nil {
|
||||
obj.Spec.SuccessfulJobsHistoryLimit = utilpointer.Int32Ptr(3)
|
||||
obj.Spec.SuccessfulJobsHistoryLimit = utilpointer.Int32(3)
|
||||
}
|
||||
if obj.Spec.FailedJobsHistoryLimit == nil {
|
||||
obj.Spec.FailedJobsHistoryLimit = utilpointer.Int32Ptr(1)
|
||||
obj.Spec.FailedJobsHistoryLimit = utilpointer.Int32(1)
|
||||
}
|
||||
}
|
||||
|
@ -85,11 +85,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Completions: pointer.Int32(1),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
PodFailurePolicy: &batchv1.PodFailurePolicy{
|
||||
Rules: []batchv1.PodFailurePolicyRule{
|
||||
{
|
||||
@ -141,11 +141,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Completions: pointer.Int32(1),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -160,11 +160,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Completions: pointer.Int32(1),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -172,7 +172,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
"suspend set, everything else is defaulted": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
Suspend: pointer.Bool(true),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -180,11 +180,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Completions: pointer.Int32(1),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
Suspend: pointer.Bool(true),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -202,18 +202,18 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Completions: pointer.Int32(1),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
"WQ: Parallelism explicitly 0 and completions unset -> BackoffLimit is defaulted": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Parallelism: pointer.Int32Ptr(0),
|
||||
Parallelism: pointer.Int32(0),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -221,10 +221,10 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Parallelism: pointer.Int32Ptr(0),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Parallelism: pointer.Int32(0),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -232,7 +232,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
"WQ: Parallelism explicitly 2 and completions unset -> BackoffLimit is defaulted": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Parallelism: pointer.Int32Ptr(2),
|
||||
Parallelism: pointer.Int32(2),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -240,10 +240,10 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Parallelism: pointer.Int32Ptr(2),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Parallelism: pointer.Int32(2),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -251,7 +251,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
"Completions explicitly 2 and others unset -> parallelism and BackoffLimit are defaulted": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(2),
|
||||
Completions: pointer.Int32(2),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -259,11 +259,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(2),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(6),
|
||||
Completions: pointer.Int32(2),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(6),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -271,7 +271,7 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
"BackoffLimit explicitly 5 and others unset -> parallelism and completions are defaulted": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
BackoffLimit: pointer.Int32Ptr(5),
|
||||
BackoffLimit: pointer.Int32(5),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -279,11 +279,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32Ptr(1),
|
||||
BackoffLimit: pointer.Int32Ptr(5),
|
||||
Completions: pointer.Int32(1),
|
||||
Parallelism: pointer.Int32(1),
|
||||
BackoffLimit: pointer.Int32(5),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -291,11 +291,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
"All set -> no change": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(8),
|
||||
Parallelism: pointer.Int32Ptr(9),
|
||||
BackoffLimit: pointer.Int32Ptr(10),
|
||||
Completions: pointer.Int32(8),
|
||||
Parallelism: pointer.Int32(9),
|
||||
BackoffLimit: pointer.Int32(10),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -303,11 +303,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(8),
|
||||
Parallelism: pointer.Int32Ptr(9),
|
||||
BackoffLimit: pointer.Int32Ptr(10),
|
||||
Completions: pointer.Int32(8),
|
||||
Parallelism: pointer.Int32(9),
|
||||
BackoffLimit: pointer.Int32(10),
|
||||
CompletionMode: completionModePtr(batchv1.NonIndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
Suspend: pointer.Bool(false),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -318,11 +318,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
"All set, flipped -> no change": {
|
||||
original: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(11),
|
||||
Parallelism: pointer.Int32Ptr(10),
|
||||
BackoffLimit: pointer.Int32Ptr(9),
|
||||
Completions: pointer.Int32(11),
|
||||
Parallelism: pointer.Int32(10),
|
||||
BackoffLimit: pointer.Int32(9),
|
||||
CompletionMode: completionModePtr(batchv1.IndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
Suspend: pointer.Bool(true),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: defaultLabels},
|
||||
},
|
||||
@ -330,11 +330,11 @@ func TestSetDefaultJob(t *testing.T) {
|
||||
},
|
||||
expected: &batchv1.Job{
|
||||
Spec: batchv1.JobSpec{
|
||||
Completions: pointer.Int32Ptr(11),
|
||||
Parallelism: pointer.Int32Ptr(10),
|
||||
BackoffLimit: pointer.Int32Ptr(9),
|
||||
Completions: pointer.Int32(11),
|
||||
Parallelism: pointer.Int32(10),
|
||||
BackoffLimit: pointer.Int32(9),
|
||||
CompletionMode: completionModePtr(batchv1.IndexedCompletion),
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
Suspend: pointer.Bool(true),
|
||||
},
|
||||
},
|
||||
expectLabels: true,
|
||||
@ -416,9 +416,9 @@ func TestSetDefaultCronJob(t *testing.T) {
|
||||
expected: &batchv1.CronJob{
|
||||
Spec: batchv1.CronJobSpec{
|
||||
ConcurrencyPolicy: batchv1.AllowConcurrent,
|
||||
Suspend: pointer.BoolPtr(false),
|
||||
SuccessfulJobsHistoryLimit: pointer.Int32Ptr(3),
|
||||
FailedJobsHistoryLimit: pointer.Int32Ptr(1),
|
||||
Suspend: pointer.Bool(false),
|
||||
SuccessfulJobsHistoryLimit: pointer.Int32(3),
|
||||
FailedJobsHistoryLimit: pointer.Int32(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -426,17 +426,17 @@ func TestSetDefaultCronJob(t *testing.T) {
|
||||
original: &batchv1.CronJob{
|
||||
Spec: batchv1.CronJobSpec{
|
||||
ConcurrencyPolicy: batchv1.ForbidConcurrent,
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
SuccessfulJobsHistoryLimit: pointer.Int32Ptr(5),
|
||||
FailedJobsHistoryLimit: pointer.Int32Ptr(5),
|
||||
Suspend: pointer.Bool(true),
|
||||
SuccessfulJobsHistoryLimit: pointer.Int32(5),
|
||||
FailedJobsHistoryLimit: pointer.Int32(5),
|
||||
},
|
||||
},
|
||||
expected: &batchv1.CronJob{
|
||||
Spec: batchv1.CronJobSpec{
|
||||
ConcurrencyPolicy: batchv1.ForbidConcurrent,
|
||||
Suspend: pointer.BoolPtr(true),
|
||||
SuccessfulJobsHistoryLimit: pointer.Int32Ptr(5),
|
||||
FailedJobsHistoryLimit: pointer.Int32Ptr(5),
|
||||
Suspend: pointer.Bool(true),
|
||||
SuccessfulJobsHistoryLimit: pointer.Int32(5),
|
||||
FailedJobsHistoryLimit: pointer.Int32(5),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -41,8 +41,8 @@ func TestSetDefaultCronJob(t *testing.T) {
|
||||
Spec: batchv1beta1.CronJobSpec{
|
||||
ConcurrencyPolicy: batchv1beta1.AllowConcurrent,
|
||||
Suspend: newBool(false),
|
||||
SuccessfulJobsHistoryLimit: utilpointer.Int32Ptr(3),
|
||||
FailedJobsHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
SuccessfulJobsHistoryLimit: utilpointer.Int32(3),
|
||||
FailedJobsHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -51,16 +51,16 @@ func TestSetDefaultCronJob(t *testing.T) {
|
||||
Spec: batchv1beta1.CronJobSpec{
|
||||
ConcurrencyPolicy: batchv1beta1.ForbidConcurrent,
|
||||
Suspend: newBool(true),
|
||||
SuccessfulJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||
FailedJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||
SuccessfulJobsHistoryLimit: utilpointer.Int32(5),
|
||||
FailedJobsHistoryLimit: utilpointer.Int32(5),
|
||||
},
|
||||
},
|
||||
expected: &batchv1beta1.CronJob{
|
||||
Spec: batchv1beta1.CronJobSpec{
|
||||
ConcurrencyPolicy: batchv1beta1.ForbidConcurrent,
|
||||
Suspend: newBool(true),
|
||||
SuccessfulJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||
FailedJobsHistoryLimit: utilpointer.Int32Ptr(5),
|
||||
SuccessfulJobsHistoryLimit: utilpointer.Int32(5),
|
||||
FailedJobsHistoryLimit: utilpointer.Int32(5),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -168,7 +168,7 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
Spec: batch.JobSpec{
|
||||
Selector: validManualSelector,
|
||||
ManualSelector: pointer.BoolPtr(true),
|
||||
ManualSelector: pointer.Bool(true),
|
||||
Template: validPodTemplateSpecForManual,
|
||||
},
|
||||
},
|
||||
@ -211,8 +211,8 @@ func TestValidateJob(t *testing.T) {
|
||||
Selector: validGeneratedSelector,
|
||||
Template: validPodTemplateSpecForGenerated,
|
||||
CompletionMode: completionModePtr(batch.IndexedCompletion),
|
||||
Completions: pointer.Int32Ptr(2),
|
||||
Parallelism: pointer.Int32Ptr(100000),
|
||||
Completions: pointer.Int32(2),
|
||||
Parallelism: pointer.Int32(100000),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -709,7 +709,7 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
Spec: batch.JobSpec{
|
||||
Selector: validManualSelector,
|
||||
ManualSelector: pointer.BoolPtr(true),
|
||||
ManualSelector: pointer.Bool(true),
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{"y": "z"},
|
||||
@ -730,7 +730,7 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
Spec: batch.JobSpec{
|
||||
Selector: validManualSelector,
|
||||
ManualSelector: pointer.BoolPtr(true),
|
||||
ManualSelector: pointer.Bool(true),
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{"controller-uid": "4d5e6f"},
|
||||
@ -751,7 +751,7 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
Spec: batch.JobSpec{
|
||||
Selector: validManualSelector,
|
||||
ManualSelector: pointer.BoolPtr(true),
|
||||
ManualSelector: pointer.Bool(true),
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: validManualSelector.MatchLabels,
|
||||
@ -772,7 +772,7 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
Spec: batch.JobSpec{
|
||||
Selector: validManualSelector,
|
||||
ManualSelector: pointer.BoolPtr(true),
|
||||
ManualSelector: pointer.Bool(true),
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: validManualSelector.MatchLabels,
|
||||
@ -819,8 +819,8 @@ func TestValidateJob(t *testing.T) {
|
||||
Selector: validGeneratedSelector,
|
||||
Template: validPodTemplateSpecForGenerated,
|
||||
CompletionMode: completionModePtr(batch.IndexedCompletion),
|
||||
Completions: pointer.Int32Ptr(2),
|
||||
Parallelism: pointer.Int32Ptr(100001),
|
||||
Completions: pointer.Int32(2),
|
||||
Parallelism: pointer.Int32(100001),
|
||||
},
|
||||
},
|
||||
"metadata.annotations[batch.kubernetes.io/job-tracking]: cannot add this annotation": {
|
||||
@ -920,16 +920,16 @@ func TestValidateJobUpdate(t *testing.T) {
|
||||
Spec: batch.JobSpec{
|
||||
Selector: validGeneratedSelector,
|
||||
Template: validPodTemplateSpecForGenerated,
|
||||
Parallelism: pointer.Int32Ptr(5),
|
||||
ActiveDeadlineSeconds: pointer.Int64Ptr(2),
|
||||
TTLSecondsAfterFinished: pointer.Int32Ptr(1),
|
||||
Parallelism: pointer.Int32(5),
|
||||
ActiveDeadlineSeconds: pointer.Int64(2),
|
||||
TTLSecondsAfterFinished: pointer.Int32(1),
|
||||
},
|
||||
},
|
||||
update: func(job *batch.Job) {
|
||||
job.Spec.Parallelism = pointer.Int32Ptr(2)
|
||||
job.Spec.ActiveDeadlineSeconds = pointer.Int64Ptr(3)
|
||||
job.Spec.TTLSecondsAfterFinished = pointer.Int32Ptr(2)
|
||||
job.Spec.ManualSelector = pointer.BoolPtr(true)
|
||||
job.Spec.Parallelism = pointer.Int32(2)
|
||||
job.Spec.ActiveDeadlineSeconds = pointer.Int64(3)
|
||||
job.Spec.TTLSecondsAfterFinished = pointer.Int32(2)
|
||||
job.Spec.ManualSelector = pointer.Bool(true)
|
||||
},
|
||||
},
|
||||
"immutable completions for non-indexed jobs": {
|
||||
@ -957,7 +957,7 @@ func TestValidateJobUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
update: func(job *batch.Job) {
|
||||
job.Spec.Completions = pointer.Int32Ptr(1)
|
||||
job.Spec.Completions = pointer.Int32(1)
|
||||
},
|
||||
err: &field.Error{
|
||||
Type: field.ErrorTypeInvalid,
|
||||
@ -1097,7 +1097,7 @@ func TestValidateJobUpdate(t *testing.T) {
|
||||
Selector: validGeneratedSelector,
|
||||
Template: validPodTemplateSpecForGenerated,
|
||||
CompletionMode: completionModePtr(batch.IndexedCompletion),
|
||||
Completions: pointer.Int32Ptr(2),
|
||||
Completions: pointer.Int32(2),
|
||||
},
|
||||
},
|
||||
update: func(job *batch.Job) {
|
||||
@ -2025,7 +2025,7 @@ func TestValidateCronJob(t *testing.T) {
|
||||
ConcurrencyPolicy: batch.AllowConcurrent,
|
||||
JobTemplate: batch.JobTemplateSpec{
|
||||
Spec: batch.JobSpec{
|
||||
ManualSelector: pointer.BoolPtr(true),
|
||||
ManualSelector: pointer.Bool(true),
|
||||
Template: validPodTemplateSpec,
|
||||
},
|
||||
},
|
||||
|
@ -524,7 +524,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
ss.SessionAffinityConfig = nil
|
||||
}
|
||||
if ss.AllocateLoadBalancerNodePorts == nil {
|
||||
ss.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(true)
|
||||
ss.AllocateLoadBalancerNodePorts = utilpointer.Bool(true)
|
||||
}
|
||||
},
|
||||
func(s *core.NodeStatus, c fuzz.Continue) {
|
||||
|
@ -247,7 +247,7 @@ func TestReplicationControllerConversion(t *testing.T) {
|
||||
Namespace: "namespace",
|
||||
},
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: utilpointer.Int32Ptr(1),
|
||||
Replicas: utilpointer.Int32(1),
|
||||
MinReadySeconds: 32,
|
||||
Selector: map[string]string{"foo": "bar", "bar": "foo"},
|
||||
Template: &v1.PodTemplateSpec{
|
||||
|
@ -137,7 +137,7 @@ func SetDefaults_Service(obj *v1.Service) {
|
||||
|
||||
if obj.Spec.Type == v1.ServiceTypeLoadBalancer {
|
||||
if obj.Spec.AllocateLoadBalancerNodePorts == nil {
|
||||
obj.Spec.AllocateLoadBalancerNodePorts = pointer.BoolPtr(true)
|
||||
obj.Spec.AllocateLoadBalancerNodePorts = pointer.Bool(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
{
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: utilpointer.Int32Ptr(0),
|
||||
Replicas: utilpointer.Int32(0),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@ -597,7 +597,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
{
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@ -1730,7 +1730,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
|
||||
}
|
||||
rc := &v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
|
@ -40,13 +40,13 @@ func TestSetDefaultEndpointPort(t *testing.T) {
|
||||
}{
|
||||
"should set appropriate defaults": {
|
||||
original: &discovery.EndpointSlice{Ports: []discovery.EndpointPort{{
|
||||
Port: utilpointer.Int32Ptr(80),
|
||||
Port: utilpointer.Int32(80),
|
||||
}}},
|
||||
expected: &discovery.EndpointSlice{
|
||||
Ports: []discovery.EndpointPort{{
|
||||
Name: &emptyStr,
|
||||
Protocol: &protoTCP,
|
||||
Port: utilpointer.Int32Ptr(80),
|
||||
Port: utilpointer.Int32(80),
|
||||
}},
|
||||
},
|
||||
},
|
||||
|
@ -40,13 +40,13 @@ func TestSetDefaultEndpointPort(t *testing.T) {
|
||||
}{
|
||||
"should set appropriate defaults": {
|
||||
original: &discovery.EndpointSlice{Ports: []discovery.EndpointPort{{
|
||||
Port: utilpointer.Int32Ptr(80),
|
||||
Port: utilpointer.Int32(80),
|
||||
}}},
|
||||
expected: &discovery.EndpointSlice{
|
||||
Ports: []discovery.EndpointPort{{
|
||||
Name: &emptyStr,
|
||||
Protocol: &protoTCP,
|
||||
Port: utilpointer.Int32Ptr(80),
|
||||
Port: utilpointer.Int32(80),
|
||||
}},
|
||||
},
|
||||
},
|
||||
|
@ -82,7 +82,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
UpdateStrategy: extensionsv1beta1.DaemonSetUpdateStrategy{
|
||||
Type: extensionsv1beta1.OnDeleteDaemonSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -95,7 +95,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
},
|
||||
Spec: extensionsv1beta1.DaemonSetSpec{
|
||||
Template: defaultTemplate,
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
RevisionHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
expected: &extensionsv1beta1.DaemonSet{
|
||||
@ -112,7 +112,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
UpdateStrategy: extensionsv1beta1.DaemonSetUpdateStrategy{
|
||||
Type: extensionsv1beta1.OnDeleteDaemonSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(1),
|
||||
RevisionHistoryLimit: utilpointer.Int32(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -124,7 +124,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
UpdateStrategy: extensionsv1beta1.DaemonSetUpdateStrategy{
|
||||
Type: extensionsv1beta1.OnDeleteDaemonSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -138,7 +138,7 @@ func TestSetDefaultDaemonSetSpec(t *testing.T) {
|
||||
UpdateStrategy: extensionsv1beta1.DaemonSetUpdateStrategy{
|
||||
Type: extensionsv1beta1.OnDeleteDaemonSetStrategyType,
|
||||
},
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(10),
|
||||
RevisionHistoryLimit: utilpointer.Int32(10),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -180,7 +180,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
original: &extensionsv1beta1.Deployment{},
|
||||
expected: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(1),
|
||||
Replicas: utilpointer.Int32(1),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &extensionsv1beta1.RollingUpdateDeployment{
|
||||
@ -189,15 +189,15 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
original: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
RollingUpdate: &extensionsv1beta1.RollingUpdateDeployment{
|
||||
MaxSurge: &differentIntOrString,
|
||||
@ -207,7 +207,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &extensionsv1beta1.RollingUpdateDeployment{
|
||||
@ -216,15 +216,15 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
original: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: nil,
|
||||
@ -233,7 +233,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &extensionsv1beta1.RollingUpdateDeployment{
|
||||
@ -242,15 +242,15 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
original: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
@ -258,35 +258,35 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
},
|
||||
expected: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(math.MaxInt32),
|
||||
RevisionHistoryLimit: utilpointer.Int32(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
original: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
},
|
||||
},
|
||||
expected: &extensionsv1beta1.Deployment{
|
||||
Spec: extensionsv1beta1.DeploymentSpec{
|
||||
Replicas: utilpointer.Int32Ptr(5),
|
||||
Replicas: utilpointer.Int32(5),
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
ProgressDeadlineSeconds: utilpointer.Int32(30),
|
||||
RevisionHistoryLimit: utilpointer.Int32(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -442,7 +442,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
|
||||
{
|
||||
rs: extensionsv1beta1.ReplicaSet{
|
||||
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(0),
|
||||
Replicas: utilpointer.Int32(0),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@ -457,7 +457,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
|
||||
{
|
||||
rs: extensionsv1beta1.ReplicaSet{
|
||||
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@ -500,7 +500,7 @@ func TestDefaultRequestIsNotSetForReplicaSet(t *testing.T) {
|
||||
}
|
||||
rs := &extensionsv1beta1.ReplicaSet{
|
||||
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Replicas: utilpointer.Int32(3),
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
|
@ -227,12 +227,12 @@ func TestValidateScheduling(t *testing.T) {
|
||||
Key: "valid",
|
||||
Operator: core.TolerationOpExists,
|
||||
Effect: core.TaintEffectNoExecute,
|
||||
TolerationSeconds: utilpointer.Int64Ptr(5),
|
||||
TolerationSeconds: utilpointer.Int64(5),
|
||||
}, {
|
||||
Key: "valid",
|
||||
Operator: core.TolerationOpExists,
|
||||
Effect: core.TaintEffectNoExecute,
|
||||
TolerationSeconds: utilpointer.Int64Ptr(10),
|
||||
TolerationSeconds: utilpointer.Int64(10),
|
||||
}},
|
||||
},
|
||||
expectErrs: 1,
|
||||
|
@ -1121,7 +1121,7 @@ func TestCSINodeValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(0)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(0)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1135,7 +1135,7 @@ func TestCSINodeValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(1)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(1)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1384,7 +1384,7 @@ func TestCSINodeValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(-1)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(-1)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1431,7 +1431,7 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(20)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(20)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1452,7 +1452,7 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(20)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(20)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1484,13 +1484,13 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(20)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(20)},
|
||||
},
|
||||
{
|
||||
Name: "io.kubernetes.storage.csi.driver-3",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(30)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(30)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1509,7 +1509,7 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.new-driver",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(30)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(30)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1537,7 +1537,7 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(20)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(20)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1556,7 +1556,7 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(20)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(20)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1570,13 +1570,13 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-1",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(10)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(10)},
|
||||
},
|
||||
{
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(20)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(20)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1595,7 +1595,7 @@ func TestCSINodeUpdateValidation(t *testing.T) {
|
||||
Name: "io.kubernetes.storage.csi.driver-2",
|
||||
NodeID: nodeID,
|
||||
TopologyKeys: []string{"company.com/zone1", "company.com/zone2"},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32Ptr(21)},
|
||||
Allocatable: &storage.VolumeNodeResources{Count: utilpointer.Int32(21)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2217,7 +2217,7 @@ func TestCSIServiceAccountToken(t *testing.T) {
|
||||
csiDriver: &storage.CSIDriver{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: driverName},
|
||||
Spec: storage.CSIDriverSpec{
|
||||
TokenRequests: []storage.TokenRequest{{Audience: gcp, ExpirationSeconds: utilpointer.Int64Ptr(10)}},
|
||||
TokenRequests: []storage.TokenRequest{{Audience: gcp, ExpirationSeconds: utilpointer.Int64(10)}},
|
||||
RequiresRepublish: ¬RequiresRepublish,
|
||||
},
|
||||
},
|
||||
@ -2228,7 +2228,7 @@ func TestCSIServiceAccountToken(t *testing.T) {
|
||||
csiDriver: &storage.CSIDriver{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: driverName},
|
||||
Spec: storage.CSIDriverSpec{
|
||||
TokenRequests: []storage.TokenRequest{{Audience: gcp, ExpirationSeconds: utilpointer.Int64Ptr(1<<32 + 1)}},
|
||||
TokenRequests: []storage.TokenRequest{{Audience: gcp, ExpirationSeconds: utilpointer.Int64(1<<32 + 1)}},
|
||||
RequiresRepublish: ¬RequiresRepublish,
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user