@@ -71,7 +71,7 @@ func (r *PrometheusRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reque
71
71
}
72
72
73
73
// if not, check if we are supposed to manage it or not
74
- if slo == nil {
74
+ if reflect . DeepEqual ( slo , & openslov1. SLO {}) {
75
75
value , found := prometheusRule .ObjectMeta .Labels ["osko.dev/manage" ]
76
76
if ! found || value != "true" {
77
77
log .Info ("Not managing a PrometheusRule unrelated to osko" )
@@ -105,7 +105,7 @@ func (r *PrometheusRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reque
105
105
err = utils .UpdateStatus (ctx , slo , r .Client , "Ready" , metav1 .ConditionFalse , "SLI Object not found" )
106
106
if err != nil {
107
107
log .Error (err , "Failed to update SLO status" )
108
- // r.Recorder.Event(slo, "Error ", "SLIObjectNotFound", "SLI Object not found")
108
+ r .Recorder .Event (slo , "Warning " , "SLIObjectNotFound" , "SLI Object not found" )
109
109
return ctrl.Result {}, nil
110
110
}
111
111
log .Error (err , "SLO has no SLI reference" )
@@ -116,14 +116,7 @@ func (r *PrometheusRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reque
116
116
log .Info ("PrometheusRule not found. Let's make one." )
117
117
prometheusRule , err = helpers .CreatePrometheusRule (slo , sli )
118
118
if err != nil {
119
- err = utils .UpdateStatus (
120
- ctx ,
121
- slo ,
122
- r .Client ,
123
- "Ready" ,
124
- metav1 .ConditionFalse ,
125
- "Failed to create Prometheus Rule" ,
126
- )
119
+ err = utils .UpdateStatus (ctx , slo , r .Client , "Ready" , metav1 .ConditionFalse , "Failed to create Prometheus Rule" )
127
120
if err != nil {
128
121
log .Error (err , "Failed to update SLO status" )
129
122
return ctrl.Result {}, err
0 commit comments