probe

package
v1.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package probe is the readiness probe of a device pod. It is a tiny static program, copied by an init container into an emptyDir that the device container mounts read-only, because a device image may carry no shell and no curl. The kubelet runs it as an exec readiness probe inside the container, so it sees the container's own network namespace and file system.

Index

Constants

View Source
const (
	SchemeTCP   = "tcp"
	SchemeHTTP  = "http"
	SchemeHTTPS = "https"

	// InstalledName is the file name of the copy in the shared directory.
	InstalledName = "probe"
)

Variables

This section is empty.

Functions

func Install

func Install(src, dir string) error

Install copies the program src to dir/InstalledName, read-only and executable by everybody, so the device container can run it as any user and cannot change it. The copy is atomic: a rerun of the init container never leaves half a file.

func LocalAddrs

func LocalAddrs() []string

LocalAddrs are the addresses the probe tries: the loopback first, then every global unicast address of the container (an application may listen only on the pod's own address).

Types

type Check

type Check struct {
	// File is a marker the application creates; the check passes once it exists.
	File string
	// Port is a port the application must answer on, with Scheme tcp (a connection is accepted), http or https (an HTTP
	// answer with a status below 500: any answer proves the application serves; 4xx is a page behind a login, not a
	// failure).
	Port   int
	Scheme string
}

Check is what makes a device ready. Every set part must pass; an empty Check is an error, not success.

func (Check) Run

func (c Check) Run(ctx context.Context, addrs func() []string) error

Run checks the marker and the port. addrs lists the addresses of the container to try for the port (see LocalAddrs).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL