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
a99f3daf
Unverified
Commit
a99f3daf
authored
Mar 03, 2021
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 03, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #59 from petermicuch/restore_delete_folder_name
Preserve name of the PV directory name during archiving
parents
6b7372c8
9b9ac9aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
provisioner.go
cmd/nfs-subdir-external-provisioner/provisioner.go
+3
-3
No files found.
cmd/nfs-subdir-external-provisioner/provisioner.go
View file @
a99f3daf
...
...
@@ -139,8 +139,8 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
func
(
p
*
nfsProvisioner
)
Delete
(
ctx
context
.
Context
,
volume
*
v1
.
PersistentVolume
)
error
{
path
:=
volume
.
Spec
.
PersistentVolumeSource
.
NFS
.
Path
relativePath
:=
strings
.
Replace
(
path
,
p
.
path
,
""
,
1
)
oldPath
:=
filepath
.
Join
(
mountPath
,
relativ
ePath
)
basePath
:=
filepath
.
Base
(
path
)
oldPath
:=
filepath
.
Join
(
mountPath
,
bas
ePath
)
if
_
,
err
:=
os
.
Stat
(
oldPath
);
os
.
IsNotExist
(
err
)
{
glog
.
Warningf
(
"path %s does not exist, deletion skipped"
,
oldPath
)
...
...
@@ -179,7 +179,7 @@ func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume
}
}
archivePath
:=
filepath
.
Join
(
mountPath
,
"archived-"
+
volume
.
Name
)
archivePath
:=
filepath
.
Join
(
mountPath
,
"archived-"
+
basePath
)
glog
.
V
(
4
)
.
Infof
(
"archiving path %s to %s"
,
oldPath
,
archivePath
)
return
os
.
Rename
(
oldPath
,
archivePath
)
}
...
...
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