@@ -57,7 +57,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
5757 // we'll ignore not-found errors, since they can't be fixed by an immediate
5858 // requeue (we'll need to wait for a new notification), and we can get them
5959 // on deleted requests.
60- return ctrl.Result {}, nil
60+ return ctrl.Result {}, err
6161 }
6262 log .Error (err , "unable to fetch Pod" )
6363 return ctrl.Result {}, err
@@ -75,7 +75,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
7575
7676 if err != nil {
7777 log .Error (err , "failed to get stats from pod" )
78- return ctrl.Result {}, nil
78+ return ctrl.Result {}, err
7979 }
8080 PodUsageData := GeneratePodRequestsObjectFromRestData (data )
8181
@@ -175,6 +175,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
175175 replica , err := r .ClientSet .AppsV1 ().ReplicaSets (pod .Namespace ).Get (ctx , pod .OwnerReferences [0 ].Name , metav1.GetOptions {})
176176 if err != nil {
177177 log .Error (err , err .Error ())
178+ return ctrl.Result {}, err
178179 }
179180
180181 ownerName = replica .OwnerReferences [0 ].Name
@@ -183,11 +184,13 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
183184 deployment , err := r .ClientSet .AppsV1 ().Deployments (pod .Namespace ).Get (ctx , ownerName , metav1.GetOptions {})
184185 if err != nil {
185186 log .Error (err , err .Error ())
187+ return ctrl.Result {}, err
186188 }
187189 UpdatePodController (deployment , Requests , ctx )
188190 return r .UpdateKubeObject (deployment , ctx )
189191 } else {
190192 log .Info ("Is Owned by Unknown CRD" )
193+ return ctrl.Result {}, nil
191194 }
192195 case "DaemonSet" :
193196 log .Info ("Is Owned by DaemonSet" )
@@ -196,6 +199,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
196199 deployment , err := r .ClientSet .AppsV1 ().DaemonSets (pod .Namespace ).Get (ctx , ownerName , metav1.GetOptions {})
197200 if err != nil {
198201 log .Error (err , err .Error ())
202+ return ctrl.Result {}, err
199203 }
200204 UpdatePodController (deployment , Requests , ctx )
201205 return r .UpdateKubeObject (deployment , ctx )
@@ -206,6 +210,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
206210 deployment , err := r .ClientSet .AppsV1 ().StatefulSets (pod .Namespace ).Get (ctx , ownerName , metav1.GetOptions {})
207211 if err != nil {
208212 log .Error (err , err .Error ())
213+ return ctrl.Result {}, err
209214 }
210215
211216 UpdatePodController (deployment , Requests , ctx )
@@ -222,5 +227,5 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
222227 }
223228 }
224229
225- return ctrl.Result {}, nil
230+ return ctrl.Result {RequeueAfter : 10 * time . Second }, nil
226231}
0 commit comments