@@ -113,28 +113,37 @@ func (optr *Operator) syncBaremetalControllers(config *OperatorConfig) error {
113
113
}
114
114
115
115
func (optr * Operator ) waitForDeploymentRollout (resource * appsv1.Deployment ) error {
116
- return wait .Poll (deploymentRolloutPollInterval , deploymentRolloutTimeout , func () (bool , error ) {
116
+ var lastError error
117
+ err := wait .Poll (deploymentRolloutPollInterval , deploymentRolloutTimeout , func () (bool , error ) {
117
118
d , err := optr .deployLister .Deployments (resource .Namespace ).Get (resource .Name )
118
119
if apierrors .IsNotFound (err ) {
119
120
return false , nil
120
121
}
121
122
if err != nil {
122
123
// Do not return error here, as we could be updating the API Server itself, in which case we
123
124
// want to continue waiting.
124
- glog .Errorf ("Error getting Deployment %q during rollout: %v" , resource .Name , err )
125
+ lastError = fmt .Errorf ("getting Deployment %s during rollout: %v" , resource .Name , err )
126
+ glog .Error (lastError )
125
127
return false , nil
126
128
}
127
129
128
130
if d .DeletionTimestamp != nil {
129
- return false , fmt .Errorf ("deployment %q is being deleted" , resource .Name )
131
+ lastError = nil
132
+ return false , fmt .Errorf ("deployment %s is being deleted" , resource .Name )
130
133
}
131
134
132
135
if d .Generation <= d .Status .ObservedGeneration && d .Status .UpdatedReplicas == d .Status .Replicas && d .Status .UnavailableReplicas == 0 {
136
+ lastError = nil
133
137
return true , nil
134
138
}
135
- glog .V (4 ).Infof ("Deployment %q is not ready. status: (replicas: %d, updated: %d, ready: %d, unavailable: %d)" , d .Name , d .Status .Replicas , d .Status .UpdatedReplicas , d .Status .ReadyReplicas , d .Status .UnavailableReplicas )
139
+ lastError = fmt .Errorf ("deployment %s is not ready. status: (replicas: %d, updated: %d, ready: %d, unavailable: %d)" , d .Name , d .Status .Replicas , d .Status .UpdatedReplicas , d .Status .ReadyReplicas , d .Status .UnavailableReplicas )
140
+ glog .V (4 ).Info (lastError )
136
141
return false , nil
137
142
})
143
+ if lastError != nil {
144
+ return lastError
145
+ }
146
+ return err
138
147
}
139
148
140
149
func newDeployment (config * OperatorConfig , features map [string ]bool ) * appsv1.Deployment {
0 commit comments