CSIStorageCapacity: check for sufficient storage in volume binder

This uses the information provided by a CSI driver deployment for
checking whether a node has access to enough storage to create the
currently unbound volumes, if the CSI driver opts into that checking
with CSIDriver.Spec.VolumeCapacity != false.

This resolves a TODO from commit 95b530366a.
This commit is contained in:
Patrick Ohly
2020-06-22 16:06:46 +02:00
parent 9a66e8e1b5
commit 0efbbe8555
6 changed files with 397 additions and 27 deletions

View File

@@ -541,6 +541,12 @@ func ClusterRoles() []rbacv1.ClusterRole {
// Needed for volume limits
rbacv1helpers.NewRule(Read...).Groups(storageGroup).Resources("csinodes").RuleOrDie(),
}
if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) {
kubeSchedulerRules = append(kubeSchedulerRules,
rbacv1helpers.NewRule(Read...).Groups(storageGroup).Resources("csidrivers").RuleOrDie(),
rbacv1helpers.NewRule(Read...).Groups(storageGroup).Resources("csistoragecapacities").RuleOrDie(),
)
}
roles = append(roles, rbacv1.ClusterRole{
// a role to use for the kube-scheduler
ObjectMeta: metav1.ObjectMeta{Name: "system:kube-scheduler"},