mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: use container memory if containerised for oom notifications (#17062)
Currently we query only the underlying host's memory usage for our memory resource monitor. This PR changes that to check if the workspace is in a container, and if so it queries the container's memory usage, falling back to the host's memory usage if not.
This commit is contained in:
@@ -16,6 +16,10 @@ const (
|
||||
kubernetesDefaultServiceAccountToken = "/var/run/secrets/kubernetes.io/serviceaccount/token" //nolint:gosec
|
||||
)
|
||||
|
||||
func (s *Statter) IsContainerized() (ok bool, err error) {
|
||||
return IsContainerized(s.fs)
|
||||
}
|
||||
|
||||
// IsContainerized returns whether the host is containerized.
|
||||
// This is adapted from https://github.com/elastic/go-sysinfo/tree/main/providers/linux/container.go#L31
|
||||
// with modifications to support Sysbox containers.
|
||||
|
||||
Reference in New Issue
Block a user