Skip to content

sysadmin.cluster #

fn compare_clusters #

fn compare_clusters(old Cluster, new Cluster) []string

Todo: doesnt work yet needs to be checked and fixed

fn new #

fn new() Cluster

struct Admin #

struct Admin {
pub mut:
	name        string
	description string
	ipaddress   string
	active      bool
}

struct AdminArgs #

@[params]
struct AdminArgs {
pub mut:
	name        string
	description string
	ipaddress   string
	active      bool
}

struct Cluster #

@[heap]
struct Cluster {
pub mut:
	name     string
	secret   string
	active   bool
	nodes    []Node
	admins   []Admin // can remotely access all services on the machine
	services []Service
}

fn (Cluster) add_node #

fn (mut c Cluster) add_node(nodeargs NodeArgs) !&Node

fn (Cluster) add_service #

fn (mut c Cluster) add_service(serviceargs ServiceArgs) !&Service

Helper method to add a service to the cluster

fn (Cluster) add_admin #

fn (mut c Cluster) add_admin(adminargs AdminArgs)

Helper method to add an admin to the cluster

fn (Cluster) check #

fn (c Cluster) check() !

Check method to validate the cluster configuration

struct Node #

struct Node {
pub mut:
	nr          int
	name        string
	description string
	ipaddress   string
	active      bool
}

represents a node in the cluster (a Virtual Machine running Linux)

struct NodeArgs #

@[params]
struct NodeArgs {
pub mut:
	nr          int
	name        string
	description string
	ipaddress   string
	active      bool = true
}

struct Service #

struct Service {
pub mut:
	name        string
	description string
	port        []int
	port_public []int
	active      bool
	installer   string
	depends     []string // on other services, name needs to be unique in cluster
	nodes       []int    // on which nodes does it need to run
	master      int      // if there is a specific master
}

struct ServiceArgs #

@[params]
struct ServiceArgs {
pub mut:
	name        string @[required]
	description string
	port        []int
	port_public []int
	active      bool = true
	installer   string
	depends     []string
	nodes       []int
	master      int
}