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 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 }
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 returns true if the package is installed. If pkg installation is disabled, we would like to check if the package is available for install. However, there is no guarantee that the node will have the kismatic package repo configured. For this reason, this check is a no-op when package installation is disabled.
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 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 // contains filtered or unexported fields }
TCPPortServerCheck ensures that the given port is free, and 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 available for the server. Otherwise returns false and an error message