Add a warning log, event and metric for cgroup version 1

Signed-off-by: Harshal Patil <harpatil@redhat.com>
This commit is contained in:
Harshal Patil
2024-07-02 13:09:25 -04:00
parent 5c9d4fa23d
commit 68d317a8d1
9 changed files with 46 additions and 0 deletions

View File

@@ -1636,6 +1636,8 @@ func (kl *Kubelet) Run(updates <-chan kubetypes.PodUpdate) {
os.Exit(1)
}
kl.warnCgroupV1Usage()
// Start volume manager
go kl.volumeManager.Run(kl.sourcesReady, wait.NeverStop)
@@ -3021,3 +3023,12 @@ func (kl *Kubelet) PrepareDynamicResources(pod *v1.Pod) error {
func (kl *Kubelet) UnprepareDynamicResources(pod *v1.Pod) error {
return kl.containerManager.UnprepareDynamicResources(pod)
}
func (kl *Kubelet) warnCgroupV1Usage() {
cgroupVersion := kl.containerManager.GetNodeConfig().CgroupVersion
if cgroupVersion == 1 {
kl.recorder.Eventf(kl.nodeRef, v1.EventTypeWarning, events.CgroupV1, cm.CgroupV1MaintenanceModeWarning)
klog.V(2).InfoS("Warning: cgroup v1", "message", cm.CgroupV1MaintenanceModeWarning)
}
metrics.CgroupVersion.Set(float64(cgroupVersion))
}