Merge pull request #66605 from islinwb/default_RevisionHistoryLimit

Default extensions/v1beta1 Deployment's RevisionHistoryLimit to MaxInt32
This commit is contained in:
k8s-ci-robot
2018-10-08 10:41:46 -07:00
committed by GitHub
12 changed files with 37 additions and 5 deletions

View File

@@ -110,6 +110,8 @@ type DeploymentSpec struct {
// The number of old ReplicaSets to retain to allow rollback.
// This is a pointer to distinguish between explicit zero and not specified.
// This is set to the max value of int32 (i.e. 2147483647) by default, which means
// "retaining all old ReplicaSets".
// +optional
RevisionHistoryLimit *int32

View File

@@ -118,6 +118,12 @@ func SetDefaults_Deployment(obj *extensionsv1beta1.Deployment) {
obj.Spec.ProgressDeadlineSeconds = new(int32)
*obj.Spec.ProgressDeadlineSeconds = math.MaxInt32
}
// Set extensionsv1beta1.DeploymentSpec.RevisionHistoryLimit to MaxInt32,
// which has the same meaning as unset.
if obj.Spec.RevisionHistoryLimit == nil {
obj.Spec.RevisionHistoryLimit = new(int32)
*obj.Spec.RevisionHistoryLimit = math.MaxInt32
}
}
func SetDefaults_ReplicaSet(obj *extensionsv1beta1.ReplicaSet) {

View File

@@ -196,6 +196,7 @@ func TestSetDefaultDeployment(t *testing.T) {
},
Template: defaultTemplate,
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
},
},
},
@@ -222,6 +223,7 @@ func TestSetDefaultDeployment(t *testing.T) {
},
Template: defaultTemplate,
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
},
},
},
@@ -247,6 +249,7 @@ func TestSetDefaultDeployment(t *testing.T) {
},
Template: defaultTemplate,
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
},
},
},
@@ -267,6 +270,7 @@ func TestSetDefaultDeployment(t *testing.T) {
},
Template: defaultTemplate,
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
},
},
},
@@ -288,6 +292,7 @@ func TestSetDefaultDeployment(t *testing.T) {
},
Template: defaultTemplate,
ProgressDeadlineSeconds: utilpointer.Int32Ptr(30),
RevisionHistoryLimit: utilpointer.Int32Ptr(math.MaxInt32),
},
},
},