containermetadata

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetadataInitial is the initial state of the metadata file which
	// contains metadata provided by the ECS Agent
	MetadataInitialText = "INITIAL"
	// MetadataReady is the final state of the metadata file which indicates
	// it has acquired all the data it needs (Currently from the Agent and Docker)
	MetadataReadyText = "READY"
)

Variables

View Source
var TempFile = func(dir, pattern string) (oswrapper.File, error) {
	return ioutil.TempFile(dir, pattern)
}

Functions

This section is empty.

Types

type DockerContainerMetadata

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

DockerContainerMetadata keeps track of all metadata acquired from Docker inspection Has redundancies with dockerapi.DockerContainerMetadata but this packages all docker metadata we want in the service so we can change features easily

type DockerMetadataClient

type DockerMetadataClient interface {
	InspectContainer(context.Context, string, time.Duration) (*types.ContainerJSON, error)
}

DockerMetadataClient is a wrapper for the docker interface functions we need We use this as a dummy type to be able to pass in dockerapi.DockerClient to our functions without creating import cycles We make it exported because we need to use it for testing (Using the MockDockerClient in engine package leads to import cycles) The problems described above are indications dockerapi.DockerClient needs to be moved outside the engine package

type Manager

type Manager interface {
	SetContainerInstanceARN(string)
	SetAvailabilityZone(string)
	SetHostPrivateIPv4Address(string)
	SetHostPublicIPv4Address(string)
	Create(*dockercontainer.Config, *dockercontainer.HostConfig, *apitask.Task, string, []string) error
	Update(context.Context, string, *apitask.Task, string) error
	Clean(string) error
}

Manager is an interface that allows us to abstract away the metadata operations

func NewManager

func NewManager(client DockerMetadataClient, cfg *config.Config) Manager

NewManager creates a metadataManager for a given DockerTaskEngine settings.

type Metadata

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

Metadata packages all acquired metadata and is used to format it into JSON to write to the metadata file. We have it flattened, rather than simply containing the previous three structures to simplify JSON parsing and avoid exposing those structs in the final metadata file.

func (Metadata) MarshalJSON

func (m Metadata) MarshalJSON() ([]byte, error)

type MetadataStatus

type MetadataStatus int32

MetadataStatus specifies the current update status of the metadata file. The purpose of this status is for users to check if the metadata file has reached the stage they need before they read the rest of the file to avoid race conditions (Since the final stage will need to be after the container starts up In the future the metadata may require multiple stages of update and these statuses should amended/appended accordingly.

const (
	MetadataInitial MetadataStatus = iota
	MetadataReady
)

func (MetadataStatus) MarshalText

func (status MetadataStatus) MarshalText() (text []byte, err error)

func (*MetadataStatus) UnmarshalText

func (status *MetadataStatus) UnmarshalText(text []byte) error

type Network

type Network struct {
	NetworkMode   string   `json:"NetworkMode,omitempty"`
	IPv4Addresses []string `json:"IPv4Addresses,omitempty"`
	IPv6Addresses []string `json:"IPv6Addresses,omitempty"`
}

Network is a struct that keeps track of metadata of a network interface

type NetworkMetadata

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

NetworkMetadata keeps track of the data we parse from the Network Settings in docker containers. While most information is redundant with the internal Network struct, we keeps this wrapper in case we wish to add data specifically from the NetworkSettings

type TaskMetadata

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

TaskMetadata keeps track of all metadata associated with a task provided by AWS, does not depend on the creation of the container

Directories

Path Synopsis
Package mock_containermetadata is a generated GoMock package.
Package mock_containermetadata is a generated GoMock package.

Jump to

Keyboard shortcuts

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