Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bc4cc07

Browse files
Fix async probes missing localhost (#2407)
1 parent 90d000e commit bc4cc07

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎pkg/probe/probe.go‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,14 @@ func (p *Probe) probeContainer() bool {
175175
}
176176

177177
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+
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

217223
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+
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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /