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
275c6b35
Commit
275c6b35
authored
Mar 16, 2023
by
Jeremy Scott
Committed by
Derek Su
Mar 22, 2023
Browse files
Options
Downloads
Patches
Plain Diff
Refactor volume type provisioning
parent
50819747
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
+9
-8
9 additions, 8 deletions
provisioner.go
with
9 additions
and
8 deletions
provisioner.go
+
9
−
8
View file @
275c6b35
...
...
@@ -282,16 +282,17 @@ func (p *LocalPathProvisioner) Provision(ctx context.Context, opts pvController.
fs
:=
v1
.
PersistentVolumeFilesystem
var
pvs
v1
.
PersistentVolumeSource
if
pvcVal
,
ok
:=
opts
.
PVC
.
GetAnnotations
()[
"volumeType"
];
ok
{
// volume type specified in PVC
pvs
=
createPersistentVolumeSource
(
pvcVal
,
path
)
}
else
if
scVal
,
ok
:=
opts
.
StorageClass
.
GetAnnotations
()[
"defaultVolumeType"
];
ok
{
// default volume type provided for storage class
pvs
=
createPersistentVolumeSource
(
scVal
,
path
)
defaultVolumeType
:=
"hostPath"
if
dVal
,
ok
:=
opts
.
StorageClass
.
GetAnnotations
()[
"defaultVolumeType"
];
ok
{
defaultVolumeType
=
dVal
}
var
volumeType
string
if
val
,
ok
:=
opts
.
PVC
.
GetAnnotations
()[
"volumeType"
];
ok
{
volumeType
=
val
}
else
{
// volume type unspecified, we default to hostPath
pvs
=
createPersistentVolumeSource
(
"hostPath"
,
path
)
volumeType
=
defaultVolumeType
}
pvs
=
createPersistentVolumeSource
(
volumeType
,
path
)
var
nodeAffinity
*
v1
.
VolumeNodeAffinity
if
sharedFS
{
...
...
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