Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
454666bc
Unverified
Commit
454666bc
authored
Apr 09, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76184 from humblec/pvc
Use pvc uid in endpoint/service label
parents
fdeedf44
6eae6bba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+10
-4
No files found.
pkg/volume/glusterfs/glusterfs.go
View file @
454666bc
...
...
@@ -865,7 +865,7 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsPersi
epServiceName
=
p
.
provisionerConfig
.
customEpNamePrefix
+
"-"
+
string
(
p
.
options
.
PVC
.
UID
)
}
epNamespace
:=
p
.
options
.
PVC
.
Namespace
endpoint
,
service
,
err
:=
p
.
createEndpointService
(
epNamespace
,
epServiceName
,
dynamicHostIps
,
p
.
options
.
PVC
.
Name
)
endpoint
,
service
,
err
:=
p
.
createEndpointService
(
epNamespace
,
epServiceName
,
dynamicHostIps
,
p
.
options
.
PVC
)
if
err
!=
nil
{
klog
.
Errorf
(
"failed to create endpoint/service %v/%v: %v"
,
epNamespace
,
epServiceName
,
err
)
deleteErr
:=
cli
.
VolumeDelete
(
volume
.
Id
)
...
...
@@ -887,7 +887,13 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsPersi
// exist for the given namespace, PVC name, endpoint name, and
// set of IPs. I.e. the endpoint or service is only created
// if it does not exist yet.
func
(
p
*
glusterfsVolumeProvisioner
)
createEndpointService
(
namespace
string
,
epServiceName
string
,
hostips
[]
string
,
pvcname
string
)
(
endpoint
*
v1
.
Endpoints
,
service
*
v1
.
Service
,
err
error
)
{
func
(
p
*
glusterfsVolumeProvisioner
)
createEndpointService
(
namespace
string
,
epServiceName
string
,
hostips
[]
string
,
pvc
*
v1
.
PersistentVolumeClaim
)
(
endpoint
*
v1
.
Endpoints
,
service
*
v1
.
Service
,
err
error
)
{
pvcNameOrID
:=
""
if
len
(
pvc
.
Name
)
>=
63
{
pvcNameOrID
=
string
(
pvc
.
UID
)
}
else
{
pvcNameOrID
=
pvc
.
Name
}
addrlist
:=
make
([]
v1
.
EndpointAddress
,
len
(
hostips
))
for
i
,
v
:=
range
hostips
{
...
...
@@ -898,7 +904,7 @@ func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epS
Namespace
:
namespace
,
Name
:
epServiceName
,
Labels
:
map
[
string
]
string
{
"gluster.kubernetes.io/provisioned-for-pvc"
:
pvc
name
,
"gluster.kubernetes.io/provisioned-for-pvc"
:
pvc
NameOrID
,
},
},
Subsets
:
[]
v1
.
EndpointSubset
{{
...
...
@@ -924,7 +930,7 @@ func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epS
Name
:
epServiceName
,
Namespace
:
namespace
,
Labels
:
map
[
string
]
string
{
"gluster.kubernetes.io/provisioned-for-pvc"
:
pvc
name
,
"gluster.kubernetes.io/provisioned-for-pvc"
:
pvc
NameOrID
,
},
},
Spec
:
v1
.
ServiceSpec
{
...
...
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