Skip to content
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

generic ephemeral volume checks #100482

Merged

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Mar 23, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:

When adding the ephemeral volume feature, the special case for
PersistentVolumeClaim volume sources was overlooked in three places:

  • host path check in kubelet
  • node limit check in the scheduler
  • volume zone

Of these, volume zone is deprecated an doesn't need to be changed to support ephemeral volumes.

Special notes for your reviewer:

@msau42 pointed out the gap in nodevolumelimits on chat. The other two places where found with:

git grep -i '\(name\|pvc\).*=.*ClaimName'

Does this PR introduce a user-facing change?

Generic ephemeral volumes were not considered properly by the the node limits scheduler filter and the kubelet hostpath check.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1698-generic-ephemeral-volumes

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 23, 2021
@pohly
Copy link
Contributor Author

pohly commented Mar 23, 2021

I can also split up this PR into three different PRs, one per modified directory.

@pohly
Copy link
Contributor Author

pohly commented Mar 23, 2021

/retest

Copy link
Contributor

@damemi damemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple comments on general code patterns, I don't know the full context of this featuregate so I will have to look more into it but this looks like the right approach overall

@pohly pohly force-pushed the generic-ephemeral-volume-checks branch from 28be27d to debff10 Compare March 23, 2021 16:47
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 23, 2021
@ehashman ehashman added this to Triage in SIG Node PR Triage Mar 27, 2021
@ehashman
Copy link
Member

ehashman commented Apr 7, 2021

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 7, 2021
@ehashman ehashman moved this from Triage to Needs Reviewer in SIG Node PR Triage Apr 7, 2021
@ehashman
Copy link
Member

/cc @msau42
/assign @damemi
for scheduling

/assign @SergeyKanzhelev
for node

@gnufied
Copy link
Member

gnufied commented Sep 22, 2021

/assign
/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 22, 2021
@pohly pohly force-pushed the generic-ephemeral-volume-checks branch 2 times, most recently from 27937bc to 83b991d Compare September 27, 2021 15:43
@pohly
Copy link
Contributor Author

pohly commented Sep 27, 2021

I had to rebase because the feature gate package imports in pkg/kubelet/kubelet_pods_test.go had been removed and I need them again.

@ehashman
Copy link
Member

@msau42 can the hold be removed?

@ehashman ehashman moved this from Waiting on Author to Needs Reviewer in SIG Node PR Triage Sep 27, 2021
// The PVC is required to proceed with
// scheduling of a new pod because it cannot
// run without it. Bail out immediately.
return fmt.Errorf("look up PVC %s/%s: %v", pod.Namespace, pvcName, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we provide a little more context to the error message, like "failed to ..."?

Copy link
Contributor Author

@pohly pohly Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to write error messages as <operation>: <error>. Then if it gets wrapped higher up, we don't accumulate those "failed to " comments. I've seen errors which were something like:

ERROR: failed to <do abc>: failed to <do xyz>: could not <do fgh>: original error here

That always seemed a bit redundant to me. But let me add it here.... done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tend to say "looking up PVC ...." because it is clear this is an error from the context, so adding "failed to" is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like "looking up PVC" best, so I've switched to that.

@msau42 okay? I still need LGTM for this PR.

return fmt.Errorf("look up PVC %s/%s: %v", pod.Namespace, pvcName, err)
}
// If the PVC is invalid, we don't count the volume because
// there's no guarantee that it belongs to the running predicate.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened #105328 to followup on if we should ignore or count them.

@msau42
Copy link
Member

msau42 commented Sep 28, 2021

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2021
@pohly pohly force-pushed the generic-ephemeral-volume-checks branch 2 times, most recently from f60ed36 to 3e7947e Compare September 29, 2021 05:55
@msau42
Copy link
Member

msau42 commented Sep 29, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 29, 2021
@pacoxu pacoxu moved this from Needs Reviewer to Needs Approver in SIG Node PR Triage Sep 30, 2021
Copy link
Contributor

@klueska klueska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, but otherwise looks good from a sig-node / kubelet perspective.

}
pvc, err := kl.kubeClient.CoreV1().PersistentVolumeClaims(pod.Namespace).Get(context.TODO(), pvcName, metav1.GetOptions{})
if err != nil {
klog.InfoS("Unable to retrieve pvc", "pvc", klog.KRef(pod.Namespace, volume.PersistentVolumeClaim.ClaimName), "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to use pcvName instead of volume.PersistentVolumeClaim.ClaimName in this log message?

When adding the ephemeral volume feature, the special case for
PersistentVolumeClaim volume sources in kubelet's host path and node
limits checks was overlooked. An ephemeral volume source is another
way of referencing a claim and has to be treated the same way.
Previously, the situation was ignored, which might have had the effect that Pod
scheduling continued (?) even though the Pod+PVC weren't known to be in an
acceptable state.
@pohly pohly force-pushed the generic-ephemeral-volume-checks branch from 3e7947e to 1d181ad Compare October 1, 2021 15:03
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 1, 2021
@klueska
Copy link
Contributor

klueska commented Oct 1, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 1, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, klueska, msau42, pohly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 1, 2021
@k8s-ci-robot k8s-ci-robot merged commit e414cf7 into kubernetes:master Oct 1, 2021
SIG Node PR Triage automation moved this from Needs Approver to Done Oct 1, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

None yet