@@ -31,6 +31,7 @@ import (
31
31
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32
32
"k8s.io/apimachinery/pkg/fields"
33
33
"k8s.io/apimachinery/pkg/runtime"
34
+ "k8s.io/client-go/tools/record"
34
35
ctrl "sigs.k8s.io/controller-runtime"
35
36
"sigs.k8s.io/controller-runtime/pkg/builder"
36
37
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -44,12 +45,14 @@ var IngressAnnotationPrefix = "uptime-robot.clevyr.com/"
44
45
// IngressReconciler reconciles a Ingress object
45
46
type IngressReconciler struct {
46
47
client.Client
47
- Scheme * runtime.Scheme
48
+ Scheme * runtime.Scheme
49
+ Recorder record.EventRecorder
48
50
}
49
51
50
52
//+kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch;create;update;patch;delete
51
53
//+kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses/status,verbs=get;update;patch
52
54
//+kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses/finalizers,verbs=update
55
+ //+kubebuilder:rbac:groups=core,resources=events,verbs=create;patch
53
56
54
57
// Reconcile is part of the main kubernetes reconciliation loop which aims to
55
58
// move the current state of the cluster closer to the desired state.
@@ -132,6 +135,7 @@ func (r *IngressReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
132
135
133
136
for _ , monitor := range list .Items {
134
137
if err := r .updateValues (ingress , & monitor , annotations ); err != nil {
138
+ r .Recorder .Event (ingress , "Warning" , "Sync" , err .Error ())
135
139
return ctrl.Result {}, err
136
140
}
137
141
0 commit comments