mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #114528 from mpatlasov/fix-specModified-check
Fix installDriverToCSINode(): do not skip CSINode update if Allocatable.Count changed
This commit is contained in:
commit
7759fdb940
@ -505,6 +505,15 @@ func setMigrationAnnotation(migratedPlugins map[string](func() bool), nodeInfo *
|
||||
return true
|
||||
}
|
||||
|
||||
// Returns true if and only if new maxAttachLimit doesn't require CSINode update
|
||||
func keepAllocatableCount(driverInfoSpec storagev1.CSINodeDriver, maxAttachLimit int64) bool {
|
||||
if maxAttachLimit == 0 {
|
||||
return driverInfoSpec.Allocatable == nil || driverInfoSpec.Allocatable.Count == nil
|
||||
}
|
||||
|
||||
return driverInfoSpec.Allocatable != nil && driverInfoSpec.Allocatable.Count != nil && int64(*driverInfoSpec.Allocatable.Count) == maxAttachLimit
|
||||
}
|
||||
|
||||
func (nim *nodeInfoManager) installDriverToCSINode(
|
||||
nodeInfo *storagev1.CSINode,
|
||||
driverName string,
|
||||
@ -528,7 +537,8 @@ func (nim *nodeInfoManager) installDriverToCSINode(
|
||||
for _, driverInfoSpec := range nodeInfo.Spec.Drivers {
|
||||
if driverInfoSpec.Name == driverName {
|
||||
if driverInfoSpec.NodeID == driverNodeID &&
|
||||
sets.NewString(driverInfoSpec.TopologyKeys...).Equal(topologyKeys) {
|
||||
sets.NewString(driverInfoSpec.TopologyKeys...).Equal(topologyKeys) &&
|
||||
keepAllocatableCount(driverInfoSpec, maxAttachLimit) {
|
||||
specModified = false
|
||||
}
|
||||
} else {
|
||||
|
@ -593,7 +593,7 @@ func TestInstallCSIDriver(t *testing.T) {
|
||||
Name: "com.example.csi.driver1",
|
||||
NodeID: "com.example.csi/csi-node1",
|
||||
TopologyKeys: nil,
|
||||
Allocatable: generateVolumeLimits(10),
|
||||
Allocatable: generateVolumeLimits(20),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user