Skip to content

Commit

Permalink
Fix dedupe on events
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam committed Jun 15, 2023
1 parent be40f2c commit 13933a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/provisioning/scheduling/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ func PodFailedToSchedule(pod *v1.Pod, err error) events.Event {
Type: v1.EventTypeWarning,
Reason: "FailedScheduling",
Message: fmt.Sprintf("Failed to schedule pod, %s", err),
DedupeValues: []string{string(pod.UID), err.Error()},
DedupeValues: []string{string(pod.UID)},
}
}
2 changes: 1 addition & 1 deletion pkg/events/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type recorder struct {
cache *cache.Cache
}

const defaultDedupeTimeout = 2 * time.Minute
const defaultDedupeTimeout = 5 * time.Minute

func NewRecorder(r record.EventRecorder) Recorder {
return &recorder{
Expand Down
4 changes: 3 additions & 1 deletion pkg/scheduling/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,7 @@ func (r Requirements) Labels() map[string]string {

func (r Requirements) String() string {
requirements := lo.Reject(r.Values(), func(requirement *Requirement, _ int) bool { return v1alpha5.RestrictedLabels.Has(requirement.Key) })
return strings.Join(lo.Map(requirements, func(requirement *Requirement, _ int) string { return requirement.String() }), ", ")
stringRequirements := lo.Map(requirements, func(requirement *Requirement, _ int) string { return requirement.String() })
sort.Strings(stringRequirements)
return strings.Join(stringRequirements, ", ")
}

0 comments on commit 13933a3

Please sign in to comment.