Documentation ¶
Index ¶
- Constants
- Variables
- func GetVolumeSpecificPropertiesForEBSAttach() (volumeSpecificProperties []string)
- func ScanEBSVolumes[T GenericEBSAttachmentObject](pendingAttachments map[string]T, dc EBSDiscovery) map[string]string
- func ValidateFileSystemType(filesystemType string) error
- func ValidateRequiredProperties(actualProperties map[string]string, requiredProperties []string) error
- func ValidateResourceByResourceType(resourceAttachmentProperties map[string]string) error
- type BlockDevice
- type EBSDiscovery
- type EBSDiscoveryClient
- type EBSDiscoveryClientOption
- type GenericEBSAttachmentObject
- type LsblkOutput
- type ResourceAttachment
- func (ra *ResourceAttachment) EBSToString() string
- func (ra *ResourceAttachment) GetAttachmentARN() string
- func (ra *ResourceAttachment) GetAttachmentProperties(key string) string
- func (ra *ResourceAttachment) GetAttachmentStatus() attachment.AttachmentStatus
- func (ra *ResourceAttachment) GetAttachmentType() string
- func (ra *ResourceAttachment) GetClusterARN() string
- func (ra *ResourceAttachment) GetContainerInstanceARN() string
- func (ra *ResourceAttachment) GetError() error
- func (ra *ResourceAttachment) GetExpiresAt() time.Time
- func (ra *ResourceAttachment) GetStatus() attachment.AttachmentStatus
- func (ra *ResourceAttachment) HasExpired() bool
- func (ra *ResourceAttachment) Initialize(timeoutFunc func()) error
- func (ra *ResourceAttachment) IsAttached() bool
- func (ra *ResourceAttachment) IsSent() bool
- func (ra *ResourceAttachment) SetAttachedStatus()
- func (ra *ResourceAttachment) SetDeviceName(deviceName string)
- func (ra *ResourceAttachment) SetError(err error)
- func (ra *ResourceAttachment) SetSentStatus()
- func (ra *ResourceAttachment) ShouldAttach() bool
- func (ra *ResourceAttachment) ShouldNotify() bool
- func (ra *ResourceAttachment) StartTimer(timeoutFunc func()) error
- func (ra *ResourceAttachment) StopAckTimer()
- func (ra *ResourceAttachment) String() string
Constants ¶
const ( // Common properties. ResourceTypeName = "resourceType" // Properties specific to volumes. VolumeIdName = "volumeID" DeviceName = "deviceName" // name of the block device on the instance where the volume is attached // Properties specific to resources provisioned by Fargate Control Plane. FargateResourceIdName = "resourceID" // Properties specific to Extensible Ephemeral Storage (EES). VolumeSizeInGiBName = "volumeSizeInGiB" // the total size of the EES (requested size + image cache size) RequestedSizeName = "requestedSizeInGiB" // the customer requested size of extensible ephemeral storage // Properties specific to Elastic Block Service Volumes FileSystemTypeName = "filesystemType" // Properties specific to volumes for EBS attach. VolumeIdKey = "volumeId" VolumeSizeGibKey = "volumeSizeGib" DeviceNameKey = "deviceName" SourceVolumeHostPathKey = "sourceVolumeHostPath" VolumeNameKey = "volumeName" FileSystemKey = "fileSystem" )
Agent Communication Service (ACS) can send messages of type ConfirmAttachmentMessage. These messages include an attachment, and map of associated properties. The below list contains attachment properties which Agent can use to validate various types of attachments.
const ( // EphemeralStorage is one of the resource types in the properties list of the attachment payload message for the // ephemeral storage. EphemeralStorage = "EphemeralStorage" // ElasticBlockStorage is one of the resource types in the properties list of the attachment payload message for the // EBS volume on firecracker. ElasticBlockStorage = "ElasticBlockStorage" // EBSTaskAttach is one of the attachment types in the attachment payload message for EBS attach tasks. EBSTaskAttach = "amazonebs" )
const (
ScanPeriod = 500 * time.Millisecond
)
Variables ¶
var ( // When confirming an EBS volume is attached to a host, if the expected volume ID does not // match the volume ID found on the host, this error is returned. ErrInvalidVolumeID = errors.New("EBS volume IDs do not match") )
Functions ¶
func GetVolumeSpecificPropertiesForEBSAttach ¶
func GetVolumeSpecificPropertiesForEBSAttach() (volumeSpecificProperties []string)
GetVolumeSpecificPropertiesForEBSAttach returns the properties specific to EBS volume resources which will be used in EBS attach.
func ScanEBSVolumes ¶
func ScanEBSVolumes[T GenericEBSAttachmentObject](pendingAttachments map[string]T, dc EBSDiscovery) map[string]string
ScanEBSVolumes will iterate through the entire list of provided EBS volume attachments within the agent state and checks if it's attached on the host.
func ValidateFileSystemType ¶
For EBS-backed task attachment payload, the file system type is optional. If we do receive a file system type value, we want to validate what we receive is one of the following types [xfs, ext2, ext3, ext4, ntfs].
func ValidateResourceByResourceType ¶
ValidateResourceByResourceType checks if the provided resource type is valid, as well as if the attachment properties of the specified resource are valid.
Types ¶
type BlockDevice ¶
type BlockDevice struct { Name string `json:"name"` Serial string `json:"serial"` Children []*BlockDevice `json:"children,omitempty"` }
type EBSDiscovery ¶
type EBSDiscovery interface {
ConfirmEBSVolumeIsAttached(deviceName, volumeID string) (string, error)
}
EBSDiscovery is an interface used to find EBS volumes that are attached onto the host instance. It is implemented by EBSDiscoveryClient
type EBSDiscoveryClient ¶
type EBSDiscoveryClient struct {
// contains filtered or unexported fields
}
func NewDiscoveryClient ¶
func NewDiscoveryClient(ctx context.Context, opts ...EBSDiscoveryClientOption) *EBSDiscoveryClient
func (*EBSDiscoveryClient) ConfirmEBSVolumeIsAttached ¶
func (api *EBSDiscoveryClient) ConfirmEBSVolumeIsAttached(deviceName, volumeID string) (string, error)
ConfirmEBSVolumeIsAttached is used to scan for an EBS volume that's on the host with a specific volume ID. If the volume ID has been found, we'll return the corresponding host device name. Otherwise, we return an error.
func (*EBSDiscoveryClient) HasXenSupport ¶
func (client *EBSDiscoveryClient) HasXenSupport() bool
type EBSDiscoveryClientOption ¶
type EBSDiscoveryClientOption func(*EBSDiscoveryClient)
func WithXenSupport ¶
func WithXenSupport() EBSDiscoveryClientOption
Enable Xen instances support for EBS Discovery Client
type GenericEBSAttachmentObject ¶
type GenericEBSAttachmentObject interface { GetAttachmentProperties(key string) string EBSToString() string SetError(err error) }
GenericEBSAttachmentObject is an interface used to implement the Resource attachment objects that's saved within the agent state
type LsblkOutput ¶
type LsblkOutput struct {
BlockDevices []BlockDevice `json:"blockdevices"`
}
LsblkOutput is used to manage and track the output of `lsblk`
type ResourceAttachment ¶
type ResourceAttachment struct { attachment.AttachmentInfo // AttachmentType is the type of the resource attachment which can be "amazonebs" for EBS attach tasks. AttachmentType string `json:"AttachmentType,omitempty"` // AttachmentProperties is a map storing (name, value) representation of attachment properties. // Each pair is a set of property of one resource attachment. // The "FargateResourceId" is a property name that will be present for all resources. // Other properties can vary based on the resource. // For example, if the attachment is used for an EBS volume resource, the additional properties will be // the customer specified volume size, and the image cache size. AttachmentProperties map[string]string `json:"AttachmentProperties,omitempty"` // contains filtered or unexported fields }
func (*ResourceAttachment) EBSToString ¶
func (ra *ResourceAttachment) EBSToString() string
EBSToString returns a string representation of an EBS volume resource attachment.
func (*ResourceAttachment) GetAttachmentARN ¶
func (ra *ResourceAttachment) GetAttachmentARN() string
func (*ResourceAttachment) GetAttachmentProperties ¶
func (ra *ResourceAttachment) GetAttachmentProperties(key string) string
GetAttachmentProperties returns the specific attachment property of the resource attachment object
func (*ResourceAttachment) GetAttachmentStatus ¶
func (ra *ResourceAttachment) GetAttachmentStatus() attachment.AttachmentStatus
func (*ResourceAttachment) GetAttachmentType ¶
func (ra *ResourceAttachment) GetAttachmentType() string
func (*ResourceAttachment) GetClusterARN ¶
func (ra *ResourceAttachment) GetClusterARN() string
func (*ResourceAttachment) GetContainerInstanceARN ¶
func (ra *ResourceAttachment) GetContainerInstanceARN() string
func (*ResourceAttachment) GetError ¶
func (ra *ResourceAttachment) GetError() error
GetError returns the error field for a resource attachment.
func (*ResourceAttachment) GetExpiresAt ¶
func (ra *ResourceAttachment) GetExpiresAt() time.Time
func (*ResourceAttachment) GetStatus ¶
func (ra *ResourceAttachment) GetStatus() attachment.AttachmentStatus
func (*ResourceAttachment) HasExpired ¶
func (ra *ResourceAttachment) HasExpired() bool
HasExpired returns true if the resource attachment object has exceeded the threshold for notifying the backend of the attachment
func (*ResourceAttachment) Initialize ¶
func (ra *ResourceAttachment) Initialize(timeoutFunc func()) error
Initialize initializes the fields that can't be populated from loading state file. Notably, this initializes the ack timer so that if we time out waiting for the resource to be attached, the attachment can be removed from state.
func (*ResourceAttachment) IsAttached ¶
func (ra *ResourceAttachment) IsAttached() bool
IsAttached checks if the resource attachment has been found attached on the host
func (*ResourceAttachment) IsSent ¶
func (ra *ResourceAttachment) IsSent() bool
IsSent checks if the resource attachment attached status has been sent
func (*ResourceAttachment) SetAttachedStatus ¶
func (ra *ResourceAttachment) SetAttachedStatus()
SetAttachedStatus marks the resouce attachment as attached once it's been found on the host
func (*ResourceAttachment) SetDeviceName ¶
func (ra *ResourceAttachment) SetDeviceName(deviceName string)
func (*ResourceAttachment) SetError ¶
func (ra *ResourceAttachment) SetError(err error)
SetError sets the error for a resource attachment if it can't be found.
func (*ResourceAttachment) SetSentStatus ¶
func (ra *ResourceAttachment) SetSentStatus()
SetSentStatus marks the resource attachment attached status has been sent
func (*ResourceAttachment) ShouldAttach ¶
func (ra *ResourceAttachment) ShouldAttach() bool
should attach when not attached, and not sent/not expired
func (*ResourceAttachment) ShouldNotify ¶
func (ra *ResourceAttachment) ShouldNotify() bool
should notify when attached, and not sent/not expired
func (*ResourceAttachment) StartTimer ¶
func (ra *ResourceAttachment) StartTimer(timeoutFunc func()) error
StartTimer starts the ack timer to record the expiration of resource attachment
func (*ResourceAttachment) StopAckTimer ¶
func (ra *ResourceAttachment) StopAckTimer()
StopAckTimer stops the ack timer set on the resource attachment
func (*ResourceAttachment) String ¶
func (ra *ResourceAttachment) String() string