Tech Insights
FogAtLas architecture & models
The following figure shows the FogAtlas high level architecture.
The architecture is divided in four layers:
Front End comprises the GUI and the CLI for interacting with the system:
The Dashboard shows the status of the infrastructure and of the deployed applications.
The Application Composer is used for modelling a distributed application and for deploying it.
The CLI, an extension of kubectl, is the terminal based way to interact with the system.
Application Programming Interface extends the Kubernetes API thanks to the usage of CRD (Custom Resource Definition) and is the gate to access the system.
Back End provides components for scheduling and deploying the workload on a distributed infrastructure:
The Orchestrator, with the Scheduler, Deployer and Deployment Algorithm sub-components, is responsible for the intelligent placement of the workload on a distributed infrastructure matching the application requirements with the the current status of the infrastructure. Different deployment algorithms can be plugged in FogAtlas.
Application Repository is a registry where the applications to be deployed can be stored.
Metrics Repository, Network Discovery and Monitoring & Security Probes are components related to the monitoring system.
Infrastructure Manager layer offers Infrastructure as Code services and services related to the selling/sharing of the resources of the infrastructure:
The Resource Manager is a sort of control plane for the infrastructure.
The Resource Inventory stores the current status of the infrastructure in terms of resource available and resources occupied.
The Provisioner component is responsible for the provisioning of new resources.
The Resource Seller is an experimental component that can connect to an external blockchain in order to advertise spare resources and enter into a contract with potential buyers.
The whole FogAtlas services are based on two models, one describing the resources to be allocated and one modelling the applications to be deployed on those resources. The following figures present both of them.
Each Region (either Cloud or Fog) hosts Compute Nodes and offers External Endpoints (i.e. data sources like sensors or services offered by external frameworks). Compute Nodes host Microservices that in turn compose the Applications.
An Application, modelled in FogAtlas as a Kubernetes CRD named FADepl, is defined by a graph composed by Vertex and DataFlow. Vertices can be External Endpoints or Microservices whereas DataFlows represent edges connecting two vertices.
FOGATLAS CRD
Essentially, FogAtlas is an extension of Kubernetes so as to handle cloud-native applications in a distributed and decentralized infrastructure. Such an extension is based on the definition of a set of Custom Resource Definition.
Hereunder you can find a excerpt of the types.go file that defines these CRDs.
const ( New FAStatus = iota Synced Failed Changed)
type FADepl struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec FADeplSpec `json:"spec"` Status FADeplStatus `json:"status"`}
type FADeplMicroservice struct { Name string `json:"name"` Regions []*FARegion `json:"regions,omitempty"` MIPSRequired int64 `json:"mipsrequired,omitempty"` Deployment appsv1.Deployment `json:"deployment"`}
type FARegion struct { RegionRequired string `json:"regionrequired,omitempty"` RegionSelected string `json:"regionselected"` Replicas int32 `json:"replicas,omitempty"` Image string `json:"image,omitempty"` CPU2MIPSMilli int64 `json:"cpu2mipsmilli,omitempty"`}
type FADeplDataFlow struct { BandwidthRequired int32 `json:"bandwidthrequired"` LatencyRequired int32 `json:"latency"` SourceId string `json:"sourceid"` DestinationId string `json:"destinationid"`}
type FADeplSpec struct { ExternalEndpoints []string `json:"externalendpoints"` Microservices []*FADeplMicroservice `json:"microservices"` DataFlows []*FADeplDataFlow `json:"dataflows"` Algorithm string `json:"algorithm"`}
type FADeplStatus struct { Placements []*FAPlacement `json:"placements,omitempty"` LinksOccupancy []*FALinkOccupancy `json:"linksoccupancy,omitempty"` CurrentStatus FAStatus `json:"currentstatus"`}
type FAPlacement struct { Regions []*FARegion `json:"regions"` Microservice string `json:"microservice"`}
type FALinkOccupancy struct { LinkId string `json:"linkid"` BwAllocated int32 `json:"bwallocated"` IsChanged bool `json:"ischanged"`}
type FADeplList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []FADepl `json:"items"`}
type Region struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec RegionSpec `json:"spec"` Status RegionStatus `json:"status"`}
type RegionType string
const ( Nodes RegionType = "nodes" Clusters RegionType = "clusters" Hostcluster RegionType = "hostcluster")
type RegionSpec struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` Location string `json:"location"` Tier int32 `json:"tier"` Type RegionType `json:"type,omitempty"` CPUModel string `json:"cpumodel"` CPU2MIPS int64 `json:"cpu2mips"`}
type RegionStatus struct { CurrentStatus int32 `json:"currentStatus"`}
type RegionList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []Region `json:"items"`}
type ExternalEndpoint struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ExternalEndpointSpec `json:"spec"` Status ExternalEndpointStatus `json:"status"`}
type ExternalEndpointSpec struct { Id string `json:"id"` Type string `json:"type"` Name string `json:"name"` Description string `json:"description"` IpAddress string `json:"ipaddress"` Location string `json:"location"` RegionId string `json:"regionid"`}
type ExternalEndpointStatus struct { CurrentStatus int32 `json:"currentStatus"`}
type ExternalEndpointList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []ExternalEndpoint `json:"items"`}
type Link struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec LinkSpec `json:"spec"` Status LinkStatus `json:"status"`}
type LinkSpec struct { Id string `json:"id"` EndpointA string `json:"endpointa"` EndpointB string `json:"endpointb"` BwPeak int32 `json:"bwpeak"` BwMeasured int32 `json:"bwmeasured"` Latency int32 `json:"latency"` Status string `json:"status"`}
type LinkStatus struct { BwAllocated int32 `json:"bwallocated"` CurrentStatus int32 `json:"currentstatus"`}
type LinkList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []Link `json:"items"`}