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
4295196b
Commit
4295196b
authored
Dec 11, 2020
by
Peter Micuch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code formating updates
parent
eaa1d1be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
provisioner.go
cmd/nfs-subdir-external-provisioner/provisioner.go
+5
-5
No files found.
cmd/nfs-subdir-external-provisioner/provisioner.go
View file @
4295196b
...
...
@@ -34,8 +34,8 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v6/controller"
)
...
...
@@ -137,7 +137,7 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
return
pv
,
controller
.
ProvisioningFinished
,
nil
}
func
(
p
*
nfsProvisioner
)
Delete
(
ctx
context
.
Context
,
volume
*
v1
.
PersistentVolume
)
error
{
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
,
relativePath
)
...
...
@@ -185,7 +185,7 @@ func (p *nfsProvisioner) Delete(ctx context.Context,volume *v1.PersistentVolume)
}
// getClassForVolume returns StorageClass
func
(
p
*
nfsProvisioner
)
getClassForVolume
(
c
ontext
context
.
Context
,
pv
*
v1
.
PersistentVolume
)
(
*
storage
.
StorageClass
,
error
)
{
func
(
p
*
nfsProvisioner
)
getClassForVolume
(
c
tx
context
.
Context
,
pv
*
v1
.
PersistentVolume
)
(
*
storage
.
StorageClass
,
error
)
{
if
p
.
client
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
}
...
...
@@ -193,7 +193,7 @@ func (p *nfsProvisioner) getClassForVolume(context context.Context, pv *v1.Persi
if
className
==
""
{
return
nil
,
fmt
.
Errorf
(
"Volume has no storage class"
)
}
class
,
err
:=
p
.
client
.
StorageV1
()
.
StorageClasses
()
.
Get
(
c
ontext
,
className
,
metav1
.
GetOptions
{})
class
,
err
:=
p
.
client
.
StorageV1
()
.
StorageClasses
()
.
Get
(
c
tx
,
className
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -249,7 +249,7 @@ func main() {
leaderElection
:=
true
leaderElectionEnv
:=
os
.
Getenv
(
"ENABLE_LEADER_ELECTION"
)
if
(
leaderElectionEnv
!=
""
)
{
if
leaderElectionEnv
!=
""
{
leaderElection
,
err
=
strconv
.
ParseBool
(
leaderElectionEnv
)
if
err
!=
nil
{
glog
.
Fatalf
(
"Unable to parse ENABLE_LEADER_ELECTION env var: %v"
,
err
)
...
...
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