structs

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MPL-2.0 Imports: 9 Imported by: 505

Documentation

Index

Constants

View Source
const CheckBufSize = 4 * 1024

CheckBufSize is the size of the buffer that is used for job output

Variables

View Source
var DriverStatsNotImplemented = errors.New("stats not implemented for driver")

DriverStatsNotImplemented is the error to be returned if a driver doesn't implement stats.

View Source
var ErrAllocBroadcasterClosed = errors.New("alloc broadcaster closed")

Functions

This section is empty.

Types

type AllocBroadcaster added in v0.6.0

type AllocBroadcaster struct {
	// contains filtered or unexported fields
}

AllocBroadcaster implements an allocation broadcast channel where each listener receives allocation updates. Pending updates are dropped and replaced by newer allocation updates, so listeners may not receive every allocation update. However this ensures Sends never block and listeners only receive the latest allocation update -- never a stale version.

func NewAllocBroadcaster added in v0.6.0

func NewAllocBroadcaster(l hclog.Logger) *AllocBroadcaster

NewAllocBroadcaster returns a new AllocBroadcaster.

func (*AllocBroadcaster) Close added in v0.6.0

func (b *AllocBroadcaster) Close()

Close closes the channel, disabling the sending of further allocation updates. Pending updates are still received by listeners. Safe to call concurrently and more than once.

func (*AllocBroadcaster) Listen added in v0.6.0

func (b *AllocBroadcaster) Listen() *AllocListener

Listen returns a Listener for the broadcast channel. New listeners receive the last sent alloc update.

func (*AllocBroadcaster) Send added in v0.6.0

Send broadcasts an allocation update. Any pending updates are replaced with this version of the allocation to prevent blocking on slow receivers. Returns ErrAllocBroadcasterClosed if called after broadcaster is closed.

type AllocExecRequest added in v0.9.2

type AllocExecRequest struct {
	// AllocID is the allocation to stream logs from
	AllocID string

	// Task is the task to stream logs from
	Task string

	// Tty indicates whether to allocate a pseudo-TTY
	Tty bool

	// Cmd is the command to be executed
	Cmd []string

	structs.QueryOptions
}

AllocExecRequest is the initial request for execing into an Alloc task

type AllocFileInfo added in v0.8.0

type AllocFileInfo struct {
	Name        string
	IsDir       bool
	Size        int64
	FileMode    string
	ModTime     time.Time
	ContentType string `json:",omitempty"`
}

AllocFileInfo holds information about a file inside the AllocDir

type AllocHookResources added in v0.11.0

type AllocHookResources struct {
	CSIMounts map[string]*csimanager.MountInfo
	// contains filtered or unexported fields
}

AllocHookResources contains data that is provided by AllocRunner Hooks for consumption by TaskRunners

func (*AllocHookResources) GetCSIMounts added in v0.11.0

func (a *AllocHookResources) GetCSIMounts() map[string]*csimanager.MountInfo

func (*AllocHookResources) SetCSIMounts added in v0.11.0

func (a *AllocHookResources) SetCSIMounts(m map[string]*csimanager.MountInfo)

type AllocListener added in v0.6.0

type AllocListener struct {
	// contains filtered or unexported fields
}

AllocListener implements a listening endpoint for an allocation broadcast channel.

func (*AllocListener) Ch added in v0.6.0

func (l *AllocListener) Ch() <-chan *structs.Allocation

func (*AllocListener) Close added in v0.6.0

func (l *AllocListener) Close()

Close closes the Listener, disabling the receival of further messages. Safe to call more than once and concurrently with receiving on Ch.

type AllocResourceUsage

type AllocResourceUsage struct {
	// ResourceUsage is the summation of the task resources
	ResourceUsage *ResourceUsage

	// Tasks contains the resource usage of each task
	Tasks map[string]*TaskResourceUsage

	// The max timestamp of all the Tasks
	Timestamp int64
}

AllocResourceUsage holds the aggregated task resource usage of the allocation.

type AllocStatsRequest added in v0.8.0

type AllocStatsRequest struct {
	// AllocID is the allocation to retrieves stats for
	AllocID string

	// Task is an optional filter to only request stats for the task.
	Task string

	structs.QueryOptions
}

AllocStatsRequest is used to request the resource usage of a given allocation, potentially filtering by task

type AllocStatsResponse added in v0.8.0

type AllocStatsResponse struct {
	Stats *AllocResourceUsage
	structs.QueryMeta
}

AllocStatsResponse is used to return the resource usage of a given allocation.

type CSIControllerQuery added in v0.11.0

type CSIControllerQuery struct {
	// ControllerNodeID is the node that should be targeted by the request
	ControllerNodeID string

	// PluginID is the plugin that should be targeted on the given node.
	PluginID string
}

CSIControllerQuery is used to specify various flags for queries against CSI Controllers

func (*CSIControllerQuery) SetControllerNodeID added in v1.1.0

func (c *CSIControllerQuery) SetControllerNodeID(nodeID string)

type CSIControllerRequest added in v1.1.0

type CSIControllerRequest interface {
	SetControllerNodeID(string)
}

CSIControllerRequest interface lets us set embedded CSIControllerQuery fields in the server

type CSIVolumeMountOptions added in v0.11.0

type CSIVolumeMountOptions struct {
	// Filesystem is the desired filesystem type that should be used by the volume
	// (e.g ext4, aufs, zfs). This field is optional.
	Filesystem string

	// MountFlags contain the mount options that should be used for the volume.
	// These may contain _sensitive_ data and should not be leaked to logs or
	// returned in debugging data.
	// The total size of this field must be under 4KiB.
	MountFlags []string
}

CSIVolumeMountOptions contains the mount options that should be provided when attaching and mounting a volume with the CSIVolumeAttachmentModeFilesystem attachment mode.

func (*CSIVolumeMountOptions) ToCSIMountOptions added in v1.1.1

func (c *CSIVolumeMountOptions) ToCSIMountOptions() *structs.CSIMountOptions

type ClientCSIControllerAttachVolumeRequest added in v0.11.0

type ClientCSIControllerAttachVolumeRequest struct {
	// The external ID of the volume to be used on a node.
	// This field is REQUIRED.
	VolumeID string

	// The ID of the node. This field is REQUIRED. This must match the NodeID that
	// is fingerprinted by the target node for this plugin name.
	ClientCSINodeID string

	// AttachmentMode indicates how the volume should be attached and mounted into
	// a task.
	AttachmentMode structs.CSIVolumeAttachmentMode

	// AccessMode indicates the desired concurrent access model for the volume
	AccessMode structs.CSIVolumeAccessMode

	// MountOptions is an optional field that contains additional configuration
	// when providing an AttachmentMode of CSIVolumeAttachmentModeFilesystem
	MountOptions *CSIVolumeMountOptions

	// ReadOnly indicates that the volume will be used in a readonly fashion. This
	// only works when the Controller has the PublishReadonly capability.
	ReadOnly bool

	// Secrets required by plugin to complete the controller publish
	// volume request. This field is OPTIONAL.
	Secrets structs.CSISecrets

	// Volume context as returned by storage provider in CreateVolumeResponse.
	// This field is optional.
	VolumeContext map[string]string

	CSIControllerQuery
}

func (*ClientCSIControllerAttachVolumeRequest) ToCSIRequest added in v0.11.0

type ClientCSIControllerAttachVolumeResponse added in v0.11.0

type ClientCSIControllerAttachVolumeResponse struct {
	// Opaque static publish properties of the volume. SP MAY use this
	// field to ensure subsequent `NodeStageVolume` or `NodePublishVolume`
	// calls calls have contextual information.
	// The contents of this field SHALL be opaque to nomad.
	// The contents of this field SHALL NOT be mutable.
	// The contents of this field SHALL be safe for the nomad to cache.
	// The contents of this field SHOULD NOT contain sensitive
	// information.
	// The contents of this field SHOULD NOT be used for uniquely
	// identifying a volume. The `volume_id` alone SHOULD be sufficient to
	// identify the volume.
	// This field is OPTIONAL and when present MUST be passed to
	// subsequent `NodeStageVolume` or `NodePublishVolume` calls
	PublishContext map[string]string
}

ClientCSIControllerDetachVolumeRequest is the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform ControllerUnpublish for a volume on a specific client.

type ClientCSIControllerCreateSnapshotRequest added in v1.1.0

type ClientCSIControllerCreateSnapshotRequest struct {
	ExternalSourceVolumeID string
	Name                   string
	Secrets                structs.CSISecrets
	Parameters             map[string]string

	CSIControllerQuery
}

ClientCSIControllerCreateSnapshotRequest the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform CreateSnapshot

func (*ClientCSIControllerCreateSnapshotRequest) ToCSIRequest added in v1.1.0

type ClientCSIControllerCreateSnapshotResponse added in v1.1.0

type ClientCSIControllerCreateSnapshotResponse struct {
	ID                     string
	ExternalSourceVolumeID string
	SizeBytes              int64
	CreateTime             int64
	IsReady                bool
}

type ClientCSIControllerCreateVolumeRequest added in v1.1.0

type ClientCSIControllerCreateVolumeRequest struct {
	Name               string
	VolumeCapabilities []*structs.CSIVolumeCapability
	MountOptions       *structs.CSIMountOptions
	Parameters         map[string]string
	Secrets            structs.CSISecrets
	CapacityMin        int64
	CapacityMax        int64
	SnapshotID         string
	CloneID            string

	CSIControllerQuery
}

ClientCSIControllerCreateVolumeRequest the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform CreateVolume

func (*ClientCSIControllerCreateVolumeRequest) ToCSIRequest added in v1.1.0

type ClientCSIControllerCreateVolumeResponse added in v1.1.0

type ClientCSIControllerCreateVolumeResponse struct {
	ExternalVolumeID string
	CapacityBytes    int64
	VolumeContext    map[string]string
}

type ClientCSIControllerDeleteSnapshotRequest added in v1.1.0

type ClientCSIControllerDeleteSnapshotRequest struct {
	ID      string
	Secrets structs.CSISecrets

	CSIControllerQuery
}

ClientCSIControllerDeleteSnapshotRequest the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform DeleteSnapshot

func (*ClientCSIControllerDeleteSnapshotRequest) ToCSIRequest added in v1.1.0

type ClientCSIControllerDeleteSnapshotResponse added in v1.1.0

type ClientCSIControllerDeleteSnapshotResponse struct{}

type ClientCSIControllerDeleteVolumeRequest added in v1.1.0

type ClientCSIControllerDeleteVolumeRequest struct {
	ExternalVolumeID string
	Secrets          structs.CSISecrets

	CSIControllerQuery
}

ClientCSIControllerDeleteVolumeRequest the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform DeleteVolume

func (*ClientCSIControllerDeleteVolumeRequest) ToCSIRequest added in v1.1.0

type ClientCSIControllerDeleteVolumeResponse added in v1.1.0

type ClientCSIControllerDeleteVolumeResponse struct{}

type ClientCSIControllerDetachVolumeRequest added in v0.11.0

type ClientCSIControllerDetachVolumeRequest struct {
	// The external ID of the volume to be unpublished for the node
	// This field is REQUIRED.
	VolumeID string

	// The CSI Node ID for the Node that the volume should be detached from.
	// This field is REQUIRED. This must match the NodeID that is fingerprinted
	// by the target node for this plugin name.
	ClientCSINodeID string

	// Secrets required by plugin to complete the controller unpublish
	// volume request. This field is OPTIONAL.
	Secrets structs.CSISecrets

	CSIControllerQuery
}

func (*ClientCSIControllerDetachVolumeRequest) ToCSIRequest added in v0.11.0

type ClientCSIControllerDetachVolumeResponse added in v0.11.0

type ClientCSIControllerDetachVolumeResponse struct{}

type ClientCSIControllerListSnapshotsRequest added in v1.1.0

type ClientCSIControllerListSnapshotsRequest struct {
	// these pagination fields match the pagination fields of the plugins and
	// not Nomad's own fields, for clarity when mapping between the two RPCs
	MaxEntries    int32
	StartingToken string
	Secrets       structs.CSISecrets

	CSIControllerQuery
}

ClientCSIControllerListSnapshotsRequest is the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform ListSnapshots

func (*ClientCSIControllerListSnapshotsRequest) ToCSIRequest added in v1.1.0

type ClientCSIControllerListSnapshotsResponse added in v1.1.0

type ClientCSIControllerListSnapshotsResponse struct {
	Entries   []*structs.CSISnapshot
	NextToken string
}

type ClientCSIControllerListVolumesRequest added in v1.1.0

type ClientCSIControllerListVolumesRequest struct {
	// these pagination fields match the pagination fields of the plugins and
	// not Nomad's own fields, for clarity when mapping between the two RPCs
	MaxEntries    int32
	StartingToken string

	CSIControllerQuery
}

ClientCSIControllerListVolumesVolumeRequest the RPC made from the server to a Nomad client to tell a CSI controller plugin on that client to perform ListVolumes

func (*ClientCSIControllerListVolumesRequest) ToCSIRequest added in v1.1.0

type ClientCSIControllerListVolumesResponse added in v1.1.0

type ClientCSIControllerListVolumesResponse struct {
	Entries   []*structs.CSIVolumeExternalStub
	NextToken string
}

type ClientCSIControllerValidateVolumeRequest added in v0.11.0

type ClientCSIControllerValidateVolumeRequest struct {
	VolumeID string // note: this is the external ID

	VolumeCapabilities []*structs.CSIVolumeCapability
	MountOptions       *structs.CSIMountOptions
	Secrets            structs.CSISecrets

	// COMPAT(1.1.1): the AttachmentMode and AccessMode fields are deprecated
	// and replaced by the VolumeCapabilities field above
	AttachmentMode structs.CSIVolumeAttachmentMode
	AccessMode     structs.CSIVolumeAccessMode

	// Parameters as returned by storage provider in CreateVolumeResponse.
	// This field is optional.
	Parameters map[string]string

	// Volume context as returned by storage provider in CreateVolumeResponse.
	// This field is optional.
	Context map[string]string

	CSIControllerQuery
}

func (*ClientCSIControllerValidateVolumeRequest) ToCSIRequest added in v0.11.3

type ClientCSIControllerValidateVolumeResponse added in v0.11.0

type ClientCSIControllerValidateVolumeResponse struct {
}

type ClientCSINodeDetachVolumeRequest added in v0.11.0

type ClientCSINodeDetachVolumeRequest struct {
	PluginID   string // ID of the plugin that manages the volume (required)
	VolumeID   string // ID of the volume to be unpublished (required)
	AllocID    string // ID of the allocation we're unpublishing for (required)
	NodeID     string // ID of the Nomad client targeted
	ExternalID string // External ID of the volume to be unpublished (required)

	// These fields should match the original volume request so that
	// we can find the mount points on the client
	AttachmentMode structs.CSIVolumeAttachmentMode
	AccessMode     structs.CSIVolumeAccessMode
	ReadOnly       bool
}

ClientCSINodeDetachVolumeRequest is the RPC made from the server to a Nomad client to tell a CSI node plugin on that client to perform NodeUnpublish and NodeUnstage.

type ClientCSINodeDetachVolumeResponse added in v0.11.0

type ClientCSINodeDetachVolumeResponse struct{}

type ClientStatsResponse added in v0.8.0

type ClientStatsResponse struct {
	HostStats *stats.HostStats
	structs.QueryMeta
}

ClientStatsResponse is used to return statistics about a node.

type CpuStats

type CpuStats struct {
	SystemMode       float64
	UserMode         float64
	TotalTicks       float64
	ThrottledPeriods uint64
	ThrottledTime    uint64
	Percent          float64

	// A list of fields whose values were actually sampled
	Measured []string
}

CpuStats holds cpu usage related stats

func (*CpuStats) Add

func (cs *CpuStats) Add(other *CpuStats)

type FsListRequest added in v0.8.0

type FsListRequest struct {
	// AllocID is the allocation to list from
	AllocID string

	// Path is the path to list
	Path string

	structs.QueryOptions
}

FsListRequest is used to list an allocation's directory.

type FsListResponse added in v0.8.0

type FsListResponse struct {
	// Files are the result of listing a directory.
	Files []*AllocFileInfo

	structs.QueryMeta
}

FsListResponse is used to return the listings of an allocation's directory.

type FsLogsRequest added in v0.8.0

type FsLogsRequest struct {
	// AllocID is the allocation to stream logs from
	AllocID string

	// Task is the task to stream logs from
	Task string

	// LogType indicates whether "stderr" or "stdout" should be streamed
	LogType string

	// Offset is the offset to start streaming data at.
	Offset int64

	// Origin can either be "start" or "end" and determines where the offset is
	// applied.
	Origin string

	// PlainText disables base64 encoding.
	PlainText bool

	// Follow follows logs.
	Follow bool

	structs.QueryOptions
}

FsLogsRequest is the initial request for accessing allocation logs.

type FsStatRequest added in v0.8.0

type FsStatRequest struct {
	// AllocID is the allocation to stat the file in
	AllocID string

	// Path is the path to list
	Path string

	structs.QueryOptions
}

FsStatRequest is used to stat a file

type FsStatResponse added in v0.8.0

type FsStatResponse struct {
	// Info is the result of stating a file
	Info *AllocFileInfo

	structs.QueryMeta
}

FsStatResponse is used to return the stat results of a file

type FsStreamRequest added in v0.8.0

type FsStreamRequest struct {
	// AllocID is the allocation to stream logs from
	AllocID string

	// Path is the path to the file to stream
	Path string

	// Offset is the offset to start streaming data at.
	Offset int64

	// Origin can either be "start" or "end" and determines where the offset is
	// applied.
	Origin string

	// PlainText disables base64 encoding.
	PlainText bool

	// Limit is the number of bytes to read
	Limit int64

	// Follow follows the file.
	Follow bool

	structs.QueryOptions
}

FsStreamRequest is the initial request for streaming the content of a file.

type HealthCheckIntervalRequest added in v0.8.0

type HealthCheckIntervalRequest struct{}

type HealthCheckIntervalResponse added in v0.8.0

type HealthCheckIntervalResponse struct {
	Eligible bool
	Period   time.Duration
}

type HealthCheckRequest added in v0.8.0

type HealthCheckRequest struct{}

HealthCheckRequest is the request type for a type that fulfils the Health Check interface

type HealthCheckResponse added in v0.8.0

type HealthCheckResponse struct {
	// Drivers is a map of driver names to current driver information
	Drivers map[string]*structs.DriverInfo
}

HealthCheckResponse is the response type for a type that fulfills the Health Check interface

func (*HealthCheckResponse) AddDriverInfo added in v0.8.0

func (h *HealthCheckResponse) AddDriverInfo(name string, driverInfo *structs.DriverInfo)

AddDriverInfo adds information about a driver to the fingerprint response. If the Drivers field has not yet been initialized, it does so here.

type MemoryStats

type MemoryStats struct {
	RSS            uint64
	Cache          uint64
	Swap           uint64
	Usage          uint64
	MaxUsage       uint64
	KernelUsage    uint64
	KernelMaxUsage uint64

	// A list of fields whose values were actually sampled
	Measured []string
}

MemoryStats holds memory usage related stats

func (*MemoryStats) Add

func (ms *MemoryStats) Add(other *MemoryStats)

type MonitorRequest added in v0.10.2

type MonitorRequest struct {
	// LogLevel is the log level filter we want to stream logs on
	LogLevel string

	// LogJSON specifies if log format should be unstructured or json
	LogJSON bool

	// NodeID is the node we want to track the logs of
	NodeID string

	// ServerID is the server we want to track the logs of
	ServerID string

	// PlainText disables base64 encoding.
	PlainText bool

	structs.QueryOptions
}

MonitorRequest is used to request and stream logs from a client node.

type ResourceUsage

type ResourceUsage struct {
	MemoryStats *MemoryStats
	CpuStats    *CpuStats
	DeviceStats []*device.DeviceGroupStats
}

ResourceUsage holds information related to cpu and memory stats

func (*ResourceUsage) Add

func (ru *ResourceUsage) Add(other *ResourceUsage)

type RpcError added in v0.8.0

type RpcError struct {
	Message string
	Code    *int64
}

RpcError is used for serializing errors with a potential error code

func NewRpcError added in v0.8.0

func NewRpcError(err error, code *int64) *RpcError

func (*RpcError) Error added in v0.8.0

func (r *RpcError) Error() string

type StreamErrWrapper added in v0.8.0

type StreamErrWrapper struct {
	// Error stores any error that may have occurred.
	Error *RpcError

	// Payload is the payload
	Payload []byte
}

StreamErrWrapper is used to serialize output of a stream of a file or logs.

type TaskResourceUsage

type TaskResourceUsage struct {
	ResourceUsage *ResourceUsage
	Timestamp     int64 // UnixNano
	Pids          map[string]*ResourceUsage
}

TaskResourceUsage holds aggregated resource usage of all processes in a Task and the resource usage of the individual pids

Jump to

Keyboard shortcuts

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