Skip to content

Commit 20e1cb1

Browse files
authored
Emit an event when an admitted AppWrapper is suspended by Kueue (#332)
1 parent fef91a9 commit 20e1cb1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: internal/controller/appwrapper/appwrapper_controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
210210

211211
case awv1beta2.AppWrapperResuming: // deploying components
212212
if aw.Spec.Suspend {
213+
r.Recorder.Event(aw, v1.EventTypeNormal, string(awv1beta2.AppWrapperSuspending), "Externally suspended while in the Resuming phase")
213214
return ctrl.Result{}, r.transitionToPhase(ctx, copyForStatusPatch(aw), aw, awv1beta2.AppWrapperSuspending) // abort deployment
214215
}
215216
err, fatal := r.createComponents(ctx, aw) // NOTE: createComponents applies patches to aw.Status incrementally as resources are created
@@ -242,6 +243,7 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
242243
case awv1beta2.AppWrapperRunning: // components deployed
243244
orig := copyForStatusPatch(aw)
244245
if aw.Spec.Suspend {
246+
r.Recorder.Event(aw, v1.EventTypeNormal, string(awv1beta2.AppWrapperSuspending), "Externally suspended while in the Running phase")
245247
return ctrl.Result{}, r.transitionToPhase(ctx, orig, aw, awv1beta2.AppWrapperSuspending) // begin undeployment
246248
}
247249

@@ -397,6 +399,7 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
397399
case awv1beta2.AppWrapperResetting:
398400
orig := copyForStatusPatch(aw)
399401
if aw.Spec.Suspend {
402+
r.Recorder.Event(aw, v1.EventTypeNormal, string(awv1beta2.AppWrapperSuspending), "Externally suspended while in the Resetting phase")
400403
return ctrl.Result{}, r.transitionToPhase(ctx, orig, aw, awv1beta2.AppWrapperSuspending) // Suspending trumps Resetting
401404
}
402405

0 commit comments

Comments
 (0)