Documentation ¶
Index ¶
- Constants
- func BuiltinFingerprints() []string
- type ArchFingerprint
- type AzureMetadataPair
- type AzureMetadataTag
- type BridgeFingerprint
- type CGroupFingerprint
- type CNIFingerprint
- type CPU
- type CPUFingerprint
- type CgroupVersionDetector
- type ConsulFingerprint
- type DefaultCgroupVersionDetector
- type DefaultMountPointDetector
- type DefaultNetworkInterfaceDetector
- type DigitalOceanMetadataPair
- type EnvAWSFingerprint
- type EnvAzureFingerprint
- type EnvDigitalOceanFingerprint
- type EnvGCEFingerprint
- type Factory
- type Fingerprint
- func NewArchFingerprint(logger log.Logger) Fingerprint
- func NewBridgeFingerprint(logger log.Logger) Fingerprint
- func NewCGroupFingerprint(logger hclog.Logger) Fingerprint
- func NewCNIFingerprint(logger hclog.Logger) Fingerprint
- func NewCPUFingerprint(logger hclog.Logger) Fingerprint
- func NewConsulFingerprint(logger log.Logger) Fingerprint
- func NewEnvAWSFingerprint(logger log.Logger) Fingerprint
- func NewEnvAzureFingerprint(logger log.Logger) Fingerprint
- func NewEnvDigitalOceanFingerprint(logger log.Logger) Fingerprint
- func NewEnvGCEFingerprint(logger log.Logger) Fingerprint
- func NewFingerprint(name string, logger log.Logger) (Fingerprint, error)
- func NewHostFingerprint(logger log.Logger) Fingerprint
- func NewLandlockFingerprint(logger hclog.Logger) Fingerprint
- func NewMemoryFingerprint(logger log.Logger) Fingerprint
- func NewNetworkFingerprint(logger log.Logger) Fingerprint
- func NewNomadFingerprint(logger log.Logger) Fingerprint
- func NewPluginsCNIFingerprint(logger hclog.Logger) Fingerprint
- func NewSignalFingerprint(logger log.Logger) Fingerprint
- func NewStorageFingerprint(logger log.Logger) Fingerprint
- func NewVaultFingerprint(logger log.Logger) Fingerprint
- type FingerprintRequest
- type FingerprintResponse
- type GCEMetadataNetworkInterface
- type HealthCheck
- type HostFingerprint
- type LandlockFingerprint
- type MemoryFingerprint
- type MountPointDetector
- type NetworkFingerprint
- type NetworkInterfaceDetector
- type NomadFingerprint
- type PluginsCNIFingerprint
- type ReloadableFingerprint
- type ReqError
- type SignalFingerprint
- type StaticFingerprinter
- type StorageFingerprint
- type VaultFingerprint
Constants ¶
const ( // AzureMetadataURL is where the Azure metadata server normally resides. We hardcode the // "instance" path as well since it's the only one we access here. AzureMetadataURL = "http://169.254.169.254/metadata/instance/" // AzureMetadataAPIVersion is the version used when contacting the Azure metadata // services. AzureMetadataAPIVersion = "2019-06-04" // AzureMetadataTimeout is the timeout used when contacting the Azure metadata // services. AzureMetadataTimeout = 2 * time.Second )
const ( // DigitalOceanMetadataURL is where the DigitalOcean metadata api normally resides. // https://docs.digitalocean.com/products/droplets/how-to/retrieve-droplet-metadata/#how-to-retrieve-droplet-metadata DigitalOceanMetadataURL = "http://169.254.169.254/metadata/v1/" // DigitalOceanMetadataTimeout is the timeout used when contacting the DigitalOcean metadata // services. DigitalOceanMetadataTimeout = 2 * time.Second )
const ( // This is where the GCE metadata server normally resides. We hardcode the // "instance" path as well since it's the only one we access here. DEFAULT_GCE_URL = "http://169.254.169.254/computeMetadata/v1/instance/" // GceMetadataTimeout is the timeout used when contacting the GCE metadata // service GceMetadataTimeout = 2 * time.Second )
const ( EmptyDuration = time.Duration(0) // TightenNetworkTimeoutsConfig is a config key that can be used during // tests to tighten the timeouts for fingerprinters that make network calls. TightenNetworkTimeoutsConfig = "test.tighten_network_timeouts" )
EmptyDuration is to be used by fingerprinters that are not periodic.
const ( // AwsMetadataTimeout is the timeout used when contacting the AWS metadata // services. AwsMetadataTimeout = 2 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func BuiltinFingerprints ¶
func BuiltinFingerprints() []string
BuiltinFingerprints is a slice containing the key names of all registered fingerprints available. The order of this slice should be preserved when fingerprinting.
Types ¶
type ArchFingerprint ¶
type ArchFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
ArchFingerprint is used to fingerprint the architecture
func (*ArchFingerprint) Fingerprint ¶
func (f *ArchFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type AzureMetadataPair ¶ added in v1.6.105
type AzureMetadataPair struct {
// contains filtered or unexported fields
}
type AzureMetadataTag ¶ added in v1.6.105
type BridgeFingerprint ¶ added in v1.6.105
type BridgeFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
func (*BridgeFingerprint) Fingerprint ¶ added in v1.6.105
func (f *BridgeFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type CGroupFingerprint ¶ added in v0.3.0
type CGroupFingerprint struct {
// contains filtered or unexported fields
}
func (*CGroupFingerprint) Fingerprint ¶ added in v0.3.0
func (f *CGroupFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
Fingerprint tries to find a valid cgroup mount point and the version of cgroups if a mount-point is present.
type CNIFingerprint ¶ added in v1.6.105
type CNIFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
CNIFingerprint creates a fingerprint of the CNI configuration(s) on the Nomad client.
func (*CNIFingerprint) Fingerprint ¶ added in v1.6.105
func (f *CNIFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
func (*CNIFingerprint) Reload ¶ added in v1.6.105
func (f *CNIFingerprint) Reload()
type CPU ¶ added in v1.6.105
type CPU struct { // use small units to reduce size of the embedded table Cores uint32 // good for 4 billion cores MHz uint32 // good for 4 billion MHz }
CPU contains virtual core count and processor baseline performance.
func LookupEC2CPU ¶ added in v1.6.105
LookupEC2CPU returns the virtual core count and core speed information from a lookup table generated from the Amazon EC2 API.
If the instance type does not exist, nil is returned.
type CPUFingerprint ¶
type CPUFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
CPUFingerprint is used to fingerprint the CPU
func (*CPUFingerprint) Fingerprint ¶
func (f *CPUFingerprint) Fingerprint(request *FingerprintRequest, response *FingerprintResponse) error
type CgroupVersionDetector ¶ added in v1.6.105
type CgroupVersionDetector interface { // CgroupVersion returns v1 or v2 depending on the cgroups version in use. CgroupVersion() string }
CgroupVersionDetector isolates calls to the cgroup library.
type ConsulFingerprint ¶
type ConsulFingerprint struct {
// contains filtered or unexported fields
}
ConsulFingerprint is used to fingerprint for Consul
func (*ConsulFingerprint) Fingerprint ¶
func (f *ConsulFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type DefaultCgroupVersionDetector ¶ added in v1.6.105
type DefaultCgroupVersionDetector struct { }
DefaultCgroupVersionDetector implements the version detector which calls the cgroups library directly.
func (*DefaultCgroupVersionDetector) CgroupVersion ¶ added in v1.6.105
func (*DefaultCgroupVersionDetector) CgroupVersion() string
type DefaultMountPointDetector ¶ added in v0.3.0
type DefaultMountPointDetector struct { }
DefaultMountPointDetector implements the interface detector which calls the cgroups library directly
func (*DefaultMountPointDetector) MountPoint ¶ added in v0.3.0
func (*DefaultMountPointDetector) MountPoint() (string, error)
MountPoint calls out to the default cgroup library.
type DefaultNetworkInterfaceDetector ¶ added in v0.2.0
type DefaultNetworkInterfaceDetector struct { }
Implements the interface detector which calls net directly
func (*DefaultNetworkInterfaceDetector) InterfaceByName ¶ added in v0.2.0
func (b *DefaultNetworkInterfaceDetector) InterfaceByName(name string) (*net.Interface, error)
func (*DefaultNetworkInterfaceDetector) Interfaces ¶ added in v0.2.0
func (b *DefaultNetworkInterfaceDetector) Interfaces() ([]net.Interface, error)
type DigitalOceanMetadataPair ¶ added in v1.6.105
type DigitalOceanMetadataPair struct {
// contains filtered or unexported fields
}
type EnvAWSFingerprint ¶
type EnvAWSFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
EnvAWSFingerprint is used to fingerprint AWS metadata
func (*EnvAWSFingerprint) Fingerprint ¶
func (f *EnvAWSFingerprint) Fingerprint(request *FingerprintRequest, response *FingerprintResponse) error
type EnvAzureFingerprint ¶ added in v1.6.105
type EnvAzureFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
EnvAzureFingerprint is used to fingerprint Azure metadata
func (*EnvAzureFingerprint) Fingerprint ¶ added in v1.6.105
func (f *EnvAzureFingerprint) Fingerprint(request *FingerprintRequest, response *FingerprintResponse) error
type EnvDigitalOceanFingerprint ¶ added in v1.6.105
type EnvDigitalOceanFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
EnvDigitalOceanFingerprint is used to fingerprint DigitalOcean metadata
func (*EnvDigitalOceanFingerprint) Fingerprint ¶ added in v1.6.105
func (f *EnvDigitalOceanFingerprint) Fingerprint(request *FingerprintRequest, response *FingerprintResponse) error
type EnvGCEFingerprint ¶ added in v0.2.0
type EnvGCEFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
EnvGCEFingerprint is used to fingerprint GCE metadata
func (*EnvGCEFingerprint) Fingerprint ¶ added in v0.2.0
func (f *EnvGCEFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type Factory ¶
type Factory func(log.Logger) Fingerprint
Factory is used to instantiate a new Fingerprint
type Fingerprint ¶
type Fingerprint interface { // Fingerprint is used to update properties of the Node, // and returns a diff of updated node attributes and a potential error. Fingerprint(*FingerprintRequest, *FingerprintResponse) error // Periodic is a mechanism for the fingerprinter to indicate that it should // be run periodically. The return value is a boolean indicating if it // should be periodic, and if true, a duration. Periodic() (bool, time.Duration) }
Fingerprint is used for doing "fingerprinting" of the host to automatically determine attributes, resources, and metadata about it. Each of these is a heuristic, and many of them can be applied on a particular host.
func NewArchFingerprint ¶
func NewArchFingerprint(logger log.Logger) Fingerprint
NewArchFingerprint is used to create an OS fingerprint
func NewBridgeFingerprint ¶ added in v1.6.105
func NewBridgeFingerprint(logger log.Logger) Fingerprint
func NewCGroupFingerprint ¶ added in v0.3.0
func NewCGroupFingerprint(logger hclog.Logger) Fingerprint
NewCGroupFingerprint returns a new cgroup fingerprinter
func NewCNIFingerprint ¶ added in v1.6.105
func NewCNIFingerprint(logger hclog.Logger) Fingerprint
func NewCPUFingerprint ¶
func NewCPUFingerprint(logger hclog.Logger) Fingerprint
NewCPUFingerprint is used to create a CPU fingerprint
func NewConsulFingerprint ¶
func NewConsulFingerprint(logger log.Logger) Fingerprint
NewConsulFingerprint is used to create a Consul fingerprint
func NewEnvAWSFingerprint ¶
func NewEnvAWSFingerprint(logger log.Logger) Fingerprint
NewEnvAWSFingerprint is used to create a fingerprint from AWS metadata
func NewEnvAzureFingerprint ¶ added in v1.6.105
func NewEnvAzureFingerprint(logger log.Logger) Fingerprint
NewEnvAzureFingerprint is used to create a fingerprint from Azure metadata
func NewEnvDigitalOceanFingerprint ¶ added in v1.6.105
func NewEnvDigitalOceanFingerprint(logger log.Logger) Fingerprint
NewEnvDigitalOceanFingerprint is used to create a fingerprint from DigitalOcean metadata
func NewEnvGCEFingerprint ¶ added in v0.2.0
func NewEnvGCEFingerprint(logger log.Logger) Fingerprint
NewEnvGCEFingerprint is used to create a fingerprint from GCE metadata
func NewFingerprint ¶
func NewFingerprint(name string, logger log.Logger) (Fingerprint, error)
NewFingerprint is used to instantiate and return a new fingerprint given the name and a logger
func NewHostFingerprint ¶
func NewHostFingerprint(logger log.Logger) Fingerprint
NewHostFingerprint is used to create a Host fingerprint
func NewLandlockFingerprint ¶ added in v1.6.105
func NewLandlockFingerprint(logger hclog.Logger) Fingerprint
func NewMemoryFingerprint ¶
func NewMemoryFingerprint(logger log.Logger) Fingerprint
NewMemoryFingerprint is used to create a Memory fingerprint
func NewNetworkFingerprint ¶ added in v0.3.2
func NewNetworkFingerprint(logger log.Logger) Fingerprint
NewNetworkFingerprint returns a new NetworkFingerprinter with the given logger
func NewNomadFingerprint ¶ added in v0.3.2
func NewNomadFingerprint(logger log.Logger) Fingerprint
NewNomadFingerprint is used to create a Nomad fingerprint
func NewPluginsCNIFingerprint ¶ added in v1.6.105
func NewPluginsCNIFingerprint(logger hclog.Logger) Fingerprint
func NewSignalFingerprint ¶ added in v0.5.0
func NewSignalFingerprint(logger log.Logger) Fingerprint
NewSignalFingerprint is used to create a Signal fingerprint
func NewStorageFingerprint ¶
func NewStorageFingerprint(logger log.Logger) Fingerprint
func NewVaultFingerprint ¶ added in v0.5.0
func NewVaultFingerprint(logger log.Logger) Fingerprint
NewVaultFingerprint is used to create a Vault fingerprint
type FingerprintRequest ¶ added in v0.9.0
FingerprintRequest is a request which a fingerprinter accepts to fingerprint the node
type FingerprintResponse ¶ added in v0.9.0
type FingerprintResponse struct { Attributes map[string]string Links map[string]string Resources *structs.Resources // COMPAT(0.10): Remove in 0.10 NodeResources *structs.NodeResources // Detected is a boolean indicating whether the fingerprinter detected // if the resource was available Detected bool }
FingerprintResponse is the response which a fingerprinter annotates with the results of the fingerprint method
func (*FingerprintResponse) AddAttribute ¶ added in v0.9.0
func (f *FingerprintResponse) AddAttribute(name, value string)
AddAttribute adds the name and value for a node attribute to the fingerprint response
func (*FingerprintResponse) AddLink ¶ added in v0.9.0
func (f *FingerprintResponse) AddLink(name, value string)
AddLink adds a link entry to the fingerprint response
func (*FingerprintResponse) RemoveAttribute ¶ added in v0.9.0
func (f *FingerprintResponse) RemoveAttribute(name string)
RemoveAttribute sets the given attribute to empty, which will later remove it entirely from the node
func (*FingerprintResponse) RemoveLink ¶ added in v0.9.0
func (f *FingerprintResponse) RemoveLink(name string)
RemoveLink removes a link entry from the fingerprint response. This will later remove it entirely from the node
type GCEMetadataNetworkInterface ¶ added in v0.2.0
type HealthCheck ¶ added in v0.8.0
type HealthCheck interface { // Check is used to update properties of the node on the status of the health // check HealthCheck(*cstructs.HealthCheckRequest, *cstructs.HealthCheckResponse) error // GetHealthCheckInterval is a mechanism for the health checker to indicate that // it should be run periodically. The return value is a boolean indicating // whether it should be done periodically, and the time interval at which // this check should happen. GetHealthCheckInterval(*cstructs.HealthCheckIntervalRequest, *cstructs.HealthCheckIntervalResponse) error }
HealthCheck is used for doing periodic health checks. On a given time interfal, a health check will be called by the fingerprint manager of the node.
type HostFingerprint ¶
type HostFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
HostFingerprint is used to fingerprint the host
func (*HostFingerprint) Fingerprint ¶
func (f *HostFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type LandlockFingerprint ¶ added in v1.6.105
type LandlockFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
LandlockFingerprint is used to fingerprint the kernel landlock feature.
func (*LandlockFingerprint) Fingerprint ¶ added in v1.6.105
func (f *LandlockFingerprint) Fingerprint(_ *FingerprintRequest, resp *FingerprintResponse) error
type MemoryFingerprint ¶
type MemoryFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
MemoryFingerprint is used to fingerprint the available memory on the node
func (*MemoryFingerprint) Fingerprint ¶
func (f *MemoryFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type MountPointDetector ¶ added in v0.3.0
type MountPointDetector interface { // MountPoint returns a cgroup mount-point. // // In v1, this is one arbitrary subsystem (e.g. /sys/fs/cgroup/cpu). // // In v2, this is the actual root mount point (i.e. /sys/fs/cgroup). MountPoint() (string, error) }
MountPointDetector isolates calls to the cgroup library.
This facilitates testing where we can implement fake mount points to test various code paths.
type NetworkFingerprint ¶
type NetworkFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
NetworkFingerprint is used to fingerprint the Network capabilities of a node
func (*NetworkFingerprint) Fingerprint ¶
func (f *NetworkFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type NetworkInterfaceDetector ¶ added in v0.2.0
type NetworkInterfaceDetector interface { Interfaces() ([]net.Interface, error) InterfaceByName(name string) (*net.Interface, error) Addrs(intf *net.Interface) ([]net.Addr, error) }
An interface to isolate calls to various api in net package This facilitates testing where we can implement fake interfaces and addresses to test varios code paths
type NomadFingerprint ¶ added in v0.3.2
type NomadFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
NomadFingerprint is used to fingerprint the Nomad version
func (*NomadFingerprint) Fingerprint ¶ added in v0.3.2
func (f *NomadFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type PluginsCNIFingerprint ¶ added in v1.6.105
type PluginsCNIFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
PluginsCNIFingerprint creates a fingerprint of the CNI plugins present on the CNI plugin path specified for the Nomad client.
func (*PluginsCNIFingerprint) Fingerprint ¶ added in v1.6.105
func (f *PluginsCNIFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type ReloadableFingerprint ¶ added in v1.6.105
type ReloadableFingerprint interface { Fingerprint Reload() }
ReloadableFingerprint can be implemented if the fingerprinter needs to be run during client reload. If implemented, the client will call Reload during client reload then immediately Fingerprint
type SignalFingerprint ¶ added in v0.5.0
type SignalFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
SignalFingerprint is used to fingerprint the available signals
func (*SignalFingerprint) Fingerprint ¶ added in v0.5.0
func (f *SignalFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type StaticFingerprinter ¶ added in v0.2.0
type StaticFingerprinter struct{}
StaticFingerprinter can be embedded in a struct that has a Fingerprint method to make it non-periodic.
type StorageFingerprint ¶
type StorageFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
StorageFingerprint is used to measure the amount of storage free for applications that the Nomad agent will run on this machine.
func (*StorageFingerprint) Fingerprint ¶
func (f *StorageFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
type VaultFingerprint ¶ added in v0.5.0
type VaultFingerprint struct {
// contains filtered or unexported fields
}
VaultFingerprint is used to fingerprint for Vault
func (*VaultFingerprint) Fingerprint ¶ added in v0.5.0
func (f *VaultFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error
Source Files ¶
- arch.go
- bridge.go
- bridge_linux.go
- cgroup.go
- cgroup_linux.go
- cni.go
- consul.go
- cpu.go
- cpu_linux.go
- env_aws.go
- env_aws_cpu.go
- env_azure.go
- env_digitalocean.go
- env_gce.go
- fingerprint.go
- fingerprint_linux.go
- host.go
- landlock.go
- memory.go
- network.go
- network_linux.go
- nomad.go
- plugins_cni.go
- signal.go
- storage.go
- storage_unix.go
- structs.go
- vault.go