@@ -207,7 +207,7 @@ func (c *Controller) syncHandler(key string) error {
207207 klog .Info (fmt .Sprintf ("devopsproject '%s' in work queue no longer exists " , key ))
208208 return nil
209209 }
210- klog .V ( 8 ). Info (err , fmt .Sprintf ("could not get devopsproject %s " , key ))
210+ klog .ErrorS (err , fmt .Sprintf ("could not get devopsproject %s " , key ))
211211 return err
212212 }
213213 copyProject := project .DeepCopy ()
@@ -227,14 +227,14 @@ func (c *Controller) syncHandler(key string) error {
227227 if project .Status .AdminNamespace != "" {
228228 ns , err := c .namespaceLister .Get (project .Status .AdminNamespace )
229229 if err != nil && ! errors .IsNotFound (err ) {
230- klog .V ( 8 ). Info (err , "failed to get namespace" )
230+ klog .ErrorS (err , "failed to get namespace" )
231231 return err
232232 } else if errors .IsNotFound (err ) {
233233 // if admin ns is not found, clean project status, rerun reconcile
234234 copyProject .Status .AdminNamespace = ""
235235 _ , err := c .kubesphereClient .DevopsV1alpha3 ().DevOpsProjects ().Update (context .Background (), copyProject , metav1.UpdateOptions {})
236236 if err != nil {
237- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to update project %s " , key ))
237+ klog .ErrorS (err , fmt .Sprintf ("failed to update project %s " , key ))
238238 return err
239239 }
240240 c .enqueueDevOpsProject (key )
@@ -250,7 +250,7 @@ func (c *Controller) syncHandler(key string) error {
250250 copyNs .Labels [constants .DevOpsProjectLabelKey ] = project .Name
251251 _ , err = c .client .CoreV1 ().Namespaces ().Update (context .Background (), copyNs , metav1.UpdateOptions {})
252252 if err != nil {
253- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to update ns %s " , key ))
253+ klog .ErrorS (err , fmt .Sprintf ("failed to update ns %s " , key ))
254254 return err
255255 }
256256 }
@@ -260,7 +260,7 @@ func (c *Controller) syncHandler(key string) error {
260260 namespaces , err := c .namespaceLister .List (
261261 labels .SelectorFromSet (labels.Set {constants .DevOpsProjectLabelKey : project .Name }))
262262 if err != nil {
263- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to list ns %s " , key ))
263+ klog .ErrorS (err , fmt .Sprintf ("failed to list ns %s " , key ))
264264 return err
265265 }
266266 // if there is no ns, generate new one
@@ -274,7 +274,7 @@ func (c *Controller) syncHandler(key string) error {
274274 c .eventRecorder .Event (project , v1 .EventTypeWarning , "CreateAdminNamespaceFailed" , err .Error ())
275275 return err
276276 }
277- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to create ns %s " , key ))
277+ klog .ErrorS (err , fmt .Sprintf ("failed to create ns %s " , key ))
278278 return err
279279 }
280280 copyProject .Status .AdminNamespace = ns .Name
@@ -285,7 +285,7 @@ func (c *Controller) syncHandler(key string) error {
285285 copyNs .Labels [constants .DevOpsProjectLabelKey ] = project .Name
286286 _ , err = c .client .CoreV1 ().Namespaces ().Update (context .Background (), copyNs , metav1.UpdateOptions {})
287287 if err != nil {
288- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to update ns %s " , key ))
288+ klog .ErrorS (err , fmt .Sprintf ("failed to update ns %s " , key ))
289289 return err
290290 }
291291 }
@@ -304,7 +304,7 @@ func (c *Controller) syncHandler(key string) error {
304304 if err != nil {
305305 _ , err := c .devopsClient .CreateDevOpsProject (copyProject .Status .AdminNamespace )
306306 if err != nil {
307- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to get project %s " , key ))
307+ klog .ErrorS (err , fmt .Sprintf ("failed to get project %s " , key ))
308308 return err
309309 }
310310 }
@@ -317,7 +317,7 @@ func (c *Controller) syncHandler(key string) error {
317317 if ! reflect .DeepEqual (copyProject , project ) {
318318 _ , err = c .kubesphereClient .DevopsV1alpha3 ().DevOpsProjects ().Update (context .Background (), copyProject , metav1.UpdateOptions {})
319319 if err != nil {
320- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to update ns %s " , key ))
320+ klog .ErrorS (err , fmt .Sprintf ("failed to update ns %s " , key ))
321321 return err
322322 }
323323 }
@@ -336,7 +336,7 @@ func (c *Controller) syncHandler(key string) error {
336336 klog .Error (fmt .Sprintf ("unexpected error type: %v, should be *restful.ServiceError" , err ))
337337 }
338338
339- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to delete resource %s in devops" , key ))
339+ klog .ErrorS (err , fmt .Sprintf ("failed to delete resource %s in devops" , key ))
340340 } else {
341341 delSuccess = true
342342 }
@@ -353,7 +353,7 @@ func (c *Controller) syncHandler(key string) error {
353353
354354 _ , err = c .kubesphereClient .DevopsV1alpha3 ().DevOpsProjects ().Update (context .Background (), project , metav1.UpdateOptions {})
355355 if err != nil {
356- klog .V ( 8 ). Info (err , fmt .Sprintf ("failed to update project %s " , key ))
356+ klog .ErrorS (err , fmt .Sprintf ("failed to update project %s " , key ))
357357 return err
358358 }
359359 }
0 commit comments