@@ -124,12 +124,12 @@ func newWatcher(confDir string) (*fsnotify.Watcher, error) {
124
124
// Ensure plugin directory exists, because the following monitoring logic
125
125
// relies on that.
126
126
if err := os .MkdirAll (confDir , 0755 ); err != nil {
127
- return nil , fmt .Errorf ("failed to create %q: %v" , confDir , err )
127
+ return nil , fmt .Errorf ("failed to create directory %q: %v" , confDir , err )
128
128
}
129
129
130
130
watcher , err := fsnotify .NewWatcher ()
131
131
if err != nil {
132
- return nil , fmt .Errorf ("could not create new watcher %v" , err )
132
+ return nil , fmt .Errorf ("failed to create new watcher %v" , err )
133
133
}
134
134
defer func () {
135
135
// Close watcher on error
@@ -278,13 +278,13 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork
278
278
if strings .HasSuffix (confFile , ".conflist" ) {
279
279
confList , err = libcni .ConfListFromFile (confFile )
280
280
if err != nil {
281
- logrus .Warningf ("Error loading CNI config list file %s: %v" , confFile , err )
281
+ logrus .Errorf ("Error loading CNI config list file %s: %v" , confFile , err )
282
282
continue
283
283
}
284
284
} else {
285
285
conf , err := libcni .ConfFromFile (confFile )
286
286
if err != nil {
287
- logrus .Warningf ("Error loading CNI config file %s: %v" , confFile , err )
287
+ logrus .Errorf ("Error loading CNI config file %s: %v" , confFile , err )
288
288
continue
289
289
}
290
290
if conf .Network .Type == "" {
@@ -293,7 +293,7 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork
293
293
}
294
294
confList , err = libcni .ConfListFromConf (conf )
295
295
if err != nil {
296
- logrus .Warningf ("Error converting CNI config file %s to list: %v" , confFile , err )
296
+ logrus .Errorf ("Error converting CNI config file %s to list: %v" , confFile , err )
297
297
continue
298
298
}
299
299
}
@@ -324,7 +324,7 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork
324
324
if _ , ok := networks [confList .Name ]; ! ok {
325
325
networks [confList .Name ] = cniNet
326
326
} else {
327
- logrus .Infof ("Ignore CNI network %s (type=%v) at %s because already exists" , confList .Name , confList .Plugins [0 ].Network .Type , confFile )
327
+ logrus .Infof ("Ignored CNI network %s (type=%v) at %s because already exists" , confList .Name , confList .Plugins [0 ].Network .Type , confFile )
328
328
}
329
329
330
330
if defaultNetName == "" {
@@ -351,9 +351,9 @@ func (plugin *cniNetworkPlugin) syncNetworkConfig() error {
351
351
// Update defaultNetName if it is changeable
352
352
if plugin .defaultNetName .changeable {
353
353
plugin .defaultNetName .name = defaultNetName
354
- logrus .Infof ("Update default CNI network name to %s" , defaultNetName )
354
+ logrus .Infof ("Updated default CNI network name to %s" , defaultNetName )
355
355
} else {
356
- logrus .Warnf ("Default CNI network name %s is unchangeable" , plugin .defaultNetName .name )
356
+ logrus .Warningf ("Default CNI network name %s is unchangeable" , plugin .defaultNetName .name )
357
357
}
358
358
359
359
plugin .networks = networks
@@ -482,8 +482,8 @@ func (plugin *cniNetworkPlugin) forEachNetwork(podNetwork *PodNetwork, fromCache
482
482
var newRt * libcni.RuntimeConf
483
483
cniNet , newRt , err = plugin .loadNetworkFromCache (network .Name , rt )
484
484
if err != nil {
485
- logrus .Debugf ("error loading cached network config: %v" , err )
486
- logrus .Debugf ("falling back to loading from existing plugins on disk" )
485
+ logrus .Errorf ("error loading cached network config: %v" , err )
486
+ logrus .Warningf ("falling back to loading from existing plugins on disk" )
487
487
} else {
488
488
// Use the updated RuntimeConf
489
489
rt = newRt
@@ -519,10 +519,10 @@ func bringUpLoopback(netns string) error {
519
519
return err
520
520
}
521
521
if len (v4Addrs ) != 0 {
522
- // sanity check that this is a loopback address
522
+ // check that this is a loopback address
523
523
for _ , addr := range v4Addrs {
524
524
if ! addr .IP .IsLoopback () {
525
- return fmt .Errorf ("loopback interface found with non-loopback address %q" , addr .IP )
525
+ return fmt .Warningf ("loopback interface found with non-loopback address %q" , addr .IP )
526
526
}
527
527
}
528
528
}
@@ -532,10 +532,10 @@ func bringUpLoopback(netns string) error {
532
532
return err
533
533
}
534
534
if len (v6Addrs ) != 0 {
535
- // sanity check that this is a loopback address
535
+ // check that this is a loopback address
536
536
for _ , addr := range v6Addrs {
537
537
if ! addr .IP .IsLoopback () {
538
- return fmt .Errorf ("loopback interface found with non-loopback address %q" , addr .IP )
538
+ return fmt .Warningf ("loopback interface found with non-loopback address %q" , addr .IP )
539
539
}
540
540
}
541
541
}
@@ -616,7 +616,7 @@ func (plugin *cniNetworkPlugin) getCachedNetworkInfo(containerID string) ([]NetA
616
616
cacheFile := filepath .Join (dirPath , fname )
617
617
bytes , err := ioutil .ReadFile (cacheFile )
618
618
if err != nil {
619
- logrus .Warningf ("failed to read CNI cache file %s: %v" , cacheFile , err )
619
+ logrus .Errorf ("failed to read CNI cache file %s: %v" , cacheFile , err )
620
620
continue
621
621
}
622
622
@@ -628,7 +628,7 @@ func (plugin *cniNetworkPlugin) getCachedNetworkInfo(containerID string) ([]NetA
628
628
}{}
629
629
630
630
if err := json .Unmarshal (bytes , & cachedInfo ); err != nil {
631
- logrus .Warningf ("failed to unmarshal CNI cache file %s: %v" , cacheFile , err )
631
+ logrus .Errorf ("failed to unmarshal CNI cache file %s: %v" , cacheFile , err )
632
632
continue
633
633
}
634
634
if cachedInfo .Kind != libcni .CNICacheV1 {
@@ -692,7 +692,7 @@ func (plugin *cniNetworkPlugin) TearDownPodWithContext(ctx context.Context, podN
692
692
693
693
if err := tearDownLoopback (podNetwork .NetNS ); err != nil {
694
694
// ignore error
695
- logrus .Errorf ("Ignoring error tearing down loopback interface: %v" , err )
695
+ logrus .Warningf ("Ignoring error tearing down loopback interface: %v" , err )
696
696
}
697
697
698
698
return plugin .forEachNetwork (& podNetwork , true , func (network * cniNetwork , podNetwork * PodNetwork , rt * libcni.RuntimeConf ) error {
@@ -713,7 +713,7 @@ func checkLoopback(netns string) error {
713
713
}
714
714
715
715
if link .Attrs ().Flags & net .FlagUp != net .FlagUp {
716
- return fmt .Errorf ("loopback interface is down" )
716
+ return fmt .Warningf ("loopback interface is down" )
717
717
}
718
718
719
719
return nil
@@ -797,7 +797,7 @@ func (network *cniNetwork) checkNetwork(ctx context.Context, rt *libcni.RuntimeC
797
797
798
798
result , err = cni .GetNetworkListCachedResult (network .config , rt )
799
799
if err != nil {
800
- logrus .Errorf ("Error GetNetworkListCachedResult : %v" , err )
800
+ logrus .Errorf ("Error getting network list cached result : %v" , err )
801
801
return nil , err
802
802
} else if result != nil {
803
803
return result , nil
@@ -850,7 +850,7 @@ func (network *cniNetwork) checkNetwork(ctx context.Context, rt *libcni.RuntimeC
850
850
func (network * cniNetwork ) deleteFromNetwork (ctx context.Context , rt * libcni.RuntimeConf , cni * libcni.CNIConfig ) error {
851
851
logrus .Infof ("About to del CNI network %s (type=%v)" , network .name , network .config .Plugins [0 ].Network .Type )
852
852
if err := cni .DelNetworkList (ctx , network .config , rt ); err != nil {
853
- logrus .Errorf ("Error deleting network: %v" , err )
853
+ logrus .Errorf ("Error deleting network %s : %v" , network . name , err )
854
854
return err
855
855
}
856
856
return nil
0 commit comments