@@ -59,7 +59,7 @@ import (
5959 "github.com/fluxcd/pkg/runtime/logger"
6060 "github.com/fluxcd/pkg/runtime/metrics"
6161 "github.com/fluxcd/pkg/runtime/predicates"
62- sourcev1 "github.com/fluxcd/source-controller/api/v1beta1 "
62+ sourcev1 "github.com/fluxcd/source-controller/api/v1beta2 "
6363 "github.com/fluxcd/source-controller/pkg/git"
6464 gitlibgit2 "github.com/fluxcd/source-controller/pkg/git/libgit2"
6565 gitstrat "github.com/fluxcd/source-controller/pkg/git/strategy"
@@ -86,11 +86,10 @@ type TemplateData struct {
8686// ImageUpdateAutomationReconciler reconciles a ImageUpdateAutomation object
8787type ImageUpdateAutomationReconciler struct {
8888 client.Client
89- Scheme * runtime.Scheme
90- EventRecorder kuberecorder.EventRecorder
91- ExternalEventRecorder * events.Recorder
92- MetricsRecorder * metrics.Recorder
93- NoCrossNamespaceRef bool
89+ Scheme * runtime.Scheme
90+ EventRecorder kuberecorder.EventRecorder
91+ MetricsRecorder * metrics.Recorder
92+ NoCrossNamespaceRef bool
9493}
9594
9695type ImageUpdateAutomationReconcilerOptions struct {
@@ -149,7 +148,7 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
149148 // failWithError is a helper for bailing on the reconciliation.
150149 failWithError := func (err error ) (ctrl.Result , error ) {
151150 r .event (ctx , auto , events .EventSeverityError , err .Error ())
152- imagev1 .SetImageUpdateAutomationReadiness (& auto , metav1 .ConditionFalse , meta .ReconciliationFailedReason , err .Error ())
151+ imagev1 .SetImageUpdateAutomationReadiness (& auto , metav1 .ConditionFalse , imagev1 .ReconciliationFailedReason , err .Error ())
153152 if err := r .patchStatus (ctx , req , auto .Status ); err != nil {
154153 log .Error (err , "failed to reconcile" )
155154 }
@@ -366,7 +365,7 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
366365
367366 // Getting to here is a successful run.
368367 auto .Status .LastAutomationRunTime = & metav1.Time {Time : now }
369- imagev1 .SetImageUpdateAutomationReadiness (& auto , metav1 .ConditionTrue , meta .ReconciliationSucceededReason , statusMessage )
368+ imagev1 .SetImageUpdateAutomationReadiness (& auto , metav1 .ConditionTrue , imagev1 .ReconciliationSucceededReason , statusMessage )
370369 if err := r .patchStatus (ctx , req , auto .Status ); err != nil {
371370 return ctrl.Result {Requeue : true }, err
372371 }
@@ -826,21 +825,11 @@ func libgit2PushError(err error) error {
826825// --- events, metrics
827826
828827func (r * ImageUpdateAutomationReconciler ) event (ctx context.Context , auto imagev1.ImageUpdateAutomation , severity , msg string ) {
829- if r .EventRecorder != nil {
830- r .EventRecorder .Event (& auto , "Normal" , severity , msg )
831- }
832- if r .ExternalEventRecorder != nil {
833- objRef , err := reference .GetReference (r .Scheme , & auto )
834- if err != nil {
835- ctrl .LoggerFrom (ctx ).Error (err , "unable to send event" )
836- return
837- }
838-
839- if err := r .ExternalEventRecorder .Eventf (* objRef , nil , severity , severity , msg ); err != nil {
840- ctrl .LoggerFrom (ctx ).Error (err , "unable to send event" )
841- return
842- }
828+ eventtype := "Normal"
829+ if severity == events .EventSeverityError {
830+ eventtype = "Warning"
843831 }
832+ r .EventRecorder .Eventf (& auto , eventtype , severity , msg )
844833}
845834
846835func (r * ImageUpdateAutomationReconciler ) recordReadinessMetric (ctx context.Context , auto * imagev1.ImageUpdateAutomation ) {
0 commit comments