Skip to content

Commit

Permalink
fix event start bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shaowenchen committed Dec 23, 2024
1 parent e7bd6ca commit 2d94a46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controllers/event_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ func (r *EventReconciler) SetupWithManager(mgr ctrl.Manager) error {
})
}
if !isEventsV1Available(r.Client) {
println("events.k8s.io/v1 is not available, use core/v1.Event instead")
return ctrl.NewControllerManagedBy(mgr).For(&corev1.Event{}).Complete(r)
}
println("events.k8s.io/v1 is available")
return ctrl.NewControllerManagedBy(mgr).
For(&eventsv1.Event{}).
Watches(
Expand Down Expand Up @@ -127,7 +129,7 @@ func isEventsV1Available(c client.Client) bool {
if group.Name == "events.k8s.io" {
for _, version := range group.Versions {
if version.Version == "v1" {
return false
return true
}
}
}
Expand Down

0 comments on commit 2d94a46

Please sign in to comment.