Skip to content
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

Merged
merged 1 commit into from
Dec 11, 2015

Conversation

markturansky
Copy link
Contributor

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.

@markturansky
Copy link
Contributor Author

Requires integration tests.

@k8s-bot
Copy link

k8s-bot commented Sep 25, 2015

GCE e2e build/test failed for commit e0607ba72487000cf2b54bc3001af64301229cf3.

@k8s-bot
Copy link

k8s-bot commented Sep 25, 2015

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)
Copy link
Contributor Author

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.

@k8s-github-robot k8s-github-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 25, 2015
@k8s-github-robot
Copy link

Labelling this PR as size/XL

@@ -484,3 +484,78 @@ func createTestVolumes() []*api.PersistentVolume {
},
}
}

func TestFindingPreboundVolumes(t *testing.T) {
pv1 := &api.PersistentVolume{
Copy link
Member

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},
        },
    }
}

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 25, 2015
@davidopp davidopp added team/cluster priority/backlog Higher priority than priority/awaiting-more-evidence. labels Sep 27, 2015
@davidopp davidopp assigned thockin and unassigned davidopp Sep 27, 2015
@k8s-bot
Copy link

k8s-bot commented Sep 29, 2015

Unit, integration and GCE e2e build/test failed for commit cbdd44d2a0db0525f0309279f5d9cea2e6be44d8.

@k8s-bot
Copy link

k8s-bot commented Sep 29, 2015

Unit, integration and GCE e2e build/test failed for commit 40005777882e13cde22f3394e23ae0ceb16acd8a.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 29, 2015
glog.V(5).Infof("Provisioning PersistentVolumeClaim[%s/%s]\n", pvc.Namespace, pvc.Name)

volumeOptions := volume.VolumeOptions{
CapacityMB: 100,
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@saad-ali
Copy link
Member

I'll look at this first thing in the morning @markturansky
Sorry for the delay

@markturansky
Copy link
Contributor Author

@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.

@markturansky markturansky force-pushed the pv_provisioner branch 3 times, most recently from fdf9127 to 53aa791 Compare September 30, 2015 13:46
@k8s-bot
Copy link

k8s-bot commented Dec 10, 2015

GCE e2e build/test failed for commit f93be02dafed3dc322e7d1ba009b643de91d8324.

@markturansky
Copy link
Contributor Author

@saad-ali cloud providers removed for now and for Jan to add back.

@k8s-bot
Copy link

k8s-bot commented Dec 11, 2015

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()...)
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. All is well.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 11, 2015
@jsafrane
Copy link
Member

cloud providers removed for now and for Jan to add back.

Ok, I added them back in my PRs, but now they may conflict with each other, as they modify the same code.

@pmorie
Copy link
Member

pmorie commented Dec 11, 2015

@markturansky rebase needed

// and will match above when the claim is re-processed by the binder.
if keyExists(qosProvisioningKey, claim.Annotations) {
return nil, nil
}
Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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?

@markturansky
Copy link
Contributor Author

@saad-ali @pmorie rebased.

Also added a small bit that only allows claims to bind when its volume (created specifically for it) is fully provisioned. Also added a comment to make clear that claims will only bind to the volume w/ ClaimRef of the claim (when provisioning is requested).

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 11, 2015
@k8s-bot
Copy link

k8s-bot commented Dec 11, 2015

GCE e2e build/test failed for commit 4fc1bf1.

@markturansky
Copy link
Contributor Author

@k8s-bot test this

@k8s-bot
Copy link

k8s-bot commented Dec 11, 2015

GCE e2e test build/test passed for commit 916c1e9560a761236b0e3e79172aeea3226a6bcc.

@k8s-bot
Copy link

k8s-bot commented Dec 11, 2015

GCE e2e test build/test passed for commit 4fc1bf1.

@saad-ali
Copy link
Member

Taking a look now.

@saad-ali
Copy link
Member

LGTM

@saad-ali saad-ali added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 11, 2015
@markturansky
Copy link
Contributor Author

@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.

@pmorie
Copy link
Member

pmorie commented Dec 11, 2015

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.

j3ffml added a commit that referenced this pull request Dec 11, 2015
PersistentVolume Provisioner Controller
@j3ffml j3ffml merged commit c103825 into kubernetes:master Dec 11, 2015
@wattsteve
Copy link
Contributor

Woohoo. Nice work @markturansky. Thanks @pmorie @saad-ali @childsb @jsafrane for all the reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.