Documentation ¶
Overview ¶
Package roleserve implements the roleserver/“Role Server”.
The Role Server runs on every node and is responsible for running all of the node's role dependant services, like the control plane (Consensus/etcd and Curator) and Kubernetes. It watches the node roles as assigned by the cluster's curator, updates the status of the node within the curator, and spawns on-demand services.
.-----------. .--------. Watches .------------. | Cluster |--------->| Role |<----------| Node Roles | | Enrolment | Provides | Server | Updates '------------' '-----------' Data | |----. .-------------. '--------' '----->| Node Status | Spawns | | Spawns '-------------' .-----' '-----. V V .-----------. .------------. | Consensus | | Kubernetes | | & Curator | | | '-----------' '------------'
The internal state of the Role Server (eg. status of services, input from Cluster Enrolment, current node roles as retrieved from the cluster) is stored as in-memory Event Value variables, with some of them being exposed externally for other services to consume (ie. ones that wish to depend on some information managed by the Role Server but which do not need to be spawned on demand by the Role Server). These Event Values and code which acts upon them form a reactive/dataflow-driven model which drives the Role Server logic forward.
The Role Server also has to handle the complex bootstrap problem involved in simultaneously accessing the control plane (for node roles and other cluster data) while maintaining (possibly the only one in the cluster) control plane instance. This problem is resolved by using the RPC resolver package which allows dynamic reconfiguration of endpoints as the cluster is running.
Index ¶
- type Config
- type KubernetesStatus
- type Service
- func (s *Service) ProvideBootstrapData(privkey ed25519.PrivateKey, iok, cuk, nuk, jkey []byte, icc *curator.Cluster, ...)
- func (s *Service) ProvideJoinData(credentials identity.NodeCredentials, directory *cpb.ClusterDirectory)
- func (s *Service) ProvideRegisterData(credentials identity.NodeCredentials, directory *cpb.ClusterDirectory)
- func (s *Service) Run(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // StorageRoot is a handle to access all of the Node's storage. This is needed // as the roleserver spawns complex workloads like Kubernetes which need access // to a broad range of storage. StorageRoot *localstorage.Root // Network is a handle to the network service, used by workloads. Network *network.Service // resolver is the main, long-lived, authenticated cluster resolver that is used // for all subsequent gRPC calls by the subordinates of the roleserver. It is // created early in the roleserver lifecycle, and is seeded with node // information from the ProvideXXX methods. Resolver *resolver.Resolver // Update is a handle to the update service, used by workloads. Update *update.Service LogTree *logtree.LogTree }
Config is the configuration of the role server.
type KubernetesStatus ¶
type KubernetesStatus struct {
Controller *kubernetes.Controller
}
KubernetesStatus is an Event Value structure populated by a running Kubernetes instance. It allows external services to access the Kubernetes Service whenever available (ie. enabled and started by the Role Server).
type Service ¶
type Service struct { Config KubernetesStatus memory.Value[*KubernetesStatus] CuratorConnection memory.Value[*curatorConnection] // contains filtered or unexported fields }
Service is the roleserver/“Role Server” service. See the package-level documentation for more details.
func (*Service) ProvideBootstrapData ¶
func (s *Service) ProvideBootstrapData(privkey ed25519.PrivateKey, iok, cuk, nuk, jkey []byte, icc *curator.Cluster, tpmUsage cpb.NodeTPMUsage)
func (*Service) ProvideJoinData ¶
func (s *Service) ProvideJoinData(credentials identity.NodeCredentials, directory *cpb.ClusterDirectory)
func (*Service) ProvideRegisterData ¶
func (s *Service) ProvideRegisterData(credentials identity.NodeCredentials, directory *cpb.ClusterDirectory)