Fix recycler pod deletion race.

We should use clone of recycler pod template instead of reusing the same
one for two or more recyclers running in parallel.

Also add some logs to relevant places to spot the error easily next time.
This commit is contained in:
Jan Safranek
2016-11-15 17:22:32 +01:00
parent 5c21cc892c
commit 76755034a1
5 changed files with 21 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ import (
"regexp"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/uuid"
"k8s.io/kubernetes/pkg/volume"
@@ -244,7 +245,11 @@ func (r *hostPathRecycler) GetPath() string {
// Recycle blocks until the pod has completed or any error occurs.
// HostPath recycling only works in single node clusters and is meant for testing purposes only.
func (r *hostPathRecycler) Recycle() error {
pod := r.config.RecyclerPodTemplate
templateClone, err := conversion.NewCloner().DeepCopy(r.config.RecyclerPodTemplate)
if err != nil {
return err
}
pod := templateClone.(*api.Pod)
// overrides
pod.Spec.ActiveDeadlineSeconds = &r.timeout
pod.Spec.Volumes[0].VolumeSource = api.VolumeSource{