File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 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 {
175175}
176176
177177func (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+
178184 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 , "/" ),
180186 "http://" ,
181187 )
182188
@@ -215,8 +221,14 @@ func (p *Probe) httpProbe() error {
215221}
216222
217223func (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+
218230 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 ())
220232 conn , err := net .DialTimeout ("tcp" , address , timeout )
221233 if err != nil {
222234 return err
You can’t perform that action at this time.
0 commit comments