mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-16 07:08:22 +00:00
leaderelection: populate the apiVersion/kind when reporting events
This avoids the assumption that the kinds are populated in the schema, and is arguably a little more efficient also. Kubernetes-commit: 3bf06ff3a15a2f1fefeb7a70373a92cb4b94818f
This commit is contained in:
committed by
Kubernetes Publisher
parent
e627be7959
commit
ecfd45a4d9
@@ -87,7 +87,11 @@ func (ll *LeaseLock) RecordEvent(s string) {
|
||||
return
|
||||
}
|
||||
events := fmt.Sprintf("%v %v", ll.LockConfig.Identity, s)
|
||||
ll.LockConfig.EventRecorder.Eventf(&coordinationv1.Lease{ObjectMeta: ll.lease.ObjectMeta}, corev1.EventTypeNormal, "LeaderElection", events)
|
||||
subject := &coordinationv1.Lease{ObjectMeta: ll.lease.ObjectMeta}
|
||||
// Populate the type meta, so we don't have to get it from the schema
|
||||
subject.Kind = "Lease"
|
||||
subject.APIVersion = coordinationv1.SchemeGroupVersion.String()
|
||||
ll.LockConfig.EventRecorder.Eventf(subject, corev1.EventTypeNormal, "LeaderElection", events)
|
||||
}
|
||||
|
||||
// Describe is used to convert details on current resource lock
|
||||
|
Reference in New Issue
Block a user