services

package
v0.0.0-...-798ae07 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Unmarshalled service configuration files that are loaded from disk,
	// they will be loaded into service descriptors that will bundle up
	// additional runtime state information.
	//
	// Initialized by loadSavedConfigs()
	ServiceConfigs []*ServiceConfiguration
)
View Source
var (
	ServiceDescriptors []*ServiceDescriptor
)

Functions

func WatchServiceConfigurationFiles

func WatchServiceConfigurationFiles()

Thread that will initially load all available configs from disk and start up running services by attaching each config to a descriptor. Afterwards, the thread will watch all configuration files and check for updates to configs based on hash

Types

type ServiceConfiguration

type ServiceConfiguration struct {
	// If the "static" configuration is to be changed by the API.
	M sync.Mutex
	// Name of the service for identification and other things.
	Name          string   `json:"name" yaml:"name"`
	Configuration *Svcconf `json:"configuration" yaml:"configuration"`

	SandboxConfig    *criapi.PodSandboxConfig  `json:"pod_sandbox"`
	ContainerConfigs []*criapi.ContainerConfig `json:"containers"`
}

The attached configuration for describing a service/pod to be run on the host. Is designed to be similar to a Deployment yaml file for Kubernetes, but with a more paired-down API.

type ServiceController

type ServiceController interface {
	Start() error
	Kill() error
	Update() error
	Stats()
}

type ServiceDescriptor

type ServiceDescriptor struct {
	// Mutex if API/control-plane and status controller needs to configure the state of this service.
	M sync.Mutex
	// Describes the state of this service, can either be
	// 1 (running), 0 (disabled/not-running), or -1 (failed/exited).
	State int
	// Internal container state
	CState criapi.ContainerState
	// Map of command names inside of container mapped to the container ID of each of the running containers.
	Id map[string]string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// ID of the sandbox to which this container belongs.
	PodSandboxId string `protobuf:"bytes,2,opt,name=pod_sandbox_id,json=podSandboxId,proto3" json:"pod_sandbox_id,omitempty"`
	// Creation time of the container in nanoseconds.
	CreatedAt int64 `protobuf:"varint,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// "Static" configuration for a service to be read by the control plane for initializing a service,
	// and parts can be updated by the API during runtime.
	Config *ServiceConfiguration
}

Describes a service and its associated state to be containerized/run on the host.

func (*ServiceDescriptor) Kill

func (sd *ServiceDescriptor) Kill() error

func (*ServiceDescriptor) Start

func (sd *ServiceDescriptor) Start() error

type ServiceSpec

type ServiceSpec struct {
	Hostname    string   `json:"hostname" yaml:"hostname"`
	Nameservers []string `json:"nameservers" yaml:"nameservers"`
}

type Svcconf

type Svcconf struct {
	Meta map[string]interface{} `json:"metadata" yaml:"metadata"`
	Spec *ServiceSpec           `json:"spec" yaml:"spec"`
}

Jump to

Keyboard shortcuts

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