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
a20bd9c9
Commit
a20bd9c9
authored
Mar 16, 2023
by
Jeremy Scott
Committed by
Derek Su
Mar 22, 2023
Browse files
Options
Downloads
Patches
Plain Diff
Return error if unknown volume type given
parent
6c5a419e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
provisioner.go
+12
-11
12 additions, 11 deletions
provisioner.go
with
12 additions
and
11 deletions
provisioner.go
+
12
−
11
View file @
a20bd9c9
...
...
@@ -292,7 +292,10 @@ func (p *LocalPathProvisioner) Provision(ctx context.Context, opts pvController.
}
else
{
volumeType
=
defaultVolumeType
}
pvs
=
createPersistentVolumeSource
(
volumeType
,
path
)
pvs
,
err
=
createPersistentVolumeSource
(
volumeType
,
path
)
if
err
!=
nil
{
return
nil
,
pvController
.
ProvisioningFinished
,
err
}
var
nodeAffinity
*
v1
.
VolumeNodeAffinity
if
sharedFS
{
...
...
@@ -652,8 +655,11 @@ func canonicalizeConfig(data *ConfigData) (cfg *Config, err error) {
return
cfg
,
nil
}
func
createPersistentVolumeSource
(
volumeType
string
,
path
string
)
v1
.
PersistentVolumeSource
{
var
pvs
v1
.
PersistentVolumeSource
func
createPersistentVolumeSource
(
volumeType
string
,
path
string
)
(
pvs
v1
.
PersistentVolumeSource
,
err
error
)
{
defer
func
()
{
err
=
errors
.
Wrapf
(
err
,
"failed to create persistent volume source"
)
}()
switch
strings
.
ToLower
(
volumeType
)
{
case
"local"
:
pvs
=
v1
.
PersistentVolumeSource
{
...
...
@@ -670,13 +676,8 @@ func createPersistentVolumeSource(volumeType string, path string) v1.PersistentV
},
}
default
:
hostPathType
:=
v1
.
HostPathDirectoryOrCreate
pvs
=
v1
.
PersistentVolumeSource
{
HostPath
:
&
v1
.
HostPathVolumeSource
{
Path
:
path
,
Type
:
&
hostPathType
,
},
}
return
pvs
,
fmt
.
Errorf
(
"
\"
%s
\"
is not a recognised volume type"
,
volumeType
)
}
return
pvs
return
pvs
,
nil
}
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