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
01b20d8e
Commit
01b20d8e
authored
May 17, 2016
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate shorter provisioned PV names.
GCE PD names are generated out of provisioned PV.Name, therefore it should be as short as possible and still unique.
parent
79b91b9e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
controller.go
pkg/controller/persistentvolume/controller.go
+1
-1
provision_test.go
pkg/controller/persistentvolume/provision_test.go
+7
-7
No files found.
pkg/controller/persistentvolume/controller.go
View file @
01b20d8e
...
...
@@ -1169,7 +1169,7 @@ func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interfa
// getProvisionedVolumeNameForClaim returns PV.Name for the provisioned volume.
// The name must be unique
func
(
ctrl
*
PersistentVolumeController
)
getProvisionedVolumeNameForClaim
(
claim
*
api
.
PersistentVolumeClaim
)
string
{
return
"pv
-provisioned-for
-"
+
string
(
claim
.
UID
)
return
"pv
c
-"
+
string
(
claim
.
UID
)
}
// scheduleOperation starts given asynchronous operation on given volume. It
...
...
pkg/controller/persistentvolume/provision_test.go
View file @
01b20d8e
...
...
@@ -33,7 +33,7 @@ func TestProvisionSync(t *testing.T) {
// Provision a volume
"11-1 - successful provision"
,
novolumes
,
newVolumeArray
(
"pv
-provisioned-for
-uid11-1"
,
"1Gi"
,
"uid11-1"
,
"claim11-1"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newVolumeArray
(
"pv
c
-uid11-1"
,
"1Gi"
,
"uid11-1"
,
"claim11-1"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newClaimArray
(
"claim11-1"
,
"uid11-1"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
// Binding will be completed in the next syncClaim
newClaimArray
(
"claim11-1"
,
"uid11-1"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
...
...
@@ -76,7 +76,7 @@ func TestProvisionSync(t *testing.T) {
newVolumeArray
(
"volume11-6"
,
"1Gi"
,
""
,
""
,
api
.
VolumePending
,
api
.
PersistentVolumeReclaimRetain
),
[]
*
api
.
PersistentVolume
{
newVolume
(
"volume11-6"
,
"1Gi"
,
""
,
""
,
api
.
VolumePending
,
api
.
PersistentVolumeReclaimRetain
),
newVolume
(
"pv
-provisioned-for
-uid11-6"
,
"1Gi"
,
"uid11-6"
,
"claim11-6"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newVolume
(
"pv
c
-uid11-6"
,
"1Gi"
,
"uid11-6"
,
"claim11-6"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
},
newClaimArray
(
"claim11-6"
,
"uid11-6"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
// Binding will be completed in the next syncClaim
...
...
@@ -91,7 +91,7 @@ func TestProvisionSync(t *testing.T) {
// a volume.
"11-7 - claim is bound before provisioning"
,
novolumes
,
newVolumeArray
(
"pv
-provisioned-for
-uid11-7"
,
"1Gi"
,
"uid11-7"
,
"claim11-7"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newVolumeArray
(
"pv
c
-uid11-7"
,
"1Gi"
,
"uid11-7"
,
"claim11-7"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newClaimArray
(
"claim11-7"
,
"uid11-7"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
// The claim would be bound in next syncClaim
newClaimArray
(
"claim11-7"
,
"uid11-7"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
...
...
@@ -100,7 +100,7 @@ func TestProvisionSync(t *testing.T) {
// Create a volume before provisionClaimOperation starts.
// This similates a parallel controller provisioning the volume.
reactor
.
lock
.
Lock
()
volume
:=
newVolume
(
"pv
-provisioned-for
-uid11-7"
,
"1Gi"
,
"uid11-7"
,
"claim11-7"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
)
volume
:=
newVolume
(
"pv
c
-uid11-7"
,
"1Gi"
,
"uid11-7"
,
"claim11-7"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
)
reactor
.
volumes
[
volume
.
Name
]
=
volume
reactor
.
lock
.
Unlock
()
}),
...
...
@@ -110,7 +110,7 @@ func TestProvisionSync(t *testing.T) {
// second retry succeeds
"11-8 - cannot save provisioned volume"
,
novolumes
,
newVolumeArray
(
"pv
-provisioned-for
-uid11-8"
,
"1Gi"
,
"uid11-8"
,
"claim11-8"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newVolumeArray
(
"pv
c
-uid11-8"
,
"1Gi"
,
"uid11-8"
,
"claim11-8"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newClaimArray
(
"claim11-8"
,
"uid11-8"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
// Binding will be completed in the next syncClaim
newClaimArray
(
"claim11-8"
,
"uid11-8"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
...
...
@@ -244,10 +244,10 @@ func TestProvisionMultiSync(t *testing.T) {
// Provision a volume with binding
"12-1 - successful provision"
,
novolumes
,
newVolumeArray
(
"pv
-provisioned-for
-uid12-1"
,
"1Gi"
,
"uid12-1"
,
"claim12-1"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newVolumeArray
(
"pv
c
-uid12-1"
,
"1Gi"
,
"uid12-1"
,
"claim12-1"
,
api
.
VolumeBound
,
api
.
PersistentVolumeReclaimDelete
,
annBoundByController
,
annDynamicallyProvisioned
),
newClaimArray
(
"claim12-1"
,
"uid12-1"
,
"1Gi"
,
""
,
api
.
ClaimPending
,
annClass
),
// Binding will be completed in the next syncClaim
newClaimArray
(
"claim12-1"
,
"uid12-1"
,
"1Gi"
,
"pv
-provisioned-for
-uid12-1"
,
api
.
ClaimBound
,
annClass
,
annBoundByController
,
annBindCompleted
),
newClaimArray
(
"claim12-1"
,
"uid12-1"
,
"1Gi"
,
"pv
c
-uid12-1"
,
api
.
ClaimBound
,
annClass
,
annBoundByController
,
annBindCompleted
),
noevents
,
noerrors
,
wrapTestWithControllerConfig
(
operationProvision
,
[]
error
{
nil
},
testSyncClaim
),
},
}
...
...
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