Enforce ReadWriteOncePod access mode during scheduling

Check the PVC ref count on the node info cache to determine if a pod's
PVCs are in use. If they are and it is using ReadWriteOncePod, fail the
request.
This commit is contained in:
Chris Henzie
2021-06-16 13:21:49 -07:00
parent ebc3fdb293
commit 7ad44d04fc
11 changed files with 271 additions and 9 deletions

View File

@@ -53,6 +53,7 @@ func NewInTreeRegistry() runtime.Registry {
EnablePodAffinityNamespaceSelector: feature.DefaultFeatureGate.Enabled(features.PodAffinityNamespaceSelector),
EnablePodDisruptionBudget: feature.DefaultFeatureGate.Enabled(features.PodDisruptionBudget),
EnablePodOverhead: feature.DefaultFeatureGate.Enabled(features.PodOverhead),
EnableReadWriteOncePod: feature.DefaultFeatureGate.Enabled(features.ReadWriteOncePod),
}
return runtime.Registry{
@@ -80,8 +81,10 @@ func NewInTreeRegistry() runtime.Registry {
noderesources.RequestedToCapacityRatioName: func(plArgs apiruntime.Object, fh framework.Handle) (framework.Plugin, error) {
return noderesources.NewRequestedToCapacityRatio(plArgs, fh, fts)
},
volumebinding.Name: volumebinding.New,
volumerestrictions.Name: volumerestrictions.New,
volumebinding.Name: volumebinding.New,
volumerestrictions.Name: func(plArgs apiruntime.Object, fh framework.Handle) (framework.Plugin, error) {
return volumerestrictions.New(plArgs, fh, fts)
},
volumezone.Name: volumezone.New,
nodevolumelimits.CSIName: nodevolumelimits.NewCSI,
nodevolumelimits.EBSName: nodevolumelimits.NewEBS,