forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defaults.go
45 lines (38 loc) · 1.14 KB
/
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
45
package v1
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
deployapi "github.com/openshift/origin/pkg/deploy/api"
)
func init() {
mkintp := func(i int64) *int64 {
return &i
}
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(deployapi.DefaultRollingIntervalSeconds),
UpdatePeriodSeconds: mkintp(deployapi.DefaultRollingUpdatePeriodSeconds),
TimeoutSeconds: mkintp(deployapi.DefaultRollingTimeoutSeconds),
}
}
},
func(obj *RollingDeploymentStrategyParams) {
if obj.IntervalSeconds == nil {
obj.IntervalSeconds = mkintp(deployapi.DefaultRollingIntervalSeconds)
}
if obj.UpdatePeriodSeconds == nil {
obj.UpdatePeriodSeconds = mkintp(deployapi.DefaultRollingUpdatePeriodSeconds)
}
if obj.TimeoutSeconds == nil {
obj.TimeoutSeconds = mkintp(deployapi.DefaultRollingTimeoutSeconds)
}
},
)
if err != nil {
panic(err)
}
}