Skip to content

Commit 3ac6a73

Browse files
committed
📖 Document event recorder name length constraint
1 parent 2a830d5 commit 3ac6a73

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

pkg/internal/recorder/recorder.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ func (p *Provider) GetEventRecorderFor(name string) record.EventRecorder {
161161
}
162162

163163
// GetEventRecorder returns an event recorder that broadcasts to this provider's
164-
// broadcaster. All events will be associated with a component of the given name.
164+
// broadcaster. All events will be associated with the given reportingController
165+
// name. client-go appends "-" and the hostname to derive reportingInstance,
166+
// which must fit within the events.k8s.io/v1 128-character limit.
165167
func (p *Provider) GetEventRecorder(name string) events.EventRecorder {
166168
return &lazyRecorder{
167169
prov: p,

pkg/recorder/recorder.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ type Provider interface {
3131
//
3232
// Deprecated: this uses the old events API and will be removed in a future release. Please use GetEventRecorder instead.
3333
GetEventRecorderFor(name string) record.EventRecorder
34-
// GetEventRecorder returns a EventRecorder with given name.
34+
// GetEventRecorder returns an EventRecorder with given name.
35+
//
36+
// The name is used as the reportingController of events.k8s.io/v1 Events
37+
// and must be a valid Kubernetes qualified name. client-go derives the
38+
// reportingInstance by appending "-" and the current hostname to
39+
// reportingController. reportingInstance must be no more than 128
40+
// characters, so callers should ensure that len(name) + 1 + len(hostname)
41+
// is at most 128.
3542
GetEventRecorder(name string) events.EventRecorder
3643
}

0 commit comments

Comments
 (0)