Skip to content

Commit 29ff791

Browse files
committed
Hack for unsupported OS distros.
1 parent 9ab546a commit 29ff791

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

pkg/kernelmonitor/kernel_log_watcher.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@ func (k *kernelLogWatcher) Watch() (<-chan *types.KernelLog, error) {
7171
if k.cfg.KernelLogPath != "" {
7272
path = k.cfg.KernelLogPath
7373
}
74+
// NOTE(random-liu): This is a hack. KernelMonitor doesn't support some OS distros e.g. GCI. Ideally,
75+
// KernelMonitor should only run on nodes with supported OS distro. However, NodeProblemDetector is
76+
// running as DaemonSet, it has to be deployed on each node (There is no node affinity support for
77+
// DaemonSet now #22205). If some nodes have unsupported OS distro e.g. the OS distro of master node
78+
// in gke/gce is GCI, KernelMonitor will keep throwing out error, and NodeProblemDetector will be
79+
// restarted again and again.
80+
// To avoid this, we decide to add this temporarily hack. When KernelMonitor can't find the kernel
81+
// log file, it will print a log and then return nil channel and no error. Since nil channel will
82+
// always be blocked, the NodeProblemDetector will block forever.
83+
// TODO(random-liu):
84+
// 1. Add journald supports to support GCI.
85+
// 2. Schedule KernelMonitor only on supported node (with node label and selector)
86+
if _, err := os.Stat(path); os.IsNotExist(err) {
87+
glog.Infof("kernel log %q is not found, kernel monitor doesn't support the os distro", path)
88+
return nil, nil
89+
}
7490
start, err := k.getStartPoint(path)
7591
if err != nil {
7692
return nil, err

pkg/problemdetector/problem_detector.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ func (p *problemDetector) Run() error {
6060
glog.Info("Problem detector started")
6161
for {
6262
select {
63-
case status, ok := <-ch:
64-
if !ok {
65-
glog.Errorf("Monitor stopped unexpectedly")
66-
break
67-
}
63+
case status := <-ch:
6864
for _, event := range status.Events {
6965
p.client.Eventf(util.ConvertToAPIEventType(event.Severity), status.Source, event.Reason, event.Message)
7066
}

0 commit comments

Comments
 (0)