kubernetes does not aggregate events on my custom resource

10/14/2018

I am running OpenShift (on AWS) creating events (using operator sdk)events but events do not get aggregated. I see 30 events get created in the last 10 minutes or so. with no aggregation. The events differ in these fields (which AFAIK are legit):

  1. Name
  2. First Timestamp
  3. Last Timestamp
  4. Resource Version
  5. Creation Timestamp
  6. Metadata: Self Link, UID

This is the Go code to create the events:

eventTime := metav1.Now()

newEvent := &v1.Event{
    TypeMeta: metav1.TypeMeta{
        Kind:       "Event",
        APIVersion: "v1",
    },
    ObjectMeta: metav1.ObjectMeta{
        Name:      fmt.Sprintf("%v.%x", cr.Name, eventTime.UnixNano()),
        Namespace: cr.Namespace,
        OwnerReferences: []metav1.OwnerReference{
            asOwner(cr),
        },
    },
    InvolvedObject: v1.ObjectReference{
        Kind:      cr.TypeMeta.Kind,
        Namespace: cr.Namespace,
        Name:      cr.Name,
        UID:       cr.ObjectMeta.UID,
    },
    Reason:              string(eventReason),
    Message:             message,
    FirstTimestamp:      eventTime,
    LastTimestamp:       eventTime,
    Count:               1,
    Type:                string(eventType),
    ReportingController: reControllerName,
    Source:              v1.EventSource{Component: reControllerName},
}

err := sdk.Create(newEvent)
-- Mika R
events
kubernetes
openshift

0 Answers