@@ -19,19 +19,21 @@ package systemlogmonitor
1919import (
2020 "encoding/json"
2121 "io/ioutil"
22- "k8s.io/heapster/common/kubernetes"
2322 clientset "k8s.io/client-go/kubernetes"
23+ "k8s.io/heapster/common/kubernetes"
2424 "k8s.io/node-problem-detector/cmd/options"
2525 "net/url"
2626 "os"
2727 "path/filepath"
2828 "regexp"
2929 "strings"
30- "time"
30+
3131 "fmt"
32+ "time"
3233
3334 "github.com/golang/glog"
3435
36+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3537 "k8s.io/node-problem-detector/pkg/problemdaemon"
3638 "k8s.io/node-problem-detector/pkg/problemmetrics"
3739 "k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers"
@@ -42,7 +44,6 @@ import (
4244 "k8s.io/node-problem-detector/pkg/util"
4345 "k8s.io/node-problem-detector/pkg/util/tomb"
4446 "k8s.io/node-problem-detector/pkg/version"
45- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4647)
4748
4849const (
@@ -51,8 +52,8 @@ const (
5152)
5253
5354var (
54- uuidRegx * regexp.Regexp
55- k8sClient * clientset.Clientset
55+ uuidRegx * regexp.Regexp
56+ k8sClient * clientset.Clientset
5657)
5758
5859func init () {
@@ -78,7 +79,7 @@ type logMonitor struct {
7879 tomb * tomb.Tomb
7980}
8081
81- func InitK8sClientOrDie (options * options.NodeProblemDetectorOptions ) * clientset.Clientset {
82+ func InitK8sClientOrDie (options * options.NodeProblemDetectorOptions ) * clientset.Clientset {
8283 uri , _ := url .Parse (options .ApiServerOverride )
8384 cfg , err := kubernetes .GetKubeClientConfig (uri )
8485 if err != nil {
@@ -201,9 +202,10 @@ func (l *logMonitor) generateStatus(logs []*logtypes.Log, rule systemlogtypes.Ru
201202 // We use the timestamp of the first log line as the timestamp of the status.
202203 timestamp := logs [0 ].Timestamp
203204 message := generateMessage (logs )
204- if rule .Reason == OOMREASON && k8sClient != nil {
205+ if rule .Reason == OOMREASON && k8sClient != nil {
205206 uuid := string (uuidRegx .Find ([]byte (message )))
206- uuid = strings .ReplaceAll (uuid ,"_" ,"-" )
207+
208+ uuid = strings .ReplaceAll (uuid , "_" , "-" )
207209 pl , err := k8sClient .CoreV1 ().Pods ("" ).List (metav1.ListOptions {})
208210 if err != nil {
209211 glog .Error ("Error in getting pods: %v" , err .Error ())
@@ -222,10 +224,10 @@ func (l *logMonitor) generateStatus(logs []*logtypes.Log, rule systemlogtypes.Ru
222224 if rule .Type == types .Temp {
223225 // For temporary error only generate event
224226 events = append (events , types.Event {
225- Severity : types .Warn ,
226- Timestamp : timestamp ,
227- Reason : rule .Reason ,
228- Message : message ,
227+ Severity : types .Warn ,
228+ Timestamp : timestamp ,
229+ Reason : rule .Reason ,
230+ Message : message ,
229231 })
230232 } else {
231233 // For permanent error changes the condition
0 commit comments