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
13546e5e
Commit
13546e5e
authored
Feb 02, 2017
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PV binding: send an event when there are no PVs to bind
This is similar to scheduler that says "no nodes available to schedule pods" when it can't schedule a pod.
parent
0477100f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
binder_test.go
pkg/controller/volume/persistentvolume/binder_test.go
+8
-4
pv_controller.go
pkg/controller/volume/persistentvolume/pv_controller.go
+1
-0
No files found.
pkg/controller/volume/persistentvolume/binder_test.go
View file @
13546e5e
...
@@ -55,7 +55,8 @@ func TestSync(t *testing.T) {
...
@@ -55,7 +55,8 @@ func TestSync(t *testing.T) {
newVolumeArray
(
"volume1-2"
,
"1Gi"
,
""
,
""
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newVolumeArray
(
"volume1-2"
,
"1Gi"
,
""
,
""
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newClaimArray
(
"claim1-2"
,
"uid1-2"
,
"10Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-2"
,
"uid1-2"
,
"10Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-2"
,
"uid1-2"
,
"10Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-2"
,
"uid1-2"
,
"10Gi"
,
""
,
v1
.
ClaimPending
),
noevents
,
noerrors
,
testSyncClaim
,
[]
string
{
"Normal FailedBinding"
},
noerrors
,
testSyncClaim
,
},
},
{
{
// syncClaim resets claim.Status to Pending when there is no
// syncClaim resets claim.Status to Pending when there is no
...
@@ -65,7 +66,8 @@ func TestSync(t *testing.T) {
...
@@ -65,7 +66,8 @@ func TestSync(t *testing.T) {
newVolumeArray
(
"volume1-3"
,
"1Gi"
,
""
,
""
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newVolumeArray
(
"volume1-3"
,
"1Gi"
,
""
,
""
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newClaimArray
(
"claim1-3"
,
"uid1-3"
,
"10Gi"
,
""
,
v1
.
ClaimBound
),
newClaimArray
(
"claim1-3"
,
"uid1-3"
,
"10Gi"
,
""
,
v1
.
ClaimBound
),
newClaimArray
(
"claim1-3"
,
"uid1-3"
,
"10Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-3"
,
"uid1-3"
,
"10Gi"
,
""
,
v1
.
ClaimPending
),
noevents
,
noerrors
,
testSyncClaim
,
[]
string
{
"Normal FailedBinding"
},
noerrors
,
testSyncClaim
,
},
},
{
{
// syncClaim binds claims to the smallest matching volume
// syncClaim binds claims to the smallest matching volume
...
@@ -122,7 +124,8 @@ func TestSync(t *testing.T) {
...
@@ -122,7 +124,8 @@ func TestSync(t *testing.T) {
newVolumeArray
(
"volume1-7"
,
"10Gi"
,
"uid1-777"
,
"claim1-7"
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newVolumeArray
(
"volume1-7"
,
"10Gi"
,
"uid1-777"
,
"claim1-7"
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newClaimArray
(
"claim1-7"
,
"uid1-7"
,
"1Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-7"
,
"uid1-7"
,
"1Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-7"
,
"uid1-7"
,
"1Gi"
,
""
,
v1
.
ClaimPending
),
newClaimArray
(
"claim1-7"
,
"uid1-7"
,
"1Gi"
,
""
,
v1
.
ClaimPending
),
noevents
,
noerrors
,
testSyncClaim
,
[]
string
{
"Normal FailedBinding"
},
noerrors
,
testSyncClaim
,
},
},
{
{
// syncClaim completes binding - simulates controller crash after
// syncClaim completes binding - simulates controller crash after
...
@@ -170,7 +173,8 @@ func TestSync(t *testing.T) {
...
@@ -170,7 +173,8 @@ func TestSync(t *testing.T) {
newVolumeArray
(
"volume1-1"
,
"1Gi"
,
""
,
""
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
newVolumeArray
(
"volume1-1"
,
"1Gi"
,
""
,
""
,
v1
.
VolumePending
,
v1
.
PersistentVolumeReclaimRetain
),
withLabelSelector
(
labels
,
newClaimArray
(
"claim1-1"
,
"uid1-1"
,
"1Gi"
,
""
,
v1
.
ClaimPending
)),
withLabelSelector
(
labels
,
newClaimArray
(
"claim1-1"
,
"uid1-1"
,
"1Gi"
,
""
,
v1
.
ClaimPending
)),
withLabelSelector
(
labels
,
newClaimArray
(
"claim1-1"
,
"uid1-1"
,
"1Gi"
,
""
,
v1
.
ClaimPending
)),
withLabelSelector
(
labels
,
newClaimArray
(
"claim1-1"
,
"uid1-1"
,
"1Gi"
,
""
,
v1
.
ClaimPending
)),
noevents
,
noerrors
,
testSyncClaim
,
[]
string
{
"Normal FailedBinding"
},
noerrors
,
testSyncClaim
,
},
},
// [Unit test set 2] User asked for a specific PV.
// [Unit test set 2] User asked for a specific PV.
...
...
pkg/controller/volume/persistentvolume/pv_controller.go
View file @
13546e5e
...
@@ -251,6 +251,7 @@ func (ctrl *PersistentVolumeController) syncUnboundClaim(claim *v1.PersistentVol
...
@@ -251,6 +251,7 @@ func (ctrl *PersistentVolumeController) syncUnboundClaim(claim *v1.PersistentVol
}
}
// Mark the claim as Pending and try to find a match in the next
// Mark the claim as Pending and try to find a match in the next
// periodic syncClaim
// periodic syncClaim
ctrl
.
eventRecorder
.
Event
(
claim
,
v1
.
EventTypeNormal
,
"FailedBinding"
,
"no persistent volumes available for this claim and no storage class is set"
)
if
_
,
err
=
ctrl
.
updateClaimStatus
(
claim
,
v1
.
ClaimPending
,
nil
);
err
!=
nil
{
if
_
,
err
=
ctrl
.
updateClaimStatus
(
claim
,
v1
.
ClaimPending
,
nil
);
err
!=
nil
{
return
err
return
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