...

Source file src/k8s.io/api/events/v1/types.go

Documentation: k8s.io/api/events/v1

     1  /*
     2  Copyright 2020 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 v1
    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  // Events have a limited retention time and triggers and messages may evolve
    29  // with time.  Event consumers should not rely on the timing of an event
    30  // with a given Reason reflecting a consistent underlying trigger, or the
    31  // continued existence of events with that Reason.  Events should be
    32  // treated as informative, best-effort, supplemental data.
    33  type Event struct {
    34  	metav1.TypeMeta `json:",inline"`
    35  
    36  	// Standard object's metadata.
    37  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    38  	// +optional
    39  	metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
    40  
    41  	// eventTime is the time when this Event was first observed. It is required.
    42  	EventTime metav1.MicroTime `json:"eventTime" protobuf:"bytes,2,opt,name=eventTime"`
    43  
    44  	// series is data about the Event series this event represents or nil if it's a singleton Event.
    45  	// +optional
    46  	Series *EventSeries `json:"series,omitempty" protobuf:"bytes,3,opt,name=series"`
    47  
    48  	// reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.
    49  	// This field cannot be empty for new Events.
    50  	ReportingController string `json:"reportingController,omitempty" protobuf:"bytes,4,opt,name=reportingController"`
    51  
    52  	// reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`.
    53  	// This field cannot be empty for new Events and it can have at most 128 characters.
    54  	ReportingInstance string `json:"reportingInstance,omitempty" protobuf:"bytes,5,opt,name=reportingInstance"`
    55  
    56  	// action is what action was taken/failed regarding to the regarding object. It is machine-readable.
    57  	// This field cannot be empty for new Events and it can have at most 128 characters.
    58  	Action string `json:"action,omitempty" protobuf:"bytes,6,name=action"`
    59  
    60  	// reason is why the action was taken. It is human-readable.
    61  	// This field cannot be empty for new Events and it can have at most 128 characters.
    62  	Reason string `json:"reason,omitempty" protobuf:"bytes,7,name=reason"`
    63  
    64  	// regarding contains the object this Event is about. In most cases it's an Object reporting controller
    65  	// implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because
    66  	// it acts on some changes in a ReplicaSet object.
    67  	// +optional
    68  	Regarding corev1.ObjectReference `json:"regarding,omitempty" protobuf:"bytes,8,opt,name=regarding"`
    69  
    70  	// related is the optional secondary object for more complex actions. E.g. when regarding object triggers
    71  	// a creation or deletion of related object.
    72  	// +optional
    73  	Related *corev1.ObjectReference `json:"related,omitempty" protobuf:"bytes,9,opt,name=related"`
    74  
    75  	// note is a human-readable description of the status of this operation.
    76  	// Maximal length of the note is 1kB, but libraries should be prepared to
    77  	// handle values up to 64kB.
    78  	// +optional
    79  	Note string `json:"note,omitempty" protobuf:"bytes,10,opt,name=note"`
    80  
    81  	// type is the type of this event (Normal, Warning), new types could be added in the future.
    82  	// It is machine-readable.
    83  	// This field cannot be empty for new Events.
    84  	Type string `json:"type,omitempty" protobuf:"bytes,11,opt,name=type"`
    85  
    86  	// deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.
    87  	// +optional
    88  	DeprecatedSource corev1.EventSource `json:"deprecatedSource,omitempty" protobuf:"bytes,12,opt,name=deprecatedSource"`
    89  	// deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.
    90  	// +optional
    91  	DeprecatedFirstTimestamp metav1.Time `json:"deprecatedFirstTimestamp,omitempty" protobuf:"bytes,13,opt,name=deprecatedFirstTimestamp"`
    92  	// deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.
    93  	// +optional
    94  	DeprecatedLastTimestamp metav1.Time `json:"deprecatedLastTimestamp,omitempty" protobuf:"bytes,14,opt,name=deprecatedLastTimestamp"`
    95  	// deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type.
    96  	// +optional
    97  	DeprecatedCount int32 `json:"deprecatedCount,omitempty" protobuf:"varint,15,opt,name=deprecatedCount"`
    98  }
    99  
   100  // EventSeries contain information on series of events, i.e. thing that was/is happening
   101  // continuously for some time. How often to update the EventSeries is up to the event reporters.
   102  // The default event reporter in "k8s.io/client-go/tools/events/event_broadcaster.go" shows
   103  // how this struct is updated on heartbeats and can guide customized reporter implementations.
   104  type EventSeries struct {
   105  	// count is the number of occurrences in this series up to the last heartbeat time.
   106  	Count int32 `json:"count" protobuf:"varint,1,opt,name=count"`
   107  	// lastObservedTime is the time when last Event from the series was seen before last heartbeat.
   108  	LastObservedTime metav1.MicroTime `json:"lastObservedTime" protobuf:"bytes,2,opt,name=lastObservedTime"`
   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/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  }
   124  

View as plain text