Skip to content

Commit 07d0b4a

Browse files
Cleaned up and fixed: the potentially misleading comments around Event struct
1 parent 57e9a41 commit 07d0b4a

File tree

7 files changed

+20
-28
lines changed

7 files changed

+20
-28
lines changed

api/openapi-spec/swagger.json

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

pkg/apis/core/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,10 +4568,10 @@ const (
45684568
// TODO: Decide whether to store these separately or with the object they apply to.
45694569
type Event struct {
45704570
metav1.TypeMeta
4571-
// +optional
4571+
45724572
metav1.ObjectMeta
45734573

4574-
// Required. The object that this event is about. Mapped to events.Event.regarding
4574+
// The object that this event is about. Mapped to events.Event.regarding
45754575
// +optional
45764576
InvolvedObject ObjectReference
45774577

staging/src/k8s.io/api/events/v1/generated.proto

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

staging/src/k8s.io/api/events/v1/types.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
// Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system.
2828
type Event struct {
2929
metav1.TypeMeta `json:",inline"`
30-
// +optional
31-
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
30+
31+
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
3232

3333
// eventTime is the time when this Event was first observed. It is required.
3434
EventTime metav1.MicroTime `json:"eventTime" protobuf:"bytes,2,opt,name=eventTime"`
@@ -39,22 +39,18 @@ type Event struct {
3939

4040
// reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.
4141
// This field cannot be empty for new Events.
42-
// +optional
4342
ReportingController string `json:"reportingController,omitempty" protobuf:"bytes,4,opt,name=reportingController"`
4443

4544
// reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`.
4645
// This field cannot be empty for new Events and it can have at most 128 characters.
47-
// +optional
4846
ReportingInstance string `json:"reportingInstance,omitempty" protobuf:"bytes,5,opt,name=reportingInstance"`
4947

5048
// action is what action was taken/failed regarding to the regarding object. It is machine-readable.
51-
// This field can have at most 128 characters.
52-
// +optional
49+
// This field cannot be empty for new Events and it can have at most 128 characters.
5350
Action string `json:"action,omitempty" protobuf:"bytes,6,name=action"`
5451

5552
// reason is why the action was taken. It is human-readable.
56-
// This field can have at most 128 characters.
57-
// +optional
53+
// This field cannot be empty for new Events and it can have at most 128 characters.
5854
Reason string `json:"reason,omitempty" protobuf:"bytes,7,name=reason"`
5955

6056
// regarding contains the object this Event is about. In most cases it's an Object reporting controller
@@ -76,7 +72,7 @@ type Event struct {
7672

7773
// type is the type of this event (Normal, Warning), new types could be added in the future.
7874
// It is machine-readable.
79-
// +optional
75+
// This field cannot be empty for new Events.
8076
Type string `json:"type,omitempty" protobuf:"bytes,11,opt,name=type"`
8177

8278
// deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.

staging/src/k8s.io/api/events/v1/types_swagger_doc_generated.go

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

staging/src/k8s.io/api/events/v1beta1/generated.proto

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

staging/src/k8s.io/api/events/v1beta1/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
// Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system.
3030
type Event struct {
3131
metav1.TypeMeta `json:",inline"`
32-
// +optional
33-
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
32+
33+
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
3434

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

0 commit comments

Comments
 (0)