Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit f61a76f

Browse files
Vaibhav KamraMadhavJivrajani
Vaibhav Kamra
authored andcommitted
Proposal for adding PVC info to VolumeStats
Flushes out details for part 1 of the changes described in kubernetes/community#855 Feature: kubernetes/enhancements#363
1 parent a215555 commit f61a76f

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

volume_stats_pvc_ref.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Add PVC reference in Volume Stats
2+
3+
## Background
4+
Pod volume stats tracked by kubelet do not currently include any information about the PVC (if the pod volume was referenced via a PVC)
5+
6+
This prevents exposing (and querying) volume metrics labeled by PVC name which is preferable for users, given that PVC is a top-level API object.
7+
8+
## Proposal
9+
10+
Modify ```VolumeStats``` tracked in Kubelet and populate with PVC info:
11+
12+
```
13+
// VolumeStats contains data about Volume filesystem usage.
14+
type VolumeStats struct {
15+
// Embedded FsStats
16+
FsStats
17+
// Name is the name given to the Volume
18+
// +optional
19+
Name string `json:"name,omitempty"`
20+
+ // PVCRef is a reference to the measured PVC.
21+
+ // +optional
22+
+ PVCRef PVCReference `json:"pvcRef"`
23+
}
24+
25+
+// PVCReference contains enough information to describe the referenced PVC.
26+
+type PVCReference struct {
27+
+ Name string `json:"name"`
28+
+ Namespace string `json:"namespace"`
29+
+}
30+
```
31+
32+
## Implementation
33+
2 options are described below. Option 1 supports current requirements/requested use cases. Option 2 supports an additional use case that was being discussed and is called out for completeness/discussion/feedback.
34+
35+
### Option 1
36+
- Modify ```kubelet::server::stats::calcAndStoreStats()```
37+
- If the pod volume is referenced via a PVC, populate ```PVCRef``` in VolumeStats using the Pod spec
38+
39+
- The Pod spec is already available in this method, so the changes are contained to this function.
40+
41+
- The limitation of this approach is that we're limited to reporting only what is available in the pod spec (Pod namespace and PVC claimname)
42+
43+
### Option 2
44+
- Modify the ```volumemanager::GetMountedVolumesForPod()``` (or add a new function) to return additional volume information from the ASOW/DSOW caches
45+
- Use this to populate PVCRef in VolumeStats
46+
47+
- This allows us to get information not available in the Pod spec such as the PV name/UID which can be used to label metrics - enables exposing/querying volume metrics by PV name
48+
- It's unclear whether this is a use case we need to/should support:
49+
* Volume metrics are only refreshed for mounted volumes which implies a bound/available PVC
50+
* We expect most user-storage interactions to be via the PVC
51+
52+
53+
54+

0 commit comments

Comments
 (0)