Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
730eee0
Gather Kubernetes data about pod volumes and add K8s context to files…
ciprianfocsaneanu Jan 15, 2026
9e0b52e
Take into account block volumes as well
ciprianfocsaneanu Jan 16, 2026
ec21bd3
Add logging only mode
ciprianfocsaneanu Jan 16, 2026
2b8a47a
Integrate VPC metadata enrichment for netflow IP addresses (#611)
RomanMelnyk113 Jan 16, 2026
72f6763
Gather Kubernetes data about pod volumes and add K8s context to files…
ciprianfocsaneanu Jan 15, 2026
fdf6ca9
Fix merge
ciprianfocsaneanu Jan 18, 2026
0ce475c
Merge branch 'main' into add-k8s-metadata-to-storage
ciprianfocsaneanu Jan 18, 2026
0eb39ba
Add debugging logs
ciprianfocsaneanu Jan 18, 2026
9a4d281
Filter pod volume metrics to only include PVC-backed volumes and excl…
ciprianfocsaneanu Jan 18, 2026
870343c
Add RBAC permissions for PVCs and PVs in controller ClusterRole
ciprianfocsaneanu Jan 18, 2026
44e25ed
Add CSI Volume handle to K8sPodVolumeMetric
ciprianfocsaneanu Jan 18, 2026
8fe64a0
Deduplicate filesystem metrics
ciprianfocsaneanu Jan 18, 2026
7ff8bac
Add warning log about PV not found in index for PVC
ciprianfocsaneanu Jan 18, 2026
d88cf61
Improve logs
ciprianfocsaneanu Jan 18, 2026
45d4176
Improve logs
ciprianfocsaneanu Jan 18, 2026
448fd2b
Simplify FilesystemMetric and add in-tree volume source support
ciprianfocsaneanu Jan 19, 2026
520df3a
Remove logging only mode
ciprianfocsaneanu Jan 19, 2026
38926cd
Use existing context
ciprianfocsaneanu Jan 19, 2026
f0254ae
Use local tables
ciprianfocsaneanu Jan 19, 2026
0f84814
Remove local suffix
ciprianfocsaneanu Jan 19, 2026
ef1c2bc
Merge branch 'main' into add-k8s-metadata-to-storage
ciprianfocsaneanu Jan 19, 2026
fb2d1a1
Undo wrong change of removing metrics client start
ciprianfocsaneanu Jan 20, 2026
9e68ea2
Add k8s_pod_volume_metrics to E2E test
ciprianfocsaneanu Jan 20, 2026
89a82ac
Fix context in test
ciprianfocsaneanu Jan 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
352 changes: 324 additions & 28 deletions api/v1/kube/kube_api.pb.go

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions api/v1/kube/kube_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ service KubeAPI {
rpc GetPod(GetPodRequest) returns (GetPodResponse);
rpc GetNode(GetNodeRequest) returns (GetNodeResponse);
rpc GetNodeStatsSummary(GetNodeStatsSummaryRequest) returns (GetNodeStatsSummaryResponse);
rpc GetPodVolumes(GetPodVolumesRequest) returns (GetPodVolumesResponse);
}

message GetClusterInfoRequest {}
Expand Down Expand Up @@ -152,3 +153,31 @@ message RuntimeStats {
FsStats image_fs = 2;
FsStats container_fs = 3;
}

message GetPodVolumesRequest {
string node_name = 1;
}

message GetPodVolumesResponse {
repeated PodVolumeInfo volumes = 1;
}

message PodVolumeInfo {
string namespace = 1;
string pod_name = 2;
string pod_uid = 3;
string controller_kind = 4;
string controller_name = 5;
string container_name = 6;
string volume_name = 7;
string mount_path = 8;
string pvc_name = 9;
string pvc_uid = 10;
int64 requested_size_bytes = 11;
string pv_name = 12;
string storage_class = 13;
string csi_driver = 14;
string csi_volume_handle = 15;
string volume_mode = 16; // "Filesystem" or "Block"
string device_path = 17; // For block volumes: container's volumeDevices[].devicePath
}
57 changes: 48 additions & 9 deletions api/v1/kube/kube_api_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions api/v1/runtime/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions api/v1/runtime/runtime_agent_api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions api/v1/runtime/runtime_agent_api_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions charts/kvisor/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ rules:
- namespaces
- services
- endpoints
- persistentvolumeclaims
- persistentvolumes
verbs:
- get
- list
Expand Down
23 changes: 15 additions & 8 deletions cmd/agent/daemon/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func (a *App) Run(ctx context.Context) error {
var blockDeviceMetricsWriter pipeline.BlockDeviceMetricsWriter
var filesystemMetricsWriter pipeline.FilesystemMetricsWriter
var nodeStatsSummaryWriter pipeline.NodeStatsSummaryWriter
var podVolumeMetricsWriter pipeline.K8sPodVolumeMetricsWriter
var storageInfoProvider pipeline.StorageInfoProvider
if cfg.Stats.StorageEnabled {
metricsClient, err := createMetricsClient(cfg)
Expand All @@ -263,12 +264,12 @@ func (a *App) Run(ctx context.Context) error {
}

go func() {
if err = metricsClient.Start(ctx); err != nil {
log.Warnf("metric client failed with:%v", err)
if err := metricsClient.Start(ctx); err != nil {
log.Warnf("metrics client failed: %v", err)
}
}()

blockDeviceMetricsWriter, filesystemMetricsWriter, nodeStatsSummaryWriter, err = setupStorageMetrics(metricsClient)
blockDeviceMetricsWriter, filesystemMetricsWriter, nodeStatsSummaryWriter, podVolumeMetricsWriter, err = setupStorageMetrics(metricsClient)
if err != nil {
return fmt.Errorf("failed to setup storage metrics: %w", err)
}
Expand Down Expand Up @@ -301,6 +302,7 @@ func (a *App) Run(ctx context.Context) error {
filesystemMetricsWriter,
storageInfoProvider,
nodeStatsSummaryWriter,
podVolumeMetricsWriter,
)

for _, namespace := range cfg.MutedNamespaces {
Expand Down Expand Up @@ -569,23 +571,28 @@ func waitWithTimeout(errg *errgroup.Group, timeout time.Duration) error {
}
}

func setupStorageMetrics(metricsClient custommetrics.MetricClient) (pipeline.BlockDeviceMetricsWriter, pipeline.FilesystemMetricsWriter, pipeline.NodeStatsSummaryWriter, error) {
func setupStorageMetrics(metricsClient custommetrics.MetricClient) (pipeline.BlockDeviceMetricsWriter, pipeline.FilesystemMetricsWriter, pipeline.NodeStatsSummaryWriter, pipeline.K8sPodVolumeMetricsWriter, error) {
blockDeviceMetrics, err := pipeline.NewBlockDeviceMetricsWriter(metricsClient)
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to create block device metrics writer: %w", err)
return nil, nil, nil, nil, fmt.Errorf("failed to create block device metrics writer: %w", err)
}

filesystemMetrics, err := pipeline.NewFilesystemMetricsWriter(metricsClient)
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to create filesystem metrics writer: %w", err)
return nil, nil, nil, nil, fmt.Errorf("failed to create filesystem metrics writer: %w", err)
}

nodeStatsSummaryWriter, err := pipeline.NewNodeStatsSummaryWriter(metricsClient)
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to create node storage stats summary writer: %w", err)
return nil, nil, nil, nil, fmt.Errorf("failed to create node storage stats summary writer: %w", err)
}

return blockDeviceMetrics, filesystemMetrics, nodeStatsSummaryWriter, nil
podVolumeMetricsWriter, err := pipeline.NewK8sPodVolumeMetricsWriter(metricsClient)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("failed to create pod volume metrics writer: %w", err)
}

return blockDeviceMetrics, filesystemMetrics, nodeStatsSummaryWriter, podVolumeMetricsWriter, nil
}

// resolveMetricsAddr transforms kvisor.* addresses to telemetry.* addresses
Expand Down
Loading