Skip to content

Commit

Permalink
Add a random suffix to the helper pod's name
Browse files Browse the repository at this point in the history
To fix the race condition caused by reusing the helper pod name.

#154

Signed-off-by: Sheng Yang <[email protected]>
  • Loading branch information
yasker committed Nov 12, 2020
1 parent 9bd5f48 commit 248707e
Show file tree
Hide file tree
Showing 11 changed files with 801 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/miekg/dns v1.1.27 // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v1.1.0 // indirect
github.com/satori/go.uuid v1.2.0
github.com/urfave/cli v1.19.1
golang.org/x/sys v0.0.0-20190926180325-855e68c8590b // indirect
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff h1:VARhShG49tiji6mdRNp7JTNDtJ0FhuprF93GBQ37xGU=
Expand Down
4 changes: 4 additions & 0 deletions provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/Sirupsen/logrus"
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
v1 "k8s.io/api/core/v1"
k8serror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -386,6 +387,9 @@ func (p *LocalPathProvisioner) createHelperPod(action ActionType, cmdsForPath []
}
helperPod := p.helperPod.DeepCopy()

// use different name for helper pods
// https://github.com/rancher/local-path-provisioner/issues/154
helperPod.Name = helperPod.Name + "-" + uuid.NewV4().String()[:8]
helperPod.Namespace = p.namespace
helperPod.Spec.NodeName = node
helperPod.Spec.ServiceAccountName = p.serviceAccountName
Expand Down
23 changes: 23 additions & 0 deletions vendor/github.com/satori/go.uuid/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/satori/go.uuid/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions vendor/github.com/satori/go.uuid/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

206 changes: 206 additions & 0 deletions vendor/github.com/satori/go.uuid/codec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 248707e

Please sign in to comment.