@@ -57,7 +57,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
57
57
// we'll ignore not-found errors, since they can't be fixed by an immediate
58
58
// requeue (we'll need to wait for a new notification), and we can get them
59
59
// on deleted requests.
60
- return ctrl.Result {}, nil
60
+ return ctrl.Result {}, err
61
61
}
62
62
log .Error (err , "unable to fetch Pod" )
63
63
return ctrl.Result {}, err
@@ -75,7 +75,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
75
75
76
76
if err != nil {
77
77
log .Error (err , "failed to get stats from pod" )
78
- return ctrl.Result {}, nil
78
+ return ctrl.Result {}, err
79
79
}
80
80
PodUsageData := GeneratePodRequestsObjectFromRestData (data )
81
81
@@ -175,6 +175,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
175
175
replica , err := r .ClientSet .AppsV1 ().ReplicaSets (pod .Namespace ).Get (ctx , pod .OwnerReferences [0 ].Name , metav1.GetOptions {})
176
176
if err != nil {
177
177
log .Error (err , err .Error ())
178
+ return ctrl.Result {}, err
178
179
}
179
180
180
181
ownerName = replica .OwnerReferences [0 ].Name
@@ -183,11 +184,13 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
183
184
deployment , err := r .ClientSet .AppsV1 ().Deployments (pod .Namespace ).Get (ctx , ownerName , metav1.GetOptions {})
184
185
if err != nil {
185
186
log .Error (err , err .Error ())
187
+ return ctrl.Result {}, err
186
188
}
187
189
UpdatePodController (deployment , Requests , ctx )
188
190
return r .UpdateKubeObject (deployment , ctx )
189
191
} else {
190
192
log .Info ("Is Owned by Unknown CRD" )
193
+ return ctrl.Result {}, nil
191
194
}
192
195
case "DaemonSet" :
193
196
log .Info ("Is Owned by DaemonSet" )
@@ -196,6 +199,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
196
199
deployment , err := r .ClientSet .AppsV1 ().DaemonSets (pod .Namespace ).Get (ctx , ownerName , metav1.GetOptions {})
197
200
if err != nil {
198
201
log .Error (err , err .Error ())
202
+ return ctrl.Result {}, err
199
203
}
200
204
UpdatePodController (deployment , Requests , ctx )
201
205
return r .UpdateKubeObject (deployment , ctx )
@@ -206,6 +210,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
206
210
deployment , err := r .ClientSet .AppsV1 ().StatefulSets (pod .Namespace ).Get (ctx , ownerName , metav1.GetOptions {})
207
211
if err != nil {
208
212
log .Error (err , err .Error ())
213
+ return ctrl.Result {}, err
209
214
}
210
215
211
216
UpdatePodController (deployment , Requests , ctx )
@@ -222,5 +227,5 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
222
227
}
223
228
}
224
229
225
- return ctrl.Result {}, nil
230
+ return ctrl.Result {RequeueAfter : 10 * time . Second }, nil
226
231
}
0 commit comments