@@ -26,12 +26,17 @@ import (
26
26
deployutil "github.com/openshift/origin/pkg/deploy/util"
27
27
)
28
28
29
- // TODO: This should perhaps be made public upstream. See:
30
- // https://github.com/kubernetes/kubernetes/issues/7851
31
- const sourceIdAnnotation = "kubectl.kubernetes.io/update-source-id"
29
+ const (
30
+ // TODO: This should perhaps be made public upstream. See:
31
+ // https://github.com/kubernetes/kubernetes/issues/7851
32
+ sourceIdAnnotation = "kubectl.kubernetes.io/update-source-id"
32
33
33
- const DefaultApiRetryPeriod = 1 * time .Second
34
- const DefaultApiRetryTimeout = 10 * time .Second
34
+ defaultApiRetryPeriod = 1 * time .Second
35
+ defaultApiRetryTimeout = 10 * time .Second
36
+ // acceptorInterval is how often the UpdateAcceptor should check for
37
+ // readiness.
38
+ acceptorInterval = 1 * time .Second
39
+ )
35
40
36
41
// RollingDeploymentStrategy is a Strategy which implements rolling
37
42
// deployments using the upstream Kubernetes RollingUpdater.
@@ -65,7 +70,7 @@ type RollingDeploymentStrategy struct {
65
70
// decoder is used to access the encoded config on a deployment.
66
71
decoder runtime.Decoder
67
72
// hookExecutor can execute a lifecycle hook.
68
- hookExecutor hookExecutor
73
+ hookExecutor stratsupport. HookExecutor
69
74
// getUpdateAcceptor returns an UpdateAcceptor to verify the first replica
70
75
// of the deployment.
71
76
getUpdateAcceptor func (time.Duration , int32 ) strat.UpdateAcceptor
@@ -84,10 +89,6 @@ type acceptingDeploymentStrategy interface {
84
89
DeployWithAcceptor (from * kapi.ReplicationController , to * kapi.ReplicationController , desiredReplicas int , updateAcceptor strat.UpdateAcceptor ) error
85
90
}
86
91
87
- // AcceptorInterval is how often the UpdateAcceptor should check for
88
- // readiness.
89
- const AcceptorInterval = 1 * time .Second
90
-
91
92
// NewRollingDeploymentStrategy makes a new RollingDeploymentStrategy.
92
93
func NewRollingDeploymentStrategy (namespace string , oldClient kclient.Interface , tags client.ImageStreamTagsNamespacer , events record.EventSink , decoder runtime.Decoder , initialStrategy acceptingDeploymentStrategy , out , errOut io.Writer , until string ) * RollingDeploymentStrategy {
93
94
if out == nil {
@@ -107,15 +108,15 @@ func NewRollingDeploymentStrategy(namespace string, oldClient kclient.Interface,
107
108
rcClient : client .Core (),
108
109
eventClient : client .Core (),
109
110
tags : tags ,
110
- apiRetryPeriod : DefaultApiRetryPeriod ,
111
- apiRetryTimeout : DefaultApiRetryTimeout ,
111
+ apiRetryPeriod : defaultApiRetryPeriod ,
112
+ apiRetryTimeout : defaultApiRetryTimeout ,
112
113
rollingUpdate : func (config * kubectl.RollingUpdaterConfig ) error {
113
114
updater := kubectl .NewRollingUpdater (namespace , oldClient )
114
115
return updater .Update (config )
115
116
},
116
117
hookExecutor : stratsupport .NewHookExecutor (client .Core (), tags , client .Core (), os .Stdout , decoder ),
117
118
getUpdateAcceptor : func (timeout time.Duration , minReadySeconds int32 ) strat.UpdateAcceptor {
118
- return stratsupport .NewAcceptNewlyObservedReadyPods (out , client .Core (), timeout , AcceptorInterval , minReadySeconds )
119
+ return stratsupport .NewAcceptAvailablePods (out , client .Core (), timeout , acceptorInterval , minReadySeconds )
119
120
},
120
121
}
121
122
}
@@ -282,18 +283,3 @@ func (w *rollingUpdaterWriter) Write(p []byte) (n int, err error) {
282
283
}
283
284
return n , nil
284
285
}
285
-
286
- // hookExecutor knows how to execute a deployment lifecycle hook.
287
- type hookExecutor interface {
288
- Execute (hook * deployapi.LifecycleHook , deployment * kapi.ReplicationController , suffix , label string ) error
289
- }
290
-
291
- // hookExecutorImpl is a pluggable hookExecutor.
292
- type hookExecutorImpl struct {
293
- executeFunc func (hook * deployapi.LifecycleHook , deployment * kapi.ReplicationController , suffix , label string ) error
294
- }
295
-
296
- // Execute executes the provided lifecycle hook
297
- func (i * hookExecutorImpl ) Execute (hook * deployapi.LifecycleHook , deployment * kapi.ReplicationController , suffix , label string ) error {
298
- return i .executeFunc (hook , deployment , suffix , label )
299
- }
0 commit comments