File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,14 @@ func (p *Probe) probeContainer() bool {
175
175
}
176
176
177
177
func (p * Probe ) httpProbe () error {
178
+ // to mimic k8s probe functionality
179
+ targetHost := p .HTTPGet .Host
180
+ if p .HTTPGet .Host == "" {
181
+ targetHost = "localhost"
182
+ }
183
+
178
184
targetURL := s .EnsurePrefix (
179
- net .JoinHostPort (p . HTTPGet . Host , p .HTTPGet .Port .String ())+ s .EnsurePrefix (p .HTTPGet .Path , "/" ),
185
+ net .JoinHostPort (targetHost , p .HTTPGet .Port .String ())+ s .EnsurePrefix (p .HTTPGet .Path , "/" ),
180
186
"http://" ,
181
187
)
182
188
@@ -215,8 +221,14 @@ func (p *Probe) httpProbe() error {
215
221
}
216
222
217
223
func (p * Probe ) tcpProbe () error {
224
+ // to mimic k8s probe functionality
225
+ targetHost := p .TCPSocket .Host
226
+ if p .TCPSocket .Host == "" {
227
+ targetHost = "localhost"
228
+ }
229
+
218
230
timeout := time .Duration (p .TimeoutSeconds ) * time .Second
219
- address := net .JoinHostPort (p . TCPSocket . Host , p .TCPSocket .Port .String ())
231
+ address := net .JoinHostPort (targetHost , p .TCPSocket .Port .String ())
220
232
conn , err := net .DialTimeout ("tcp" , address , timeout )
221
233
if err != nil {
222
234
return err
You can’t perform that action at this time.
0 commit comments