Documentation
¶
Index ¶
- Constants
- Variables
- func DeploymentStatusString(d DeploymentStatus) string
- type Allocation
- type AllocationConfig
- type AllocationDeploymentConfig
- type AllocationDeploymentRequest
- type AllocationDeploymentResponse
- type AllocationDetails
- type AllocationExecutor
- type AllocationManifest
- type AllocationStartRequest
- type AllocationStartResponse
- type AllocationStatus
- type Bid
- type BidRequest
- type BidRequestV1
- type BidV1
- type CommitDeploymentRequest
- type CommitDeploymentResponse
- type Coordinate
- type DeploymentStatus
- type EdgeConstraint
- type EnsembleBidRequest
- type EnsembleConfig
- func (e *EnsembleConfig) Allocation(allocID string) (AllocationConfig, bool)
- func (e *EnsembleConfig) Allocations() map[string]AllocationConfig
- func (e *EnsembleConfig) Clone() EnsembleConfig
- func (e *EnsembleConfig) EdgeConstraints() []EdgeConstraint
- func (e *EnsembleConfig) Node(nodeID string) (NodeConfig, bool)
- func (e *EnsembleConfig) Nodes() map[string]NodeConfig
- func (e *EnsembleConfig) Validate() error
- type EnsembleConfigV1
- type EnsembleManifest
- type GeoLocator
- type Job
- type Location
- type LocationConstraints
- type NodeConfig
- type NodeManifest
- type Orchestrator
- func (o *Orchestrator) Config() EnsembleConfig
- func (o *Orchestrator) Deploy(expiry time.Time) error
- func (o *Orchestrator) ID() string
- func (o *Orchestrator) Manifest() EnsembleManifest
- func (o *Orchestrator) Shutdown() error
- func (o *Orchestrator) Status() DeploymentStatus
- func (o *Orchestrator) Stop()
- type PortConfig
- type RestartAllocationRequest
- type RestartAllocationResponse
- type RevertDeploymentMessage
- type Status
- type SubnetAcceptPeerRequest
- type SubnetAcceptPeerResponse
- type SubnetAddPeerRequest
- type SubnetAddPeerResponse
- type SubnetCreateRequest
- type SubnetCreateResponse
- type SubnetDNSAddRecordRequest
- type SubnetDNSAddRecordResponse
- type SubnetDNSRemoveRecordRequest
- type SubnetDNSRemoveRecordResponse
- type SubnetDestroyRequest
- type SubnetDestroyResponse
- type SubnetMapPortRequest
- type SubnetMapPortResponse
- type SubnetRemovePeerRequest
- type SubnetRemovePeerResponse
- type SubnetUnmapPortRequest
- type SubnetUnmapPortResponse
- type SupervisorConfig
- type SupervisorStrategy
- type VerifyEdgeConstraintRequest
- type VerifyEdgeConstraintResponse
Constants ¶
const ( BidRequestTopic = "/nunet/deployment" BidRequestBehavior = "/dms/deployment/request" BidRequestTimeout = 5 * time.Second BidReplyBehavior = "/dms/deployment/bid" VerifyEdgeConstraintBehavior = "/dms/deployment/constraint/edge" VerifyEdgeConstraintTimeout = 5 * time.Second CommitDeploymentBehavior = "/dms/deployment/commit" CommitDeploymentTimeout = 3 * time.Second AllocationDeploymentBehavior = "/dms/deployment/allocate" AllocationDeploymentTimeout = 5 * time.Second RevertDeploymentBehavior = "/dms/deployment/revert" AllocationStartBehavior = "/dms/deployment/start" AllocationStartTimeout = 5 * time.Second MinEnsembleDeploymentTime = 15 * time.Second MaxBidMultiplier = 8 SubnetCreateBehavior = "/dms/node/subnet/create" SubnetDestroyBehavior = "/dms/node/subnet/destroy" SubnetAddPeerBehavior = "/dms/node/subnet/add-peer" SubnetRemovePeerBehavior = "/dms/node/subnet/remove-peer" SubnetAcceptPeerBehavior = "/dms/node/subnet/accept-peer" SubnetMapPortBehavior = "/dms/node/subnet/map-port" SubnetDNSAddRecordBehavior = "/dms/node/subnet/dns/add-record" SubnetUnmapPortBehavior = "/dms/node/subnet/unmap-port" SubnetDNSRemoveRecordBehavior = "/dms/node/subnet/dns/remove-record" )
const MaxPermutations = 1_000_000
Variables ¶
Functions ¶
func DeploymentStatusString ¶
func DeploymentStatusString(d DeploymentStatus) string
Types ¶
type Allocation ¶
type Allocation struct { ID string Actor actor.Actor Job Job // contains filtered or unexported fields }
Allocation represents an allocation
func NewAllocation ¶
func NewAllocation(actor actor.Actor, details AllocationDetails, resourceManager types.ResourceManager) (*Allocation, error)
NewAllocation creates a new allocation given the actor.
func (*Allocation) Run ¶
func (a *Allocation) Run(ctx context.Context) error
Run creates the executor based on the execution engine configuration.
type AllocationConfig ¶
type AllocationConfig struct { Executor AllocationExecutor // the executor of the allocation Resources types.Resources // the HW resources required by the allocation Execution types.SpecConfig // the allocation execution configuration DNSName string // the internal DNS name of the allocation Keys []string // names of the authorized ssh keys for the allocation Provision []string // names of provisioning scripts to run (in order) HealthCheck string // name of the script to run for health checks }
AllocationConfig is the configuration of an allocation
type AllocationDeploymentConfig ¶
type AllocationDeploymentConfig struct { Executor AllocationExecutor Resources types.Resources Execution types.SpecConfig ProvisionScripts map[string][]byte }
type AllocationDeploymentRequest ¶
type AllocationDeploymentRequest struct { EnsembleID string NodeID string Allocations map[string]AllocationDeploymentConfig }
type AllocationDetails ¶
AllocationDetails encapsulates the dependencies to the constructor.
type AllocationExecutor ¶
type AllocationExecutor string
AllocationExecutor is the executor reoquired for the allocation
const ( ExecutorFirecracker AllocationExecutor = "firecracker" ExecutorDocker AllocationExecutor = "docker" ExecutorNull AllocationExecutor = "null" )
type AllocationManifest ¶
type AllocationManifest struct { ID string // allocation unique id NodeID string // allocation node Handle actor.Handle // handle of the allocation control actor DNSName string // (internal) DNS name of the allocation PrivAddr string // (VPN) private IP address of the allocation peer Ports map[int]int // port mapping, public -> private }
type AllocationStartRequest ¶
type AllocationStartRequest struct{}
type AllocationStartResponse ¶
type AllocationStatus ¶
type AllocationStatus string
AllocationStatus is a representation of the execution status
type Bid ¶
type Bid struct {
V1 *BidV1
}
Bid is the version struct for Bids in response to a bid request
func (*Bid) EnsembleID ¶
func (*Bid) SignatureData ¶
type BidRequestV1 ¶
type BidRequestV1 struct { NodeID string // unique identifier for a node, within the context of an ensemble Executors []AllocationExecutor // list of required executors to support the allocation(s) Resources types.Resources // (aggregate) required hardware resources Location LocationConstraints // node location constraints PublicPorts struct { Static []int // statically configured public ports Dynamic int // number of dynamic ports } }
BidRequestV1 is v1 of bid requests for a node to use for deployment
type BidV1 ¶
type BidV1 struct { EnsembleID string // unique identifier for the ensemble NodeID string // unique identifier for a node; matches the id of the BidRequest to which this bid pertains Peer string // the peer ID of the node Location Location // the location of the node Handle actor.Handle // the handle of the actor submitting the bid Signature []byte }
BidV1 is v1 of the bid structure
type CommitDeploymentRequest ¶
type Coordinate ¶
type Coordinate struct {
// contains filtered or unexported fields
}
func (*Coordinate) Empty ¶
func (c *Coordinate) Empty() bool
type DeploymentStatus ¶
type DeploymentStatus int
const ( DeploymentStatusPreparing DeploymentStatus = iota DeploymentStatusGenerating DeploymentStatusCommitting DeploymentStatusProvisioning DeploymentStatusRunning DeploymentStatusFailed )
type EdgeConstraint ¶
type EdgeConstraint struct {
S, T string // (named) nodes connected by the edge
RTT uint // maximum edge RTT in milliseconds
BW uint // minimum edge bandwidth in Kbps
}
EdgeConstraint is a constraint for a network edge between two nodes
type EnsembleBidRequest ¶
type EnsembleBidRequest struct { ID string // unique identifier of an ensemble (in the context of the orchestrator) Request []BidRequest // list of node bid requests PeerExclusion []string // list of peers to exclude from bidding }
EnsembleBidRequest is a request for a bids pertaining to an ensemble
Note: At the moment, we embed a bid request for each node This is fine for small deployments, and a small network, which is what we have. For large deployments however, this won't scale and we will have to create aggregate bid requests for related group of nodes and also handle them with bid request aggregators who control multiple nodes.
func (*EnsembleBidRequest) Validate ¶
func (b *EnsembleBidRequest) Validate() error
type EnsembleConfig ¶
type EnsembleConfig struct {
V1 *EnsembleConfigV1
}
EnsembleConfig is the versioned structure that contains the ensemble configuration
func (*EnsembleConfig) Allocation ¶
func (e *EnsembleConfig) Allocation(allocID string) (AllocationConfig, bool)
func (*EnsembleConfig) Allocations ¶
func (e *EnsembleConfig) Allocations() map[string]AllocationConfig
func (*EnsembleConfig) Clone ¶
func (e *EnsembleConfig) Clone() EnsembleConfig
func (*EnsembleConfig) EdgeConstraints ¶
func (e *EnsembleConfig) EdgeConstraints() []EdgeConstraint
func (*EnsembleConfig) Node ¶
func (e *EnsembleConfig) Node(nodeID string) (NodeConfig, bool)
func (*EnsembleConfig) Nodes ¶
func (e *EnsembleConfig) Nodes() map[string]NodeConfig
type EnsembleConfigV1 ¶
type EnsembleConfigV1 struct { Allocations map[string]AllocationConfig // (named) allocations in the ensemble Nodes map[string]NodeConfig // (named) nodes in the ensemble Edges []EdgeConstraint // network edge constraints Supervisor SupervisorConfig // supervision structure Keys map[string]string // (named) ssh public keys relevant to the allocation Scripts map[string][]byte // (named) provisioning scripts }
EnsembleConfigV1 is version 1 of the configuration for an ensemble
type EnsembleManifest ¶
type EnsembleManifest struct { ID string // ensemble globally unique id Orchestrator actor.Handle // orchestrator actor Allocations map[string]AllocationManifest // allocation name -> manifest Nodes map[string]NodeManifest // node name -> manifest }
func (*EnsembleManifest) Clone ¶
func (mf *EnsembleManifest) Clone() EnsembleManifest
type GeoLocator ¶
type GeoLocator struct {
// contains filtered or unexported fields
}
func NewGeoLocator ¶
func NewGeoLocator() (*GeoLocator, error)
func (*GeoLocator) Coordinate ¶
func (geo *GeoLocator) Coordinate(loc Location) (Coordinate, error)
type Location ¶
type Location struct { Region string // geographic region of the location (required) Country string // country (code or name) of the location (optional) City string // city of the location; optional but country must be specified if not empty ASN uint // Autonomous System Number for the location (optional) ISP string // Internet Service Provider name for the location (optional) }
Location is a geographical location on Planet Earth
type LocationConstraints ¶
type LocationConstraints struct { Accept []Location // acceptable location constraints (disjunction) Reject []Location // negative location constraints (conjunction); eg !USA for GPDR purposes }
LocationConstraints provides the node location placement constraints
type NodeConfig ¶
type NodeConfig struct { Allocations []string // the list of (named) allocations in the node Ports []PortConfig // the port mapping configuration for the node Location LocationConstraints // the geographical location constraints for the node Peer string // (optional) a fixed peer for the node }
NodeConfig is the configuration of a distinct DMS node
type NodeManifest ¶
type NodeManifest struct { ID string // node unique id Peer string // peer where the node is running Handle actor.Handle // handle of the control actor for the node PubAddrss []string // public IP4/6 address of the node peer Location Location // location of the peer Allocations []string // allocations in the nod }
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
func NewOrchestrator ¶
func NewOrchestrator(actor actor.Actor, network network.Network, cfg EnsembleConfig) (*Orchestrator, error)
func (*Orchestrator) Config ¶
func (o *Orchestrator) Config() EnsembleConfig
func (*Orchestrator) ID ¶
func (o *Orchestrator) ID() string
func (*Orchestrator) Manifest ¶
func (o *Orchestrator) Manifest() EnsembleManifest
func (*Orchestrator) Shutdown ¶
func (o *Orchestrator) Shutdown() error
func (*Orchestrator) Status ¶
func (o *Orchestrator) Status() DeploymentStatus
func (*Orchestrator) Stop ¶
func (o *Orchestrator) Stop()
type PortConfig ¶
type PortConfig struct { Public int // the public port 0 for any Private int // the private mapping Allocation string // the allocation where the port is mapped }
PortConfig is the configuration for a port mapping a public port to a private port in an allocation
type RestartAllocationRequest ¶
type RestartAllocationRequest struct {
AllocationID string
}
type RevertDeploymentMessage ¶
type Status ¶
type Status struct { JobResources types.Resources Status AllocationStatus }
Status holds the status of an allocation.
type SubnetAcceptPeerRequest ¶
type SubnetAddPeerRequest ¶
type SubnetAddPeerResponse ¶
type SubnetCreateRequest ¶
type SubnetCreateResponse ¶
type SubnetDestroyRequest ¶
type SubnetDestroyRequest struct {
SubnetID string
}
type SubnetDestroyResponse ¶
type SubnetMapPortRequest ¶
type SubnetMapPortResponse ¶
type SubnetRemovePeerRequest ¶
type SubnetUnmapPortRequest ¶
type SubnetUnmapPortResponse ¶
type SupervisorConfig ¶
type SupervisorConfig struct { Strategy SupervisorStrategy // the strategy for the supervision group Allocations []string // allocations in this supervision group Children []SupervisorConfig // allocation children for recursive groups }
SupervisorConfig is the supervisory structure configuration for the ensemble
type SupervisorStrategy ¶
type SupervisorStrategy string
SupervisoryStrategy is the name of a supervision strategy
const ( StrategyOneForOne SupervisorStrategy = "OneForOne" StrategyAllForOne SupervisorStrategy = "AllForOne" StrategyRestForOne SupervisorStrategy = "RestForOne" )