-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PersistentVolume Provisioner Controller #14537
Conversation
Requires integration tests. |
e0607ba
to
7b23912
Compare
GCE e2e build/test failed for commit e0607ba72487000cf2b54bc3001af64301229cf3. |
GCE e2e build/test failed for commit 7b23912c76dd0249b7966311f89ab70fee610882. |
glog.V(5).Infof("Starting PersistentVolumeProvisioner\n") | ||
if provisioner.stopChannel == nil { | ||
provisioner.stopChannel = make(chan struct{}) | ||
go provisioner.pvclaimController.Run(provisioner.stopChannel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be like the binder and handle two stop channels for the two controllers.
Labelling this PR as size/XL |
@@ -484,3 +484,78 @@ func createTestVolumes() []*api.PersistentVolume { | |||
}, | |||
} | |||
} | |||
|
|||
func TestFindingPreboundVolumes(t *testing.T) { | |||
pv1 := &api.PersistentVolume{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract an object mother like:
func pvFor(size int) *api.PersistentVolume {
sz := strconv.Itoa(size)
return &api.PersistentVolume{
ObjectMeta: api.ObjectMeta{
Name: fmt.Sprintf("pv%v", sz),
Annotations: map[string]string{},
},
Spec: api.PersistentVolumeSpec{
Capacity: api.ResourceList{api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%vGi", sz))},
PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{}},
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
},
}
}
7b23912
to
cbdd44d
Compare
Unit, integration and GCE e2e build/test failed for commit cbdd44d2a0db0525f0309279f5d9cea2e6be44d8. |
cbdd44d
to
4000577
Compare
Unit, integration and GCE e2e build/test failed for commit 40005777882e13cde22f3394e23ae0ceb16acd8a. |
glog.V(5).Infof("Provisioning PersistentVolumeClaim[%s/%s]\n", pvc.Namespace, pvc.Name) | ||
|
||
volumeOptions := volume.VolumeOptions{ | ||
CapacityMB: 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The volume size must come from the claim, otherwise it creates only 100MB volumes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is a placeholder. Need to convert from the pvc into MB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, i think the factoring is wrong. This should be resource.Quantity and copied from the claim.
I'll look at this first thing in the morning @markturansky |
@saad-ali thanks, but give me until the end of today to push my latest changes, tests, etc. Got a few nits to pick first. I'll ping when ready. |
fdf9127
to
53aa791
Compare
GCE e2e build/test failed for commit f93be02dafed3dc322e7d1ba009b643de91d8324. |
f93be02
to
e9488ea
Compare
@saad-ali cloud providers removed for now and for Jan to add back. |
GCE e2e test build/test passed for commit e9488ead15819674e8915f615ca1fee658b63698. |
glog.Fatalf("Could not create NFS recycler pod from file %s: %+v", flags.PersistentVolumeRecyclerPodTemplateFilePathNFS, err) | ||
} | ||
allPlugins = append(allPlugins, nfs.ProbeVolumePlugins(nfsConfig)...) | ||
|
||
allPlugins = append(allPlugins, aws_ebs.ProbeVolumePlugins()...) | ||
allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no recyclers defined for these plugins yet. Will that break anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. All is well.
Ok, I added them back in my PRs, but now they may conflict with each other, as they modify the same code. |
@markturansky rebase needed |
// and will match above when the claim is re-processed by the binder. | ||
if keyExists(qosProvisioningKey, claim.Annotations) { | ||
return nil, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saad-ali The binder will ignore a claim with the provisioningKey if it's not an exact match with a volume (i.e, the volume has a ClaimRef of the claim). This might be non-obvious in the controller (though I have comments there saying so), but this block of code is where it is enforced. Claims only bind to volumes provisioned for it, if the annotation is present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I buy this argument, but the controller interaction isn't obvious here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so basically the provisioner controller only acts on PVCs that have the volume annotation, and the binder control just ignores PVCs that DO have the volume annotation?
e9488ea
to
916c1e9
Compare
916c1e9
to
4fc1bf1
Compare
GCE e2e build/test failed for commit 4fc1bf1. |
@k8s-bot test this |
GCE e2e test build/test passed for commit 916c1e9560a761236b0e3e79172aeea3226a6bcc. |
GCE e2e test build/test passed for commit 4fc1bf1. |
Taking a look now. |
LGTM |
@k8s-oncall Please merge? We are held up by this PR downstream and need to rebase another one from this. All lights are green and have LGTM tag. |
In the interest of full disclosure, there are 3 PRs we need to rebase on top of this and get in for OpenShift 3.1.1 today, so if the @k8s-oncall dev could take a look and merge, we would appreciate it. |
PersistentVolume Provisioner Controller
Woohoo. Nice work @markturansky. Thanks @pmorie @saad-ali @childsb @jsafrane for all the reviews. |
See #6773
Added support for dynamically provisioning HostPath PVs for test and development.
@thockin @saad-ali @kubernetes/rh-storage
The first commit will drop out when #14249 is merged.