Merge pull request #66581 from janetkuo/deploy-progress
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Default extensions/v1beta1 Deployment's ProgressDeadlineSeconds to MaxInt32 **What this PR does / why we need it**: Default values should be set in all API versions, because defaulting happens whenever a serialized version is read. When we switched to `apps/v1` as the storage version in `1.10` (#58854), `extensions/v1beta1` `DeploymentSpec.ProgressDeadlineSeconds` gets `apps/v1` default value (`600`) instead of being unset. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #66135 **Special notes for your reviewer**: We need to cherrypick this fix to 1.10 and 1.11. Note that this fix will only help people who haven't upgraded to 1.10 or 1.11 when the storage version is changed. @kubernetes/sig-apps-bugs **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -127,8 +127,8 @@ type DeploymentSpec struct {
|
||||
// is considered to be failed. The deployment controller will continue to
|
||||
// process failed deployments and a condition with a ProgressDeadlineExceeded
|
||||
// reason will be surfaced in the deployment status. Note that progress will
|
||||
// not be estimated during the time a deployment is paused. This is not set
|
||||
// by default.
|
||||
// not be estimated during the time a deployment is paused. This is set to
|
||||
// the max value of int32 (i.e. 2147483647) by default, which means "no deadline".
|
||||
// +optional
|
||||
ProgressDeadlineSeconds *int32
|
||||
}
|
||||
|
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -110,6 +112,12 @@ func SetDefaults_Deployment(obj *extensionsv1beta1.Deployment) {
|
||||
strategy.RollingUpdate.MaxSurge = &maxSurge
|
||||
}
|
||||
}
|
||||
// Set extensionsv1beta1.DeploymentSpec.ProgressDeadlineSeconds to MaxInt,
|
||||
// which has the same meaning as unset.
|
||||
if obj.Spec.ProgressDeadlineSeconds == nil {
|
||||
obj.Spec.ProgressDeadlineSeconds = new(int32)
|
||||
*obj.Spec.ProgressDeadlineSeconds = math.MaxInt32
|
||||
}
|
||||
}
|
||||
|
||||
func SetDefaults_ReplicaSet(obj *extensionsv1beta1.ReplicaSet) {
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package v1beta1_test
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -188,7 +189,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -213,7 +215,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -237,7 +240,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -256,7 +260,8 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
Strategy: extensionsv1beta1.DeploymentStrategy{
|
||||
Type: extensionsv1beta1.RecreateDeploymentStrategyType,
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
Template: defaultTemplate,
|
||||
ProgressDeadlineSeconds: utilpointer.Int32Ptr(math.MaxInt32),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user