-
Notifications
You must be signed in to change notification settings - Fork 39.1k
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
output which pods are in use by a pvc when kubectl describe pvc is run #65837
output which pods are in use by a pvc when kubectl describe pvc is run #65837
Conversation
/sig storage |
/ok-to-test |
/test pull-kubernetes-integration |
/test pull-kubernetes-e2e-kops-aws |
/assign @mengqiy |
@kubernetes/sig-storage-pr-reviews |
} | ||
|
||
func getMountPods(c coreclient.PodInterface, pvcName string) ([]api.Pod, error) { | ||
nsPods, err := c.List(metav1.ListOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should set a limit as part of ListOptions in order to chunk potentially large responses? Don't feel strongly on this though cc @soltysh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any other usages of limiting ListOptions
for other describe operations, so I figure that it hasn't been an issue yet. I have no opinion on the matter though. If you think we should set a limit, I will.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect that list to be that long, besides kubectl describe
can and should be verbose. It's in the kubectl get
where we try to save space with more...
and similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
Please squash your changes and we'll push it forward.
sort pods in kubectl describe pvc with user-defined alignment
0d53cfc
to
d956994
Compare
squashed 👍 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clandry94, juanvallejo, soltysh 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
/test pull-kubernetes-e2e-gce |
Automatic merge from submit-queue (batch tested with PRs 65838, 65837). If you want to cherry-pick this change to another branch, please follow the instructions here. |
Amazing! thanks @clandry94 for making this happen! |
Hi @clandry94, Specifically, does the PersistentVolumeClaim object now have the field which is queried for "Mounted By", or the solution implemented here goes through all the Pods searching for the particular PVC, and displays the Pod Name. Any pointers on this would of great help. Regards |
Would it be possible to have getMountPods() exposed to the Golang API? Was looking for this exact method to use but just had to copy and paste it over to my own code. Seems odd to not expose it to the wider API, and just restrict it to |
What this PR does / why we need it:
This PR implements a feature request to display the pods mounted to a PVC when
kubectl describe pvc
is ran. We need it since the only way to see which pods are bound to a PVC is by checking the volume mounts of each individual pod in the namespace.Example Output:
Pods using the PVC are shown with the
Mounted By
fieldWhich issue(s) this PR fixes:
Closes #65233
Special notes for your reviewer:
Release note: