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
Add CSI migration of OpenStack Cinder volumes #113826
Merged
+634
−13
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,8 @@ const ( | |
gcePDVolumeFilterType = "GCE" | ||
// azureDiskVolumeFilterType defines the filter name for azureDiskVolumeFilter. | ||
azureDiskVolumeFilterType = "AzureDisk" | ||
// cinderVolumeFilterType defines the filter name for cinderVolumeFilter. | ||
cinderVolumeFilterType = "Cinder" | ||
|
||
// ErrReasonMaxVolumeCountExceeded is used for MaxVolumeCount predicate error. | ||
ErrReasonMaxVolumeCountExceeded = "node(s) exceed max volume count" | ||
|
@@ -73,6 +75,15 @@ func NewAzureDisk(_ runtime.Object, handle framework.Handle, fts feature.Feature | |
return newNonCSILimitsWithInformerFactory(azureDiskVolumeFilterType, informerFactory, fts), nil | ||
} | ||
|
||
// CinderName is the name of the plugin used in the plugin registry and configurations. | ||
const CinderName = names.CinderLimits | ||
|
||
// NewCinder returns function that initializes a new plugin and returns it. | ||
func NewCinder(_ runtime.Object, handle framework.Handle, fts feature.Features) (framework.Plugin, error) { | ||
informerFactory := handle.SharedInformerFactory() | ||
return newNonCSILimitsWithInformerFactory(cinderVolumeFilterType, informerFactory, fts), nil | ||
} | ||
|
||
// EBSName is the name of the plugin used in the plugin registry and configurations. | ||
const EBSName = names.EBSLimits | ||
|
||
|
@@ -160,6 +171,10 @@ func newNonCSILimits( | |
name = AzureDiskName | ||
filter = azureDiskVolumeFilter | ||
volumeLimitKey = v1.ResourceName(volumeutil.AzureVolumeLimitKey) | ||
case cinderVolumeFilterType: | ||
name = CinderName | ||
filter = cinderVolumeFilter | ||
volumeLimitKey = v1.ResourceName(volumeutil.CinderVolumeLimitKey) | ||
default: | ||
klog.ErrorS(errors.New("wrong filterName"), "Cannot create nonCSILimits plugin") | ||
return nil | ||
|
@@ -460,6 +475,32 @@ var azureDiskVolumeFilter = VolumeFilter{ | |
}, | ||
} | ||
|
||
// cinderVolumeFilter is a VolumeFilter for filtering cinder Volumes. | ||
// It will be deprecated once Openstack cloudprovider has been removed from in-tree. | ||
var cinderVolumeFilter = VolumeFilter{ | ||
FilterVolume: func(vol *v1.Volume) (string, bool) { | ||
if vol.Cinder != nil { | ||
return vol.Cinder.VolumeID, true | ||
} | ||
return "", false | ||
}, | ||
|
||
FilterPersistentVolume: func(pv *v1.PersistentVolume) (string, bool) { | ||
if pv.Spec.Cinder != nil { | ||
return pv.Spec.Cinder.VolumeID, true | ||
} | ||
return "", false | ||
}, | ||
|
||
MatchProvisioner: func(sc *storage.StorageClass) bool { | ||
return sc.Provisioner == csilibplugins.CinderInTreePluginName | ||
}, | ||
|
||
IsMigrated: func(csiNode *storage.CSINode) bool { | ||
return isCSIMigrationOn(csiNode, csilibplugins.CinderInTreePluginName) | ||
}, | ||
} | ||
|
||
func getMaxVolumeFunc(filterName string) func(node *v1.Node) int { | ||
return func(node *v1.Node) int { | ||
maxVolumesFromEnv := getMaxVolLimitFromEnv() | ||
|
@@ -481,6 +522,8 @@ func getMaxVolumeFunc(filterName string) func(node *v1.Node) int { | |
return defaultMaxGCEPDVolumes | ||
case azureDiskVolumeFilterType: | ||
return defaultMaxAzureDiskVolumes | ||
case cinderVolumeFilterType: | ||
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 you open up an issue to investigate if this logic can be removed? I believe we should be always taking the limit from CSINode now. 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. Opened #113885 |
||
return volumeutil.DefaultMaxCinderVolumes | ||
default: | ||
return -1 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hm so we may not be able to remove this logic after all