@@ -152,7 +152,11 @@ func (pb *prober) runProbe(ctx context.Context, probeType probeType, p *v1.Probe
152
152
case p .Exec != nil :
153
153
klog .V (4 ).InfoS ("Exec-Probe runProbe" , "pod" , klog .KObj (pod ), "containerName" , container .Name , "execCommand" , p .Exec .Command )
154
154
command := kubecontainer .ExpandContainerCommandOnlyStatic (p .Exec .Command , container .Env )
155
- return pb .exec .Probe (pb .newExecInContainer (ctx , container , containerID , command , timeout ))
155
+ result , output , err := pb .exec .Probe (pb .newExecInContainer (ctx , container , containerID , command , timeout ))
156
+ if err != nil {
157
+ klog .ErrorS (err , "Exec probe failed" , "probeType" , probeType , "pod" , klog .KObj (pod ), "containerName" , container .Name , "command" , command )
158
+ }
159
+ return result , output , err
156
160
157
161
case p .HTTPGet != nil :
158
162
req , err := httpprobe .NewRequestForHTTPGetAction (p .HTTPGet , & container , status .PodIP , "probe" )
@@ -169,7 +173,11 @@ func (pb *prober) runProbe(ctx context.Context, probeType probeType, p *v1.Probe
169
173
headers := p .HTTPGet .HTTPHeaders
170
174
klogV4 .InfoS ("HTTP-Probe" , "scheme" , scheme , "host" , host , "port" , port , "path" , path , "timeout" , timeout , "headers" , headers , "probeType" , probeType )
171
175
}
172
- return pb .http .Probe (req , timeout )
176
+ result , output , err := pb .http .Probe (req , timeout )
177
+ if err != nil {
178
+ klog .ErrorS (err , "HTTP probe failed" , "probeType" , probeType , "pod" , klog .KObj (pod ), "containerName" , container .Name , "request" , req )
179
+ }
180
+ return result , output , err
173
181
174
182
case p .TCPSocket != nil :
175
183
port , err := probe .ResolveContainerPort (p .TCPSocket .Port , & container )
@@ -182,7 +190,11 @@ func (pb *prober) runProbe(ctx context.Context, probeType probeType, p *v1.Probe
182
190
host = status .PodIP
183
191
}
184
192
klog .V (4 ).InfoS ("TCP-Probe" , "host" , host , "port" , port , "timeout" , timeout )
185
- return pb .tcp .Probe (host , port , timeout )
193
+ result , output , err := pb .tcp .Probe (host , port , timeout )
194
+ if err != nil {
195
+ klog .ErrorS (err , "TCP probe failed" , "probeType" , probeType , "pod" , klog .KObj (pod ), "containerName" , container .Name , "host" , host , "port" , port , "timeout" , timeout )
196
+ }
197
+ return result , output , err
186
198
187
199
case p .GRPC != nil :
188
200
host := status .PodIP
@@ -191,7 +203,11 @@ func (pb *prober) runProbe(ctx context.Context, probeType probeType, p *v1.Probe
191
203
service = * p .GRPC .Service
192
204
}
193
205
klog .V (4 ).InfoS ("GRPC-Probe" , "host" , host , "service" , service , "port" , p .GRPC .Port , "timeout" , timeout )
194
- return pb .grpc .Probe (host , service , int (p .GRPC .Port ), timeout )
206
+ result , output , err := pb .grpc .Probe (host , service , int (p .GRPC .Port ), timeout )
207
+ if err != nil {
208
+ klog .ErrorS (err , "GRPC probe failed" , "probeType" , probeType , "pod" , klog .KObj (pod ), "containerName" , container .Name , "host" , host , "service" , service , "port" , p .GRPC .Port , "timeout" , timeout )
209
+ }
210
+ return result , output , err
195
211
196
212
default :
197
213
klog .V (4 ).InfoS ("Failed to find probe builder for container" , "containerName" , container .Name )
0 commit comments