Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nfs-subdir-external-provisioner
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rancher商店
nfs-subdir-external-provisioner
Commits
7c23a7dd
Commit
7c23a7dd
authored
Feb 10, 2022
by
Humble Chirammal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary conversion of resource storage
This commit also does more corrections like error handling, formatting, typos..etc Signed-off-by:
Humble Chirammal
<
hchiramm@redhat.com
>
parent
e53fbc3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
provisioner.go
cmd/nfs-subdir-external-provisioner/provisioner.go
+6
-7
No files found.
cmd/nfs-subdir-external-provisioner/provisioner.go
View file @
7c23a7dd
...
...
@@ -112,10 +112,10 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
}
glog
.
V
(
4
)
.
Infof
(
"creating path %s"
,
fullPath
)
if
err
:=
os
.
MkdirAll
(
fullPath
,
0777
);
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
fullPath
,
0
o
777
);
err
!=
nil
{
return
nil
,
controller
.
ProvisioningFinished
,
errors
.
New
(
"unable to create directory to provision new pv: "
+
err
.
Error
())
}
err
:=
os
.
Chmod
(
fullPath
,
0777
)
err
:=
os
.
Chmod
(
fullPath
,
0
o
777
)
if
err
!=
nil
{
return
nil
,
""
,
err
}
...
...
@@ -159,14 +159,12 @@ func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume
}
// Determine if the "onDelete" parameter exists.
// If it exists and has a
delete
value, delete the directory.
// If it exists and has a
retain
value, safe the directory.
// If it exists and has a
`delete`
value, delete the directory.
// If it exists and has a
`retain`
value, safe the directory.
onDelete
:=
storageClass
.
Parameters
[
"onDelete"
]
switch
onDelete
{
case
"delete"
:
return
os
.
RemoveAll
(
oldPath
)
case
"retain"
:
return
nil
}
...
...
@@ -190,7 +188,7 @@ func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume
return
os
.
Rename
(
oldPath
,
archivePath
)
}
// getClassForVolume returns StorageClass
// getClassForVolume returns StorageClass
.
func
(
p
*
nfsProvisioner
)
getClassForVolume
(
ctx
context
.
Context
,
pv
*
v1
.
PersistentVolume
)
(
*
storage
.
StorageClass
,
error
)
{
if
p
.
client
==
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot get kube client"
)
...
...
@@ -203,6 +201,7 @@ func (p *nfsProvisioner) getClassForVolume(ctx context.Context, pv *v1.Persisten
if
err
!=
nil
{
return
nil
,
err
}
return
class
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment