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