forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defaults.go
44 lines (38 loc) · 904 Bytes
/
defaults.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package v1beta1
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)
func init() {
mkintp := func(i int) *int64 {
v := int64(i)
return &v
}
err := api.Scheme.AddDefaultingFuncs(
func(obj *DeploymentStrategy) {
if len(obj.Type) == 0 {
obj.Type = DeploymentStrategyTypeRolling
}
if obj.Type == DeploymentStrategyTypeRolling && obj.RollingParams == nil {
obj.RollingParams = &RollingDeploymentStrategyParams{
IntervalSeconds: mkintp(1),
UpdatePeriodSeconds: mkintp(1),
TimeoutSeconds: mkintp(120),
}
}
},
func(obj *RollingDeploymentStrategyParams) {
if obj.IntervalSeconds == nil {
obj.IntervalSeconds = mkintp(1)
}
if obj.UpdatePeriodSeconds == nil {
obj.UpdatePeriodSeconds = mkintp(1)
}
if obj.TimeoutSeconds == nil {
obj.TimeoutSeconds = mkintp(120)
}
},
)
if err != nil {
panic(err)
}
}