Skip to content

Commit

Permalink
feat: add event recorder event
Browse files Browse the repository at this point in the history
Signed-off-by: googs1025 <googs1025@gmail.com>
  • Loading branch information
googs1025 committed Apr 17, 2024
1 parent ec6aef7 commit c4a202a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const (
// The event uses the error(s) as the reason.
JobCreationFailedReason = "JobCreationFailed"

// Event reason used when a Headless Service creation fails.
// The event uses the error(s) as the reason.
HeadlessServiceCreationFailedReason = "HeadlessServiceCreationFailed"

// Event reason and message for when the pod controller detects a violation
// of the JobSet exclusive placment policy (i.e., follower pods not colocated in
// the same topology domain as the leader pod for that Job).
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/jobset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ func (r *JobSetReconciler) createHeadlessSvcIfNecessary(ctx context.Context, js

// Create headless service.
if err := r.Create(ctx, &headlessSvc); err != nil {
r.Record.Eventf(js, corev1.EventTypeWarning, constants.HeadlessServiceCreationFailedReason, err.Error())
return err
}
log.V(2).Info("successfully created headless service", "service", klog.KObj(&headlessSvc))
Expand Down

0 comments on commit c4a202a

Please sign in to comment.