Fix csi attach limit#67731
Conversation
|
/sig storage |
Create a new predicate to count CSI volumes
0d33b5c to
31cdc1b
Compare
There was a problem hiding this comment.
can be optimized to:
if vol.PersistentVolumeClaim == nil {
continue
}
31cdc1b to
e4c9bae
Compare
|
/sig storage |
e4c9bae to
d19fb19
Compare
| } | ||
|
|
||
| pvName := pvc.Spec.VolumeName | ||
| if pvName == "" { |
There was a problem hiding this comment.
Add a TODO here that this is not going to work with late binding
|
|
||
| // Package nodeupdater includes internal functions used to add/delete labels to | ||
| // kubernetes nodes for corresponding CSI drivers | ||
| package nodeupdater // import "k8s.io/kubernetes/pkg/volume/csi/nodeupdater" |
| if labelErr != nil { | ||
| return labelErr | ||
| } | ||
| node = addMaxAttachLimitToNode(node, driverName, maxLimit) |
There was a problem hiding this comment.
Does this need to be feature gated?
| // When driver is longer than 39 chars | ||
| csiLimitKeyLonger := GetCSIAttachLimitKey("com.amazon.kubernetes.eks.ec2.ebs/csi-driver") | ||
| fmt.Println(csiLimitKeyLonger) | ||
| if !v1helper.IsAttachableVolumeResourceName(v1.ResourceName(csiLimitKeyLonger)) { |
There was a problem hiding this comment.
Should you check for the expected hash in this test?
| return c.attachableLimitPredicate | ||
| } | ||
|
|
||
| func (c *CSIMaxVolumeLimitChecker) attachableLimitPredicate( |
There was a problem hiding this comment.
Could we not have reused the existing MaxPD predicate and just define a new filter for CSI?
There was a problem hiding this comment.
May be - we can, but it will be ugly because underlying data structures are different. The existing MaxPD* predicates filter volumes based on hardcoded type. For example - "how many EBS volumes are attached to the node", but since there can be multiple CSI volumes on a node, the CSI predicate has to count - "How many volumes of each type are attached to the node" and same thing applies to uniqueness check and etc.
At some point - I would like to consolidate all the predicates in one when AttachLimit feature becomes GA, because then all the volume limits will come from node itself and we can remove these older and hardcoded predicates.
There was a problem hiding this comment.
Thanks for the explanation, it makes sense to keep them separate for now
|
/cc |
d19fb19 to
11cc5e9
Compare
4dc54ef to
7710dd6
Compare
There was a problem hiding this comment.
Do we need to revisit this for inline csi volumes?
There was a problem hiding this comment.
I am not 100% sure yet but I thought plan was to keep inline CSI volumes non-attachable. cc @vladimirvivien is that still true?
There was a problem hiding this comment.
discussed this offline. The handling of inline CSI volumes is out of scope for this PR. Currently inline CSI volumes are being proposed as an alpha feature.
There was a problem hiding this comment.
These messages have the potential to spam the logs if a pod spec is not constructed correctly. Can these logs be changed to Info at level 4?
pkg/volume/util/attach_limit.go
Outdated
There was a problem hiding this comment.
Do the in-tree limit keys need to be changed to be compatible with the csi driver equivalent?
There was a problem hiding this comment.
You mean - once migration happens? I think we will stick to the plan of carrying around a map for in-tree plugins when we start shipping those.
There was a problem hiding this comment.
Yes, I mean, now that this is going beta, we need to support these limits keys for two releases. So there will be a period of time where we'll need some in-tree volume key to csi translation function
|
/test pull-kubernetes-integration |
7710dd6 to
fdf8a5e
Compare
|
/lgtm |
|
/retest |
bsalamat
left a comment
There was a problem hiding this comment.
/lgtm
The changes to the scheduler look fine to, but I am not familiar with the details of CSI volume operations. My assumption is that that part is checked by the SIG storage folks.
pkg/scheduler/factory/factory.go
Outdated
There was a problem hiding this comment.
I don't want to hold this PR, but please send a follow-up PR to add tests for these invalidation cases.
fdf8a5e to
fc61620
Compare
|
/priority critical-urgent |
|
/approve |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, eparis, gnufied, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Automatic merge from submit-queue (batch tested with PRs 68161, 68023, 67909, 67955, 67731). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md. |
Add support for volume limits for CSI.
xref: kubernetes/community#2051