Skip to content

Commit bc80700

Browse files
Merge pull request #152 from dtantsur/probe-head
🐛 Use HEAD requests instead of GET in probes
2 parents 37b4a03 + 755f10f commit bc80700

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pkg/ironic/containers.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,26 @@ func newURLProbeHandler(ironic *metal3api.Ironic, https bool, port int, path str
388388
proto = "https"
389389
}
390390

391-
curlArgs := "-sSkL"
391+
curlCmd := []string{
392+
"curl",
393+
"--head",
394+
"--insecure",
395+
// NOTE(dtantsur): prevent redirects from being treated as success
396+
"--location",
397+
"--silent",
398+
"--show-error",
399+
// NOTE(dtantsur): --head outputs headers even with --silent
400+
"--output", "/dev/null",
401+
}
392402
if requiresOk {
393-
curlArgs += "f"
403+
curlCmd = append(curlCmd, "--fail")
394404
}
395405

396406
// NOTE(dtantsur): we could use HTTP GET probe but we cannot pass the certificate there.
397407
url := fmt.Sprintf("%s://127.0.0.1:%d%s", proto, port, path)
398408
return corev1.ProbeHandler{
399409
Exec: &corev1.ExecAction{
400-
Command: []string{"curl", curlArgs, url},
410+
Command: append(curlCmd, url),
401411
},
402412
}
403413
}

0 commit comments

Comments
 (0)