workloads

package
v0.2.2-rc7 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	WorkloadId        int64               `bson:"workload_id" json:"workload_id"`
	NodeId            string              `bson:"node_id" json:"node_id"`
	Flist             string              `bson:"flist" json:"flist"`
	HubUrl            string              `bson:"hub_url" json:"hub_url"`
	Environment       map[string]string   `bson:"environment" json:"environment"`
	SecretEnvironment map[string]string   `bson:"secret_environment" json:"secret_environment"`
	Entrypoint        string              `bson:"entrypoint" json:"entrypoint"`
	Interactive       bool                `bson:"interactive" json:"interactive"`
	Volumes           []ContainerMount    `bson:"volumes" json:"volumes"`
	NetworkConnection []NetworkConnection `bson:"network_connection" json:"network_connection"`
	StatsAggregator   []StatsAggregator   `bson:"stats_aggregator" json:"stats_aggregator"`
	Logs              []Logs              `bson:"logs" json:"logs"`
	FarmerTid         int64               `bson:"farmer_tid" json:"farmer_tid"`
	Capacity          ContainerCapacity   `bson:"capcity" json:"capacity"`
}

func NewContainer

func NewContainer() (Container, error)

type ContainerCapacity

type ContainerCapacity struct {
	Cpu    int64 `bson:"cpu" json:"cpu"`
	Memory int64 `bson:"memory" json:"memory"`
}

type ContainerMount

type ContainerMount struct {
	VolumeId   string `bson:"volume_id" json:"volume_id"`
	Mountpoint string `bson:"mountpoint" json:"mountpoint"`
}

func NewTfgridWorkloadsReservationContainerMount1

func NewTfgridWorkloadsReservationContainerMount1() (ContainerMount, error)

type DiskTypeEnum

type DiskTypeEnum uint8
const (
	DiskTypeHDD DiskTypeEnum = iota
	DiskTypeSSD
)

func (DiskTypeEnum) String

func (e DiskTypeEnum) String() string

type K8S

type K8S struct {
	WorkloadId      int64             `bson:"workload_id" json:"workload_id"`
	NodeId          string            `bson:"node_id" json:"node_id"`
	Size            int64             `bson:"size" json:"size"`
	NetworkId       string            `bson:"network_id" json:"network_id"`
	Ipaddress       net.IP            `bson:"ipaddress" json:"ipaddress"`
	ClusterSecret   string            `bson:"cluster_secret" json:"cluster_secret"`
	MasterIps       []net.IP          `bson:"master_ips" json:"master_ips"`
	SshKeys         []string          `bson:"ssh_keys" json:"ssh_keys"`
	StatsAggregator []StatsAggregator `bson:"stats_aggregator" json:"stats_aggregator"`
	FarmerTid       int64             `bson:"farmer_tid" json:"farmer_tid"`
}

func NewK8S

func NewK8S() (K8S, error)

type Logs

type Logs struct {
	Type string    `bson:"type" json:"type"`
	Data LogsRedis `bson:"data" json:"data"`
}

type LogsRedis

type LogsRedis struct {
	Stdout string `bson:"stdout" json:"stdout"`
	Stderr string `bson:"stderr" json:"stderr"`
}

type Network

type Network struct {
	Name             string               `bson:"name" json:"name"`
	WorkloadId       int64                `bson:"workload_id" json:"workload_id"`
	Iprange          schema.IPRange       `bson:"iprange" json:"iprange"`
	StatsAggregator  []StatsAggregator    `bson:"stats_aggregator" json:"stats_aggregator"`
	NetworkResources []NetworkNetResource `bson:"network_resources" json:"network_resources"`
	FarmerTid        int64                `bson:"farmer_tid" json:"farmer_tid"`
}

func NewNetwork

func NewNetwork() (Network, error)

type NetworkConnection

type NetworkConnection struct {
	NetworkId string `bson:"network_id" json:"network_id"`
	Ipaddress net.IP `bson:"ipaddress" json:"ipaddress"`
	PublicIp6 bool   `bson:"public_ip6" json:"public_ip6"`
}

func NewNetworkConnection

func NewNetworkConnection() (NetworkConnection, error)

type NetworkNetResource

type NetworkNetResource struct {
	NodeId                       string          `bson:"node_id" json:"node_id"`
	WireguardPrivateKeyEncrypted string          `bson:"wireguard_private_key_encrypted" json:"wireguard_private_key_encrypted"`
	WireguardPublicKey           string          `bson:"wireguard_public_key" json:"wireguard_public_key"`
	WireguardListenPort          int64           `bson:"wireguard_listen_port" json:"wireguard_listen_port"`
	Iprange                      schema.IPRange  `bson:"iprange" json:"iprange"`
	Peers                        []WireguardPeer `bson:"peers" json:"peers"`
}

func NewNetworkNetResource

func NewNetworkNetResource() (NetworkNetResource, error)

type NextActionEnum

type NextActionEnum uint8
const (
	NextActionCreate NextActionEnum = iota
	NextActionSign
	NextActionPay
	NextActionDeploy
	NextActionDelete
	NextActionInvalid
	NextActionDeleted
)

func (NextActionEnum) String

func (e NextActionEnum) String() string

type Reservation

type Reservation struct {
	ID                  schema.ID          `bson:"_id" json:"id"`
	Json                string             `bson:"json" json:"json"`
	DataReservation     ReservationData    `bson:"data_reservation" json:"data_reservation"`
	CustomerTid         int64              `bson:"customer_tid" json:"customer_tid"`
	CustomerSignature   string             `bson:"customer_signature" json:"customer_signature"`
	NextAction          NextActionEnum     `bson:"next_action" json:"next_action"`
	SignaturesProvision []SigningSignature `bson:"signatures_provision" json:"signatures_provision"`
	SignaturesFarmer    []SigningSignature `bson:"signatures_farmer" json:"signatures_farmer"`
	SignaturesDelete    []SigningSignature `bson:"signatures_delete" json:"signatures_delete"`
	Epoch               schema.Date        `bson:"epoch" json:"epoch"`
	Results             []Result           `bson:"results" json:"results"`
}

func NewReservation

func NewReservation() (Reservation, error)

type ReservationData

type ReservationData struct {
	Description             string         `bson:"description" json:"description"`
	SigningRequestProvision SigningRequest `bson:"signing_request_provision" json:"signing_request_provision"`
	SigningRequestDelete    SigningRequest `bson:"signing_request_delete" json:"signing_request_delete"`
	Containers              []Container    `bson:"containers" json:"containers"`
	Volumes                 []Volume       `bson:"volumes" json:"volumes"`
	Zdbs                    []ZDB          `bson:"zdbs" json:"zdbs"`
	Networks                []Network      `bson:"networks" json:"networks"`
	Kubernetes              []K8S          `bson:"kubernetes" json:"kubernetes"`
	ExpirationProvisioning  schema.Date    `bson:"expiration_provisioning" json:"expiration_provisioning"`
	ExpirationReservation   schema.Date    `bson:"expiration_reservation" json:"expiration_reservation"`
}

func NewReservationData

func NewReservationData() (ReservationData, error)

type ReservationWorkload

type ReservationWorkload struct {
	WorkloadId string           `bson:"workload_id" json:"workload_id"`
	User       string           `bson:"user" json:"user"`
	Type       WorkloadTypeEnum `bson:"type" json:"type"`
	Content    interface{}      `bson:"content" json:"content"`
	Created    schema.Date      `bson:"created" json:"created"`
	Duration   int64            `bson:"duration" json:"duration"`
	Signature  string           `bson:"signature" json:"signature"`
	ToDelete   bool             `bson:"to_delete" json:"to_delete"`
}

NOTE: this type has some manual changes that need to be preserved between regenerations.

func NewReservationWorkload

func NewReservationWorkload() (ReservationWorkload, error)

type Result

type Result struct {
	Category   ResultCategoryEnum `bson:"category" json:"category"`
	WorkloadId string             `bson:"workload_id" json:"workload_id"`
	DataJson   json.RawMessage    `bson:"data_json" json:"data_json"`
	Signature  string             `bson:"signature" json:"signature"`
	State      ResultStateEnum    `bson:"state" json:"state"`
	Message    string             `bson:"message" json:"message"`
	Epoch      schema.Date        `bson:"epoch" json:"epoch"`
	NodeId     string             `bson:"node_id" json:"node_id"`
}

func NewResult

func NewResult() (Result, error)

type ResultCategoryEnum

type ResultCategoryEnum uint8
const (
	ResultCategoryZDB ResultCategoryEnum = iota
	ResultCategoryContainer
	ResultCategoryNetwork
	ResultCategoryVolume
	ResultCategoryK8S
)

func (ResultCategoryEnum) String

func (e ResultCategoryEnum) String() string

type ResultStateEnum

type ResultStateEnum uint8
const (
	ResultStateError ResultStateEnum = iota
	ResultStateOK
	ResultStateDeleted
)

func (ResultStateEnum) String

func (e ResultStateEnum) String() string

type SigningRequest

type SigningRequest struct {
	Signers   []int64 `bson:"signers" json:"signers"`
	QuorumMin int64   `bson:"quorum_min" json:"quorum_min"`
}

func NewSigningRequest

func NewSigningRequest() (SigningRequest, error)

type SigningSignature

type SigningSignature struct {
	Tid       int64       `bson:"tid" json:"tid"`
	Signature string      `bson:"signature" json:"signature"`
	Epoch     schema.Date `bson:"epoch" json:"epoch"`
}

func NewSigningSignature

func NewSigningSignature() (SigningSignature, error)

type StatsAggregator

type StatsAggregator struct {
	Addr   string `bson:"addr" json:"addr"`
	Port   int64  `bson:"port" json:"port"`
	Secret string `bson:"secret" json:"secret"`
}

func NewStatsAggregator

func NewStatsAggregator() (StatsAggregator, error)

type Volume

type Volume struct {
	WorkloadId      int64             `bson:"workload_id" json:"workload_id"`
	NodeId          string            `bson:"node_id" json:"node_id"`
	Size            int64             `bson:"size" json:"size"`
	Type            VolumeTypeEnum    `bson:"type" json:"type"`
	StatsAggregator []StatsAggregator `bson:"stats_aggregator" json:"stats_aggregator"`
	FarmerTid       int64             `bson:"farmer_tid" json:"farmer_tid"`
}

func NewVolume

func NewVolume() (Volume, error)

type VolumeTypeEnum

type VolumeTypeEnum uint8
const (
	VolumeTypeHDD VolumeTypeEnum = iota
	VolumeTypeSSD
)

func (VolumeTypeEnum) String

func (e VolumeTypeEnum) String() string

type WireguardPeer

type WireguardPeer struct {
	PublicKey      string           `bson:"public_key" json:"public_key"`
	AllowedIprange []schema.IPRange `bson:"allowed_iprange" json:"allowed_iprange"`
	Endpoint       string           `bson:"endpoint" json:"endpoint"`
	Iprange        schema.IPRange   `bson:"iprange" json:"iprange"`
}

func NewPeer

func NewPeer() (WireguardPeer, error)

type WorkloadTypeEnum

type WorkloadTypeEnum uint8
const (
	WorkloadTypeZDB WorkloadTypeEnum = iota
	WorkloadTypeContainer
	WorkloadTypeVolume
	WorkloadTypeNetwork
	WorkloadTypeKubernetes
)

func (WorkloadTypeEnum) String

func (e WorkloadTypeEnum) String() string

type ZDB

type ZDB struct {
	WorkloadId      int64             `bson:"workload_id" json:"workload_id"`
	NodeId          string            `bson:"node_id" json:"node_id"`
	Size            int64             `bson:"size" json:"size"`
	Mode            ZDBModeEnum       `bson:"mode" json:"mode"`
	Password        string            `bson:"password" json:"password"`
	DiskType        DiskTypeEnum      `bson:"disk_type" json:"disk_type"`
	Public          bool              `bson:"public" json:"public"`
	StatsAggregator []StatsAggregator `bson:"stats_aggregator" json:"stats_aggregator"`
	FarmerTid       int64             `bson:"farmer_tid" json:"farmer_tid"`
}

func NewZDB

func NewZDB() (ZDB, error)

type ZDBModeEnum

type ZDBModeEnum uint8
const (
	ZDBModeSeq ZDBModeEnum = iota
	ZDBModeUser
)

func (ZDBModeEnum) String

func (e ZDBModeEnum) String() string

Jump to

Keyboard shortcuts

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