Documentation
¶
Index ¶
- Constants
- Variables
- func NetResourceToProvisionType(r workloads.NetworkNetResource) (pkg.NetResource, error)
- func NetworkToProvisionType(n workloads.Network) (pkg.Network, error)
- func ResultToSchemaType(r provision.Result) (*workloads.Result, error)
- func WireguardToProvisionType(p workloads.WireguardPeer) (pkg.Peer, error)
- func WorkloadToProvisionType(w workloads.ReservationWorkload) (*provision.Reservation, error)
- type Container
- type ContainerCapacity
- type ContainerResult
- type Counter
- type CounterUint64
- type Counters
- type Debug
- type DiskType
- type Kubernetes
- type KubernetesResult
- type Mount
- type Network
- type Provisioner
- type Volume
- type VolumeResult
- type ZDB
- type ZDBResult
Constants ¶
const ( // ContainerReservation type ContainerReservation provision.ReservationType = "container" // VolumeReservation type VolumeReservation provision.ReservationType = "volume" // NetworkReservation type NetworkReservation provision.ReservationType = "network" // ZDBReservation type ZDBReservation provision.ReservationType = "zdb" // DebugReservation type DebugReservation provision.ReservationType = "debug" // KubernetesReservation type KubernetesReservation provision.ReservationType = "kubernetes" )
Variables ¶
var ProvisionOrder = map[provision.ReservationType]int{ DebugReservation: 0, NetworkReservation: 1, ZDBReservation: 2, VolumeReservation: 3, ContainerReservation: 4, KubernetesReservation: 5, }
ProvisionOrder is used to sort the workload type in the right order for provision engine
Functions ¶
func NetResourceToProvisionType ¶
func NetResourceToProvisionType(r workloads.NetworkNetResource) (pkg.NetResource, error)
NetResourceToProvisionType converts TfgridNetworkNetResource1 to pkg.NetResource
func NetworkToProvisionType ¶
NetworkToProvisionType convert TfgridReservationNetwork1 to pkg.Network
func ResultToSchemaType ¶
ResultToSchemaType converts result to schema type
func WireguardToProvisionType ¶
func WireguardToProvisionType(p workloads.WireguardPeer) (pkg.Peer, error)
WireguardToProvisionType converts WireguardPeer1 to pkg.Peer
func WorkloadToProvisionType ¶
func WorkloadToProvisionType(w workloads.ReservationWorkload) (*provision.Reservation, error)
WorkloadToProvisionType TfgridReservationWorkload1 to provision.Reservation
Types ¶
type Container ¶
type Container struct {
// URL of the flist
FList string `json:"flist"`
// URL of the storage backend for the flist
FlistStorage string `json:"flist_storage"`
// Env env variables to container in format
Env map[string]string `json:"env"`
// Env env variables to container that the value is encrypted
// with the node public key. the env will be exposed to plain
// text to the entrypoint.
SecretEnv map[string]string `json:"secret_env"`
// Entrypoint the process to start inside the container
Entrypoint string `json:"entrypoint"`
// Interactivity enable Core X as PID 1 on the container
Interactive bool `json:"interactive"`
// Mounts extra mounts in the container
Mounts []Mount `json:"mounts"`
// Network network info for container
Network Network `json:"network"`
// ContainerCapacity is the amount of resource to allocate to the container
Capacity ContainerCapacity `json:"capacity"`
// Logs contains a list of endpoint where to send containerlogs
Logs []logger.Logs `json:"logs,omitempty"`
// StatsAggregator container metrics backend
StatsAggregator []stats.Aggregator
}
Container creation info
type ContainerCapacity ¶
type ContainerCapacity struct {
// Number of CPU
CPU uint `json:"cpu"`
// Memory in MiB
Memory uint64 `json:"memory"`
//DiskType is the type of disk to use for root fs
DiskType pkg.DeviceType `json:"disk_type"`
// DiskSize of the root fs in MiB
DiskSize uint64 `json:"disk_size"`
}
ContainerCapacity is the amount of resource to allocate to the container
type ContainerResult ¶
type ContainerResult struct {
ID string `json:"id"`
IPv6 string `json:"ipv6"`
IPv4 string `json:"ipv4"`
}
ContainerResult is the information return to the BCDB after deploying a container
type Counter ¶
type Counter interface {
// Increment counter atomically by v
Increment(v uint64) uint64
// Decrement counter atomically by v
Decrement(v uint64) uint64
// Current returns the current value
Current() uint64
}
Counter interface
type CounterUint64 ¶
type CounterUint64 uint64
CounterUint64 value for safe increment/decrement
func (*CounterUint64) Current ¶
func (c *CounterUint64) Current() uint64
Current returns the current value
func (*CounterUint64) Decrement ¶
func (c *CounterUint64) Decrement(v uint64) uint64
Decrement counter atomically by one
func (*CounterUint64) Increment ¶
func (c *CounterUint64) Increment(v uint64) uint64
Increment counter atomically by one
type Counters ¶
type Counters struct {
SRU CounterUint64 // SSD storage in bytes
HRU CounterUint64 // HDD storage in bytes
MRU CounterUint64 // Memory storage in bytes
CRU CounterUint64 // CPU count absolute
// contains filtered or unexported fields
}
Counters tracks the amount of primitives workload deployed and the amount of resource unit used
func (*Counters) CurrentUnits ¶
func (c *Counters) CurrentUnits() directory.ResourceAmount
CurrentUnits return the number of each resource units reserved on the system
func (*Counters) CurrentWorkloads ¶
func (c *Counters) CurrentWorkloads() directory.WorkloadAmount
CurrentWorkloads return the number of each workloads provisioned on the system
type Debug ¶
type Debug struct {
Host string `json:"host"`
Port int `json:"port"`
Channel string `json:"channel"`
}
Debug provision schema
type Kubernetes ¶
type Kubernetes struct {
// Size of the vm, this defines the amount of vCpu, memory, and the disk size
// Docs: docs/kubernetes/sizes.md
Size uint8 `json:"size"`
// NetworkID of the network namepsace in which to run the VM. The network
// must be provisioned previously.
NetworkID pkg.NetID `json:"network_id"`
// IP of the VM. The IP must be part of the subnet available in the network
// resource defined by the networkID on this node
IP net.IP `json:"ip"`
// ClusterSecret is the hex encoded encrypted cluster secret.
ClusterSecret string `json:"cluster_secret"`
// MasterIPs define the URL's for the kubernetes master nodes. If this
// list is empty, this node is considered to be a master node.
MasterIPs []net.IP `json:"master_ips"`
// SSHKeys is a list of ssh keys to add to the VM. Keys can be either
// a full ssh key, or in the form of `github:${username}`. In case of
// the later, the VM will retrieve the github keys for this username
// when it boots.
SSHKeys []string `json:"ssh_keys"`
PlainClusterSecret string `json:"-"`
}
Kubernetes reservation data
func K8SToProvisionType ¶
func K8SToProvisionType(k workloads.K8S) (Kubernetes, string, error)
K8SToProvisionType converts type to internal provision type
type KubernetesResult ¶
KubernetesResult result returned by k3s reservation
type Network ¶
type Network struct {
NetworkID pkg.NetID `json:"network_id"`
// IP to give to the container
IPs []net.IP `json:"ips"`
PublicIP6 bool `json:"public_ip6"`
}
Network struct
type Provisioner ¶
type Provisioner struct {
Provisioners map[provision.ReservationType]provision.ProvisionerFunc
Decommissioners map[provision.ReservationType]provision.DecomissionerFunc
// contains filtered or unexported fields
}
Provisioner hold all the logic responsible to provision and decomission the different primitives workloads defined by this package
func NewProvisioner ¶
func NewProvisioner(cache provision.ReservationCache, zbus zbus.Client) *Provisioner
NewProvisioner creates a new 0-OS provisioner
type Volume ¶
type Volume struct {
// Size of the volume in GiB
Size uint64 `json:"size"`
// Type of disk underneath the volume
Type DiskType `json:"type"`
}
Volume defines a mount point
type VolumeResult ¶
type VolumeResult struct {
ID string `json:"volume_id"`
}
VolumeResult is the information return to the BCDB after deploying a volume