mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #106399 from justinsb/populate_event_typemetad
leaderelection: populate the apiVersion/kind when reporting events
This commit is contained in:
		@@ -107,7 +107,11 @@ func (cml *ConfigMapLock) RecordEvent(s string) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	events := fmt.Sprintf("%v %v", cml.LockConfig.Identity, s)
 | 
						events := fmt.Sprintf("%v %v", cml.LockConfig.Identity, s)
 | 
				
			||||||
	cml.LockConfig.EventRecorder.Eventf(&v1.ConfigMap{ObjectMeta: cml.cm.ObjectMeta}, v1.EventTypeNormal, "LeaderElection", events)
 | 
						subject := &v1.ConfigMap{ObjectMeta: cml.cm.ObjectMeta}
 | 
				
			||||||
 | 
						// Populate the type meta, so we don't have to get it from the schema
 | 
				
			||||||
 | 
						subject.Kind = "ConfigMap"
 | 
				
			||||||
 | 
						subject.APIVersion = v1.SchemeGroupVersion.String()
 | 
				
			||||||
 | 
						cml.LockConfig.EventRecorder.Eventf(subject, v1.EventTypeNormal, "LeaderElection", events)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Describe is used to convert details on current resource lock
 | 
					// Describe is used to convert details on current resource lock
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,7 +102,11 @@ func (el *EndpointsLock) RecordEvent(s string) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	events := fmt.Sprintf("%v %v", el.LockConfig.Identity, s)
 | 
						events := fmt.Sprintf("%v %v", el.LockConfig.Identity, s)
 | 
				
			||||||
	el.LockConfig.EventRecorder.Eventf(&v1.Endpoints{ObjectMeta: el.e.ObjectMeta}, v1.EventTypeNormal, "LeaderElection", events)
 | 
						subject := &v1.Endpoints{ObjectMeta: el.e.ObjectMeta}
 | 
				
			||||||
 | 
						// Populate the type meta, so we don't have to get it from the schema
 | 
				
			||||||
 | 
						subject.Kind = "Endpoints"
 | 
				
			||||||
 | 
						subject.APIVersion = v1.SchemeGroupVersion.String()
 | 
				
			||||||
 | 
						el.LockConfig.EventRecorder.Eventf(subject, v1.EventTypeNormal, "LeaderElection", events)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Describe is used to convert details on current resource lock
 | 
					// Describe is used to convert details on current resource lock
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,7 +87,11 @@ func (ll *LeaseLock) RecordEvent(s string) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	events := fmt.Sprintf("%v %v", ll.LockConfig.Identity, s)
 | 
						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
 | 
					// Describe is used to convert details on current resource lock
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user