Skip to content

Commit

Permalink
Add SwapStats to NodeStats, PodStats and ContainerStats
Browse files Browse the repository at this point in the history
Signed-off-by: Itamar Holder <iholder@redhat.com>
  • Loading branch information
iholder101 committed Jul 17, 2023
1 parent ff90c1c commit a05d200
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions staging/src/k8s.io/kubelet/pkg/apis/stats/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ type NodeStats struct {
// Stats about the rlimit of system.
// +optional
Rlimit *RlimitStats `json:"rlimit,omitempty"`
// Stats pertaining to swap resources. This is reported to non-windows systems only.
// +optional
Swap *SwapStats `json:"swap,omitempty"`
}

// RlimitStats are stats rlimit of OS.
Expand Down Expand Up @@ -131,6 +134,9 @@ type PodStats struct {
// ProcessStats pertaining to processes.
// +optional
ProcessStats *ProcessStats `json:"process_stats,omitempty"`
// Stats pertaining to swap resources. This is reported to non-windows systems only.
// +optional
Swap *SwapStats `json:"swap,omitempty"`
}

// ContainerStats holds container-level unprocessed sample stats.
Expand Down Expand Up @@ -159,6 +165,9 @@ type ContainerStats struct {
// +patchMergeKey=name
// +patchStrategy=merge
UserDefinedMetrics []UserDefinedMetric `json:"userDefinedMetrics,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// Stats pertaining to swap resources. This is reported to non-windows systems only.
// +optional
Swap *SwapStats `json:"swap,omitempty"`
}

// PodReference contains enough information to locate the referenced pod.
Expand Down Expand Up @@ -237,6 +246,19 @@ type MemoryStats struct {
MajorPageFaults *uint64 `json:"majorPageFaults,omitempty"`
}

// SwapStats contains data about memory usage
type SwapStats struct {
// The time at which these stats were updated.
Time metav1.Time `json:"time"`
// Available swap memory for use. This is defined as the <swap-limit> - <current-swap-usage>.
// If swap limit is undefined, this value is omitted.
// +optional
SwapAvailableBytes *uint64 `json:"swapAvailableBytes,omitempty"`
// Total swap memory in use.
// +optional
SwapUsageBytes *uint64 `json:"swapUsageBytes,omitempty"`
}

// AcceleratorStats contains stats for accelerators attached to the container.
type AcceleratorStats struct {
// Make of the accelerator (nvidia, amd, google etc.)
Expand Down

0 comments on commit a05d200

Please sign in to comment.