mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #75964 from humblec/more-lnt
Remove some unwanted code blocks in controller_utils.go
This commit is contained in:
commit
f3de278f18
@ -160,11 +160,11 @@ type ControllerExpectations struct {
|
|||||||
|
|
||||||
// GetExpectations returns the ControlleeExpectations of the given controller.
|
// GetExpectations returns the ControlleeExpectations of the given controller.
|
||||||
func (r *ControllerExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error) {
|
func (r *ControllerExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error) {
|
||||||
if exp, exists, err := r.GetByKey(controllerKey); err == nil && exists {
|
exp, exists, err := r.GetByKey(controllerKey)
|
||||||
|
if err == nil && exists {
|
||||||
return exp.(*ControlleeExpectations), true, nil
|
return exp.(*ControlleeExpectations), true, nil
|
||||||
} else {
|
|
||||||
return nil, false, err
|
|
||||||
}
|
}
|
||||||
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteExpectations deletes the expectations of the given controller from the TTLStore.
|
// DeleteExpectations deletes the expectations of the given controller from the TTLStore.
|
||||||
@ -576,10 +576,11 @@ func (r RealPodControl) createPods(nodeName, namespace string, template *v1.PodT
|
|||||||
if labels.Set(pod.Labels).AsSelectorPreValidated().Empty() {
|
if labels.Set(pod.Labels).AsSelectorPreValidated().Empty() {
|
||||||
return fmt.Errorf("unable to create pods, no labels")
|
return fmt.Errorf("unable to create pods, no labels")
|
||||||
}
|
}
|
||||||
if newPod, err := r.KubeClient.CoreV1().Pods(namespace).Create(pod); err != nil {
|
newPod, err := r.KubeClient.CoreV1().Pods(namespace).Create(pod)
|
||||||
|
if err != nil {
|
||||||
r.Recorder.Eventf(object, v1.EventTypeWarning, FailedCreatePodReason, "Error creating: %v", err)
|
r.Recorder.Eventf(object, v1.EventTypeWarning, FailedCreatePodReason, "Error creating: %v", err)
|
||||||
return err
|
return err
|
||||||
} else {
|
}
|
||||||
accessor, err := meta.Accessor(object)
|
accessor, err := meta.Accessor(object)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("parentObject does not have ObjectMeta, %v", err)
|
klog.Errorf("parentObject does not have ObjectMeta, %v", err)
|
||||||
@ -587,7 +588,7 @@ func (r RealPodControl) createPods(nodeName, namespace string, template *v1.PodT
|
|||||||
}
|
}
|
||||||
klog.V(4).Infof("Controller %v created pod %v", accessor.GetName(), newPod.Name)
|
klog.V(4).Infof("Controller %v created pod %v", accessor.GetName(), newPod.Name)
|
||||||
r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulCreatePodReason, "Created pod: %v", newPod.Name)
|
r.Recorder.Eventf(object, v1.EventTypeNormal, SuccessfulCreatePodReason, "Created pod: %v", newPod.Name)
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user