@@ -160,11 +160,11 @@ type ControllerExpectations struct {
160
160
161
161
// GetExpectations returns the ControlleeExpectations of the given controller.
162
162
func (r * ControllerExpectations ) GetExpectations (controllerKey string ) (* ControlleeExpectations , bool , error ) {
163
- if exp , exists , err := r .GetByKey (controllerKey ); err == nil && exists {
163
+ exp , exists , err := r .GetByKey (controllerKey )
164
+ if err == nil && exists {
164
165
return exp .(* ControlleeExpectations ), true , nil
165
- } else {
166
- return nil , false , err
167
166
}
167
+ return nil , false , err
168
168
}
169
169
170
170
// DeleteExpectations deletes the expectations of the given controller from the TTLStore.
@@ -576,18 +576,19 @@ func (r RealPodControl) createPods(nodeName, namespace string, template *v1.PodT
576
576
if labels .Set (pod .Labels ).AsSelectorPreValidated ().Empty () {
577
577
return fmt .Errorf ("unable to create pods, no labels" )
578
578
}
579
- if newPod , err := r .KubeClient .CoreV1 ().Pods (namespace ).Create (pod ); err != nil {
579
+ newPod , err := r .KubeClient .CoreV1 ().Pods (namespace ).Create (pod )
580
+ if err != nil {
580
581
r .Recorder .Eventf (object , v1 .EventTypeWarning , FailedCreatePodReason , "Error creating: %v" , err )
581
582
return err
582
- } else {
583
- accessor , err := meta .Accessor (object )
584
- if err != nil {
585
- klog .Errorf ("parentObject does not have ObjectMeta, %v" , err )
586
- return nil
587
- }
588
- klog .V (4 ).Infof ("Controller %v created pod %v" , accessor .GetName (), newPod .Name )
589
- r .Recorder .Eventf (object , v1 .EventTypeNormal , SuccessfulCreatePodReason , "Created pod: %v" , newPod .Name )
590
583
}
584
+ accessor , err := meta .Accessor (object )
585
+ if err != nil {
586
+ klog .Errorf ("parentObject does not have ObjectMeta, %v" , err )
587
+ return nil
588
+ }
589
+ klog .V (4 ).Infof ("Controller %v created pod %v" , accessor .GetName (), newPod .Name )
590
+ r .Recorder .Eventf (object , v1 .EventTypeNormal , SuccessfulCreatePodReason , "Created pod: %v" , newPod .Name )
591
+
591
592
return nil
592
593
}
593
594
0 commit comments