Support TTL in genericetcd#Update

This commit is contained in:
Clayton Coleman
2015-03-04 18:22:48 -05:00
parent 9df2ea4aef
commit 143015025a
5 changed files with 49 additions and 34 deletions

View File

@@ -160,18 +160,18 @@ func (r *BindingREST) setPodHostTo(ctx api.Context, podID, oldMachine, machine s
if err != nil {
return nil, err
}
err = r.store.Helper.AtomicUpdate(podKey, &api.Pod{}, false, func(obj runtime.Object) (runtime.Object, error) {
err = r.store.Helper.AtomicUpdate(podKey, &api.Pod{}, false, func(obj runtime.Object) (runtime.Object, uint64, error) {
pod, ok := obj.(*api.Pod)
if !ok {
return nil, fmt.Errorf("unexpected object: %#v", obj)
return nil, 0, fmt.Errorf("unexpected object: %#v", obj)
}
if pod.Spec.Host != oldMachine || pod.Status.Host != oldMachine {
return nil, fmt.Errorf("pod %v is already assigned to host %q or %q", pod.Name, pod.Spec.Host, pod.Status.Host)
return nil, 0, fmt.Errorf("pod %v is already assigned to host %q or %q", pod.Name, pod.Spec.Host, pod.Status.Host)
}
pod.Spec.Host = machine
pod.Status.Host = machine
finalPod = pod
return pod, nil
return pod, 0, nil
})
return finalPod, err
}