blob: e2ed214b0639fdc7555ac0e2ca7ddd3cc3fcbb7f [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright 2017 The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package v1beta1
18
19import (
20 corev1 "k8s.io/api/core/v1"
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22)
23
24// +genclient
25// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
26// +k8s:prerelease-lifecycle-gen:introduced=1.8
27// +k8s:prerelease-lifecycle-gen:deprecated=1.22
28
29// Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system.
30type Event struct {
31 metav1.TypeMeta `json:",inline"`
32 // +optional
33 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
34
35 // eventTime is the time when this Event was first observed. It is required.
36 EventTime metav1.MicroTime `json:"eventTime" protobuf:"bytes,2,opt,name=eventTime"`
37
38 // series is data about the Event series this event represents or nil if it's a singleton Event.
39 // +optional
40 Series *EventSeries `json:"series,omitempty" protobuf:"bytes,3,opt,name=series"`
41
42 // reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.
43 // This field cannot be empty for new Events.
44 // +optional
45 ReportingController string `json:"reportingController,omitempty" protobuf:"bytes,4,opt,name=reportingController"`
46
47 // reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`.
48 // This field cannot be empty for new Events and it can have at most 128 characters.
49 // +optional
50 ReportingInstance string `json:"reportingInstance,omitempty" protobuf:"bytes,5,opt,name=reportingInstance"`
51
52 // action is what action was taken/failed regarding to the regarding object. It is machine-readable.
53 // This field can have at most 128 characters.
54 // +optional
55 Action string `json:"action,omitempty" protobuf:"bytes,6,name=action"`
56
57 // reason is why the action was taken. It is human-readable.
58 // This field can have at most 128 characters.
59 // +optional
60 Reason string `json:"reason,omitempty" protobuf:"bytes,7,name=reason"`
61
62 // regarding contains the object this Event is about. In most cases it's an Object reporting controller
63 // implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because
64 // it acts on some changes in a ReplicaSet object.
65 // +optional
66 Regarding corev1.ObjectReference `json:"regarding,omitempty" protobuf:"bytes,8,opt,name=regarding"`
67
68 // related is the optional secondary object for more complex actions. E.g. when regarding object triggers
69 // a creation or deletion of related object.
70 // +optional
71 Related *corev1.ObjectReference `json:"related,omitempty" protobuf:"bytes,9,opt,name=related"`
72
73 // note is a human-readable description of the status of this operation.
74 // Maximal length of the note is 1kB, but libraries should be prepared to
75 // handle values up to 64kB.
76 // +optional
77 Note string `json:"note,omitempty" protobuf:"bytes,10,opt,name=note"`
78
79 // type is the type of this event (Normal, Warning), new types could be added in the future.
80 // It is machine-readable.
81 // +optional
82 Type string `json:"type,omitempty" protobuf:"bytes,11,opt,name=type"`
83
84 // deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.
85 // +optional
86 DeprecatedSource corev1.EventSource `json:"deprecatedSource,omitempty" protobuf:"bytes,12,opt,name=deprecatedSource"`
87 // deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.
88 // +optional
89 DeprecatedFirstTimestamp metav1.Time `json:"deprecatedFirstTimestamp,omitempty" protobuf:"bytes,13,opt,name=deprecatedFirstTimestamp"`
90 // deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.
91 // +optional
92 DeprecatedLastTimestamp metav1.Time `json:"deprecatedLastTimestamp,omitempty" protobuf:"bytes,14,opt,name=deprecatedLastTimestamp"`
93 // deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type.
94 // +optional
95 DeprecatedCount int32 `json:"deprecatedCount,omitempty" protobuf:"varint,15,opt,name=deprecatedCount"`
96}
97
98// EventSeries contain information on series of events, i.e. thing that was/is happening
99// continuously for some time.
100type EventSeries struct {
101 // count is the number of occurrences in this series up to the last heartbeat time.
102 Count int32 `json:"count" protobuf:"varint,1,opt,name=count"`
103 // lastObservedTime is the time when last Event from the series was seen before last heartbeat.
104 LastObservedTime metav1.MicroTime `json:"lastObservedTime" protobuf:"bytes,2,opt,name=lastObservedTime"`
105
106 // +k8s:deprecated=state,protobuf=3
107}
108
109// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
110// +k8s:prerelease-lifecycle-gen:introduced=1.8
111// +k8s:prerelease-lifecycle-gen:deprecated=1.22
112
113// EventList is a list of Event objects.
114type EventList struct {
115 metav1.TypeMeta `json:",inline"`
116 // Standard list metadata.
117 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
118 // +optional
119 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
120
121 // items is a list of schema objects.
122 Items []Event `json:"items" protobuf:"bytes,2,rep,name=items"`
123}