-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
GCE PD plugin now prevents attaching a regional PD PV with pdName of … #63322
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -535,14 +535,10 @@ func (gce *GCECloud) AttachDisk(diskName string, nodeName types.NodeName, readOn | |
if regional && utilfeature.DefaultFeatureGate.Enabled(features.GCERegionalPersistentDisk) { | ||
disk, err = gce.getRegionalDiskByName(diskName) | ||
if err != nil { | ||
glog.V(5).Infof("Could not find regional PD named %q to Attach. Will look for a zonal PD", diskName) | ||
err = nil | ||
} else { | ||
mc = newDiskMetricContextRegional("attach", gce.region) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can a unit test be added? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A good chunk of disk methods aren't covered by unit tests today. To address that, I'm looking into refactoring There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately I didn't have time to do the refactor for this release, and I'm planning to leave this unit test for either after code freeze (ideally) or the next release. Sorry this is non-ideal :( |
||
} | ||
} | ||
|
||
if disk == nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before, if a regional PD is not found, we let the rest of the function continue to execute, so the Now, the function returns right away if an error is found, and |
||
mc = newDiskMetricContextRegional("attach", gce.region) | ||
} else { | ||
disk, err = gce.getDiskByName(diskName, instance.Zone) | ||
if err != nil { | ||
return err | ||
|
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.
what is regional is true, but feature is not enabled, or this case is not possible at all.
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.
In that case we fall back to the behavior for a regular disk, as if the regional PD feature doesn't exist.
regional
is set if the volume is a PV spec and its zone label has the regional PD format. If the feature gate is disabled, when a user creates a PV with regional PD zone label, the PV is rejected by an admission controller, so usually we don't hit this scenario.