Zack Williams | e940c7a | 2019-08-21 14:25:39 -0700 | [diff] [blame] | 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 | |
| 27 | // Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. |
| 28 | type Event struct { |
| 29 | metav1.TypeMeta `json:",inline"` |
| 30 | // +optional |
| 31 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 32 | |
| 33 | // Required. Time when this Event was first observed. |
| 34 | EventTime metav1.MicroTime `json:"eventTime" protobuf:"bytes,2,opt,name=eventTime"` |
| 35 | |
| 36 | // Data about the Event series this event represents or nil if it's a singleton Event. |
| 37 | // +optional |
| 38 | Series *EventSeries `json:"series,omitempty" protobuf:"bytes,3,opt,name=series"` |
| 39 | |
| 40 | // Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. |
| 41 | // +optional |
| 42 | ReportingController string `json:"reportingController,omitempty" protobuf:"bytes,4,opt,name=reportingController"` |
| 43 | |
| 44 | // ID of the controller instance, e.g. `kubelet-xyzf`. |
| 45 | // +optional |
| 46 | ReportingInstance string `json:"reportingInstance,omitemtpy" protobuf:"bytes,5,opt,name=reportingInstance"` |
| 47 | |
| 48 | // What action was taken/failed regarding to the regarding object. |
| 49 | // +optional |
| 50 | Action string `json:"action,omitemtpy" protobuf:"bytes,6,name=action"` |
| 51 | |
| 52 | // Why the action was taken. |
| 53 | Reason string `json:"reason,omitempty" protobuf:"bytes,7,name=reason"` |
| 54 | |
| 55 | // The object this Event is about. In most cases it's an Object reporting controller implements. |
| 56 | // E.g. ReplicaSetController implements ReplicaSets and this event is emitted because |
| 57 | // it acts on some changes in a ReplicaSet object. |
| 58 | // +optional |
| 59 | Regarding corev1.ObjectReference `json:"regarding,omitempty" protobuf:"bytes,8,opt,name=regarding"` |
| 60 | |
| 61 | // Optional secondary object for more complex actions. E.g. when regarding object triggers |
| 62 | // a creation or deletion of related object. |
| 63 | // +optional |
| 64 | Related *corev1.ObjectReference `json:"related,omitempty" protobuf:"bytes,9,opt,name=related"` |
| 65 | |
| 66 | // Optional. A human-readable description of the status of this operation. |
| 67 | // Maximal length of the note is 1kB, but libraries should be prepared to |
| 68 | // handle values up to 64kB. |
| 69 | // +optional |
| 70 | Note string `json:"note,omitempty" protobuf:"bytes,10,opt,name=note"` |
| 71 | |
| 72 | // Type of this event (Normal, Warning), new types could be added in the |
| 73 | // future. |
| 74 | // +optional |
| 75 | Type string `json:"type,omitempty" protobuf:"bytes,11,opt,name=type"` |
| 76 | |
| 77 | // Deprecated field assuring backward compatibility with core.v1 Event type |
| 78 | // +optional |
| 79 | DeprecatedSource corev1.EventSource `json:"deprecatedSource,omitempty" protobuf:"bytes,12,opt,name=deprecatedSource"` |
| 80 | // Deprecated field assuring backward compatibility with core.v1 Event type |
| 81 | // +optional |
| 82 | DeprecatedFirstTimestamp metav1.Time `json:"deprecatedFirstTimestamp,omitempty" protobuf:"bytes,13,opt,name=deprecatedFirstTimestamp"` |
| 83 | // Deprecated field assuring backward compatibility with core.v1 Event type |
| 84 | // +optional |
| 85 | DeprecatedLastTimestamp metav1.Time `json:"deprecatedLastTimestamp,omitempty" protobuf:"bytes,14,opt,name=deprecatedLastTimestamp"` |
| 86 | // Deprecated field assuring backward compatibility with core.v1 Event type |
| 87 | // +optional |
| 88 | DeprecatedCount int32 `json:"deprecatedCount,omitempty" protobuf:"varint,15,opt,name=deprecatedCount"` |
| 89 | } |
| 90 | |
| 91 | // EventSeries contain information on series of events, i.e. thing that was/is happening |
| 92 | // continuously for some time. |
| 93 | type EventSeries struct { |
| 94 | // Number of occurrences in this series up to the last heartbeat time |
| 95 | Count int32 `json:"count" protobuf:"varint,1,opt,name=count"` |
| 96 | // Time when last Event from the series was seen before last heartbeat. |
| 97 | LastObservedTime metav1.MicroTime `json:"lastObservedTime" protobuf:"bytes,2,opt,name=lastObservedTime"` |
| 98 | // Information whether this series is ongoing or finished. |
| 99 | // Deprecated. Planned removal for 1.18 |
| 100 | State EventSeriesState `json:"state" protobuf:"bytes,3,opt,name=state"` |
| 101 | } |
| 102 | |
| 103 | type EventSeriesState string |
| 104 | |
| 105 | const ( |
| 106 | EventSeriesStateOngoing EventSeriesState = "Ongoing" |
| 107 | EventSeriesStateFinished EventSeriesState = "Finished" |
| 108 | EventSeriesStateUnknown EventSeriesState = "Unknown" |
| 109 | ) |
| 110 | |
| 111 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 112 | |
| 113 | // EventList is a list of Event objects. |
| 114 | type EventList struct { |
| 115 | metav1.TypeMeta `json:",inline"` |
| 116 | // Standard list metadata. |
| 117 | // More info: https://git.k8s.io/community/contributors/devel/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 | } |