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

Ubernetes-Lite GCE: Label volumes with zone information #19995

Merged
3 commits merged into from
Jan 25, 2016

Conversation

justinsb
Copy link
Member

I haven't yet had time to test this, but wanted to share with you asap @quinton-hoole

This completes Ubernetes-Lite support for GCE, by labeling volumes with zones. It also enforces non-ambiguousness when referring to volumes purely by name, which ends up having some very nice properties: from commit 8dbb5c90b1da68c6ed01c770beeceeeedd973907

    Ubernetes-Lite: Error if a PD name is ambiguous

    We don't cope well if a PD is in multiple zones, but this is actually
    fairly easy to detect.  This is probably justified purely on the basis
    that we never want to delete the wrong volume (DeleteDisk), but also
    because this means that we now warn on creation if a disk is in multiple
    zones (with the labeling admission controller).

    This also means that with the scheduling predicate in place, that many
    of our volume problems "go away" in practice: you still can't create or
    delete a volume when it is ambiguous, but thereafter the volume will be
    labeled with the zone, that will match it only to nodes with the same
    zone, and then we query for the volume in that zone when we
    attach/detach it.

@justinsb justinsb assigned ghost Jan 22, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 22, 2016
@ghost
Copy link

ghost commented Jan 22, 2016

@justinsb Thanks! I'll do an initial review now.

@k8s-bot
Copy link

k8s-bot commented Jan 22, 2016

GCE e2e test build/test passed for commit 3f8f7e0dcd3478ade3dbcfcf189120f393b965bb.

@@ -1644,6 +1645,30 @@ func (gce *GCECloud) DeleteDisk(diskToDelete string) error {
return gce.waitForZoneOp(deleteOp, disk.Zone)
}

func (gce *GCECloud) GetPDLabels(name string) (map[string]string, error) {
Copy link

Choose a reason for hiding this comment

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

nit: Worth adding a comment here describing what this does, as it's not entirely clear from the signature. In particular it does not return all of the labels currently applied to the PD. It returns the zone and region labels that we want to apply to the PD. Also, the name param is the name of the PD, not the name of the label, or of anything else.

When volumes are labeled, they will only be scheduled onto nodes in the
same zone.
We don't cope well if a PD is in multiple zones, but this is actually
fairly easy to detect.  This is probably justified purely on the basis
that we never want to delete the wrong volume (DeleteDisk), but also
because this means that we now warn on creation if a disk is in multiple
zones (with the labeling admission controller).

This also means that with the scheduling predicate in place, that many
of our volume problems "go away" in practice: you still can't create or
delete a volume when it is ambiguous, but thereafter the volume will be
labeled with the zone, that will match it only to nodes with the same
zone, and then we query for the volume in that zone when we
attach/detach it.
@k8s-bot
Copy link

k8s-bot commented Jan 22, 2016

GCE e2e build/test failed for commit 88eeec4.

@justinsb
Copy link
Member Author

@k8s-bot test this

Looks like a flake?

@ghost
Copy link

ghost commented Jan 23, 2016

@justinsb As discussed offline, I'm not terribly happy about how plugin/pkg/admission/persistentvolume/label/admission.go is morphing from what was presumably intended to be a provider-agnostic generalization into an ugly amalgamation of provider-specific code. But I understand your point that much of this stems from previous decisions, and is not easy to fix in this PR. I'll open a separate issue to track the refactoring issue required to address that.

Other than that, this PR LGTM! Thanks!

@ghost ghost added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2016
@ghost ghost added this to the v1.2 milestone Jan 23, 2016
@ghost ghost added the team/control-plane label Jan 23, 2016
@k8s-bot
Copy link

k8s-bot commented Jan 23, 2016

GCE e2e test build/test passed for commit 88eeec4.

@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 48 hours old. Re-running tests.

@k8s-bot
Copy link

k8s-bot commented Jan 25, 2016

GCE e2e test build/test passed for commit 88eeec4.

@justinsb
Copy link
Member Author

@k8s-bot unit test this

@ghost
Copy link

ghost commented Jan 25, 2016

Merging manually to free up some merge queue bandwidth.

ghost pushed a commit that referenced this pull request Jan 25, 2016
Ubernetes-Lite GCE: Label volumes with zone information
@ghost ghost merged commit 10f7985 into kubernetes:master Jan 25, 2016
@lavalamp
Copy link
Member

@quinton-hoole Pinging @k8s-oncall for manual merges is probably a better way to go. :)

@@ -75,6 +77,13 @@ func (l *persistentVolumeLabel) Admit(a admission.Attributes) (err error) {
}
volumeLabels = labels
}
if volume.Spec.GCEPersistentDisk != nil {
Copy link
Member

Choose a reason for hiding this comment

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

@markturansky @saad-ali This should be part of volume plugins, I think. It should NOT be an open-coded list of cases. I'll file a new issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - this came up in review a few lines up ^^^. I agree with the criticism, but it isn't clear to me how best to fix it.

This pull request was closed.
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants