INNER CODE UNIT · Go

runHealthCheck

kgateway-dev/kgateway · cmd/sds/main.go:35

func runHealthCheck() {
	addr := healthCheckAddress(os.Getenv("SDS_SERVER_ADDRESS"))
	conn, err := net.DialTimeout("tcp", addr, healthCheckTimeout)
	if err != nil {
		fmt.Fprintf(os.Stderr, "sds healthcheck: %v\n", err)
		os.Exit(1)
	}
	_ = conn.Close()
}

// healthCheckAddress returns the loopback address to probe. SDS always
// serves Envoy over loopback, so we dial 127.0.0.1 using the port from the
// configured bind address (env), falling back to the default. Resolving
// against loopback keeps the probe correct even if the bind address is a
// wildcard (e.g. 0.0.0.0:8234) or unset.
func healthCheckAddress(env string) string {
	if env == "" {
		env = defaultSDSAddress

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…