Skip to content

Commit 20a6f99

Browse files
committed
Do not Fail the deployment, unless there is REALLY no other way
1 parent c9fdc98 commit 20a6f99

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

pkg/deployment/deployment.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,32 +170,27 @@ func (d *Deployment) run() {
170170
if d.status.Phase == api.DeploymentPhaseNone {
171171
// Create secrets
172172
if err := d.resources.EnsureSecrets(); err != nil {
173-
d.failOnError(err, "Failed to create secrets")
174-
return
173+
d.CreateEvent(k8sutil.NewErrorEvent("Failed to create secrets", err, d.GetAPIObject()))
175174
}
176175

177176
// Create services
178177
if err := d.resources.EnsureServices(); err != nil {
179-
d.failOnError(err, "Failed to create services")
180-
return
178+
d.CreateEvent(k8sutil.NewErrorEvent("Failed to create services", err, d.GetAPIObject()))
181179
}
182180

183181
// Create members
184182
if err := d.createInitialMembers(d.apiObject); err != nil {
185-
d.failOnError(err, "Failed to create initial members")
186-
return
183+
d.CreateEvent(k8sutil.NewErrorEvent("Failed to create initial members", err, d.GetAPIObject()))
187184
}
188185

189186
// Create PVCs
190187
if err := d.resources.EnsurePVCs(); err != nil {
191-
d.failOnError(err, "Failed to create persistent volume claims")
192-
return
188+
d.CreateEvent(k8sutil.NewErrorEvent("Failed to create persistent volume claims", err, d.GetAPIObject()))
193189
}
194190

195191
// Create pods
196192
if err := d.resources.EnsurePods(); err != nil {
197-
d.failOnError(err, "Failed to create pods")
198-
return
193+
d.CreateEvent(k8sutil.NewErrorEvent("Failed to create pods", err, d.GetAPIObject()))
199194
}
200195

201196
d.status.Phase = api.DeploymentPhaseRunning
@@ -226,8 +221,7 @@ func (d *Deployment) run() {
226221

227222
case <-d.updateDeploymentTrigger.Done():
228223
if err := d.handleArangoDeploymentUpdatedEvent(); err != nil {
229-
d.failOnError(err, "Failed to handle deployment update")
230-
return
224+
d.CreateEvent(k8sutil.NewErrorEvent("Failed to handle deployment update", err, d.GetAPIObject()))
231225
}
232226

233227
case <-time.After(inspectionInterval):
@@ -389,6 +383,7 @@ func (d *Deployment) updateCRSpec(newSpec api.DeploymentSpec) error {
389383
}
390384

391385
// failOnError reports the given error and sets the deployment status to failed.
386+
// Since there is no recovery from a failed deployment, use with care!
392387
func (d *Deployment) failOnError(err error, msg string) {
393388
log.Error().Err(err).Msg(msg)
394389
d.status.Reason = err.Error()

0 commit comments

Comments
 (0)