@@ -60,14 +60,20 @@ func (w *watcher) releaseAll(ctx context.Context) {
60
60
filepath := filepath .Join (w .path , containerID )
61
61
file , err := os .Open (filepath )
62
62
if err != nil {
63
- w .log .Error ("failed to open file" , zap .Error (err ))
63
+ w .log .Error ("failed to open container file for IP release" ,
64
+ zap .String ("filepath" , filepath ),
65
+ zap .String ("containerID" , containerID ),
66
+ zap .Error (err ))
64
67
continue
65
68
}
66
69
67
70
data , errReadingFile := io .ReadAll (file )
68
71
file .Close ()
69
72
if errReadingFile != nil {
70
- w .log .Error ("failed to read file content" , zap .Error (errReadingFile ))
73
+ w .log .Error ("failed to read container file content for IP release" ,
74
+ zap .String ("filepath" , filepath ),
75
+ zap .String ("containerID" , containerID ),
76
+ zap .Error (errReadingFile ))
71
77
continue
72
78
}
73
79
podInterfaceID := string (data )
@@ -80,7 +86,10 @@ func (w *watcher) releaseAll(ctx context.Context) {
80
86
w .log .Info ("successfully released IP for missed delete" , zap .String ("containerID" , containerID ))
81
87
delete (w .pendingDelete , containerID )
82
88
if err := removeFile (containerID , w .path ); err != nil {
83
- w .log .Error ("failed to remove file for missed delete" , zap .Error (err ))
89
+ w .log .Error ("failed to remove container file after IP release" ,
90
+ zap .String ("containerID" , containerID ),
91
+ zap .String ("path" , w .path ),
92
+ zap .Error (err ))
84
93
}
85
94
}
86
95
}
0 commit comments