Skip to content

Commit ae430af

Browse files
Merge pull request #136844 from Ignoramuss/events-optionalorrequired
api: enable optionalorrequired linter for events API Kubernetes-commit: 656b460a5b836ca03e1e602dcd2af19545cd779f
2 parents d92971d + 5667dcb commit ae430af

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

events/v1/generated.proto

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

events/v1/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type Event struct {
4040
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
4141

4242
// eventTime is the time when this Event was first observed. It is required.
43+
// +required
4344
EventTime metav1.MicroTime `json:"eventTime" protobuf:"bytes,2,opt,name=eventTime"`
4445

4546
// series is data about the Event series this event represents or nil if it's a singleton Event.
@@ -48,18 +49,22 @@ type Event struct {
4849

4950
// reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.
5051
// This field cannot be empty for new Events.
52+
// +required
5153
ReportingController string `json:"reportingController,omitempty" protobuf:"bytes,4,opt,name=reportingController"`
5254

5355
// reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`.
5456
// This field cannot be empty for new Events and it can have at most 128 characters.
57+
// +required
5558
ReportingInstance string `json:"reportingInstance,omitempty" protobuf:"bytes,5,opt,name=reportingInstance"`
5659

5760
// action is what action was taken/failed regarding to the regarding object. It is machine-readable.
5861
// This field cannot be empty for new Events and it can have at most 128 characters.
62+
// +required
5963
Action string `json:"action,omitempty" protobuf:"bytes,6,name=action"`
6064

6165
// reason is why the action was taken. It is human-readable.
6266
// This field cannot be empty for new Events and it can have at most 128 characters.
67+
// +required
6368
Reason string `json:"reason,omitempty" protobuf:"bytes,7,name=reason"`
6469

6570
// regarding contains the object this Event is about. In most cases it's an Object reporting controller
@@ -82,6 +87,7 @@ type Event struct {
8287
// type is the type of this event (Normal, Warning), new types could be added in the future.
8388
// It is machine-readable.
8489
// This field cannot be empty for new Events.
90+
// +required
8591
Type string `json:"type,omitempty" protobuf:"bytes,11,opt,name=type"`
8692

8793
// deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.
@@ -104,8 +110,10 @@ type Event struct {
104110
// how this struct is updated on heartbeats and can guide customized reporter implementations.
105111
type EventSeries struct {
106112
// count is the number of occurrences in this series up to the last heartbeat time.
113+
// +required
107114
Count int32 `json:"count" protobuf:"varint,1,opt,name=count"`
108115
// lastObservedTime is the time when last Event from the series was seen before last heartbeat.
116+
// +required
109117
LastObservedTime metav1.MicroTime `json:"lastObservedTime" protobuf:"bytes,2,opt,name=lastObservedTime"`
110118
}
111119

events/v1beta1/generated.proto

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

events/v1beta1/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type Event struct {
4141
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
4242

4343
// eventTime is the time when this Event was first observed. It is required.
44+
// +optional
4445
EventTime metav1.MicroTime `json:"eventTime" protobuf:"bytes,2,opt,name=eventTime"`
4546

4647
// series is data about the Event series this event represents or nil if it's a singleton Event.
@@ -107,8 +108,10 @@ type Event struct {
107108
// continuously for some time.
108109
type EventSeries struct {
109110
// count is the number of occurrences in this series up to the last heartbeat time.
111+
// +optional
110112
Count int32 `json:"count" protobuf:"varint,1,opt,name=count"`
111113
// lastObservedTime is the time when last Event from the series was seen before last heartbeat.
114+
// +optional
112115
LastObservedTime metav1.MicroTime `json:"lastObservedTime" protobuf:"bytes,2,opt,name=lastObservedTime"`
113116

114117
// +k8s:deprecated=state,protobuf=3

0 commit comments

Comments
 (0)