Default extensions/v1beta1 Deployment's ProgressDeadlineSeconds to MaxInt32.
1. MaxInt32 has the same meaning as unset, for compatibility 2. Deployment controller treats MaxInt32 the same as unset (nil)
This commit is contained in:
@@ -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