Documentation
¶
Overview ¶
Package check implements a set of primitive checks that are used to validate inspector rules
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
A Check implements a workflow that validates a condition. If an error occurs while running the check, it returns false and the error. If the check is able to successfully determine the condition, it returns true if satisfied, or false otherwise.
type ClosableCheck ¶
A ClosableCheck implements a long-running check workflow that requires closing
type Distro ¶
type Distro string
Distro is a Linux distribution that the inspector supports
func DetectDistro ¶
DetectDistro uses the /etc/os-release file to get distro information.
type DockerInPathCheck ¶ added in v1.8.0
type DockerInPathCheck struct {
InstallationDisabled bool
}
DockerInPathCheck returns true if the docker binary is on the executable path The check only runs when InstallationDisabled is true and the binary should already be insalled
func (DockerInPathCheck) Check ¶ added in v1.8.0
func (c DockerInPathCheck) Check() (bool, error)
type ExecutableInPathCheck ¶
type ExecutableInPathCheck struct {
Name string
}
ExecutableInPathCheck checks whether the binary is on the executable path
func (ExecutableInPathCheck) Check ¶
func (c ExecutableInPathCheck) Check() (bool, error)
Check returns true if the executable is in the path
type FileContentCheck ¶
FileContentCheck runs a search against the contents of the specified file. The SearchString is a regular expression that is in accordance with the RE2 syntax defined by the Go regexp package.
func (FileContentCheck) Check ¶
func (c FileContentCheck) Check() (bool, error)
Check returns true if file contents match the regular expression. Otherwise, returns false. If an error occurrs, returns false and the error.
type FreeSpaceCheck ¶ added in v1.3.0
FreeSpaceCheck checks the available disk space on a path
func (FreeSpaceCheck) Check ¶ added in v1.3.0
func (c FreeSpaceCheck) Check() (bool, error)
Check returns true if the path has enough free space. Otherwise return false.
type PackageCheck ¶ added in v1.3.0
type PackageCheck struct { PackageQuery PackageQuery PackageManager PackageManager InstallationDisabled bool DockerInstallationDisabled bool DisconnectedInstallation bool }
The PackageCheck uses the operating system to determine whether a package is installed.
func (PackageCheck) Check ¶ added in v1.3.0
func (c PackageCheck) Check() (bool, error)
Check verifies a package is installed or in some cases available. If DockerInstallationDisabled and a package contains "docker" always return true. If InstallationDisabled, packages must be istalled. If packages are not isntalled check if available and give useful feedback. If DisconnectedInstallation, packages must be either installed or available.
type PackageManager ¶
type PackageManager interface { IsAvailable(PackageQuery) (bool, error) IsInstalled(PackageQuery) (bool, error) }
PackageManager runs queries against the underlying operating system's package manager
func NewPackageManager ¶
func NewPackageManager(distro Distro) (PackageManager, error)
NewPackageManager returns a package manager for the given distribution
type PackageNotInstalledCheck ¶ added in v1.7.0
type PackageNotInstalledCheck struct { PackageQuery PackageQuery AcceptablePackageVersion string PackageManager PackageManager InstallationDisabled bool DockerInstallationDisabled bool }
func (PackageNotInstalledCheck) Check ¶ added in v1.7.0
func (c PackageNotInstalledCheck) Check() (bool, error)
Check returns true if the specified package is not installed. This will also return true if the version installed matches AcceptablePackageVersion. When InstallationDisabled is true this check will always return true.
type PackageQuery ¶
PackageQuery is a query for finding a package
func (PackageQuery) String ¶
func (p PackageQuery) String() string
type Python2Check ¶
type Python2Check struct {
SupportedVersions []string
}
Python2Check returns true if python 2 is installed on the node and the version prefix-matches one of the supported versions
func (Python2Check) Check ¶
func (c Python2Check) Check() (bool, error)
type TCPPortClientCheck ¶
type TCPPortClientCheck struct { // IPAddress is the IP of the remote node IPAddress string // PortNumber is the target service port PortNumber int // Timeout is the maximum amount of time the check will // wait when connecting to the server before bailing out Timeout time.Duration }
TCPPortClientCheck verifies that a given port on a remote node is accessible through the network
func (*TCPPortClientCheck) Check ¶
func (c *TCPPortClientCheck) Check() (bool, error)
Check returns true if the TCP connection is established and the server returns the expected response. Otherwise, returns false and an error message
type TCPPortServerCheck ¶
type TCPPortServerCheck struct { PortNumber int ProcName string // contains filtered or unexported fields }
TCPPortServerCheck ensures that the given port is free, or bound to the right process. In the case that it is free, it stands up a TCP server that can be used to check TCP connectivity to the host using TCPPortClientCheck
func (*TCPPortServerCheck) Check ¶
func (c *TCPPortServerCheck) Check() (bool, error)
Check returns true if the port is free, or taken by the expected process.
func (*TCPPortServerCheck) Close ¶
func (c *TCPPortServerCheck) Close() error
Close the TCP server if it was started. Otherwise this is a noop.