Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Local Path Provisioner
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Local Path Provisioner
Commits
197851d9
Commit
197851d9
authored
1 month ago
by
Le Quoc Tuan
Committed by
Derek Su
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: multiple paths is not true random (fix #342)
parent
8219f6cd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
provisioner.go
+8
-4
8 additions, 4 deletions
provisioner.go
with
8 additions
and
4 deletions
provisioner.go
+
8
−
4
View file @
197851d9
...
...
@@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"io"
"math/rand/v2"
"os"
"path/filepath"
"reflect"
...
...
@@ -251,11 +252,14 @@ func (p *LocalPathProvisioner) getPathOnNode(node string, requestedPath string,
return
requestedPath
,
nil
}
// if no particular path was requested, choose a random one
path
:=
""
for
path
=
range
paths
{
break
i
:=
rand
.
IntN
(
len
(
paths
))
for
p
:=
range
paths
{
if
i
==
0
{
return
p
,
nil
}
i
--
}
return
path
,
nil
return
""
,
fmt
.
Errorf
(
"never happens, but compiler doesn't know that"
)
}
func
(
p
*
LocalPathProvisioner
)
isSharedFilesystem
(
c
*
StorageClassConfig
)
(
bool
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment