controller

package
v5.1.9-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ArgsReg -
	ArgsReg = regexp.MustCompile(`\$\{(\w+)\|{0,1}(.{0,1})\}`)
)

Functions

func ToConfig

func ToConfig(svc *service.Service) string

Types

type ConfigWriter

type ConfigWriter struct {
	// contains filtered or unexported fields
}

func (*ConfigWriter) Add

func (l *ConfigWriter) Add(k, v string)

func (*ConfigWriter) AddTitle

func (l *ConfigWriter) AddTitle(line string)

func (*ConfigWriter) Get

func (l *ConfigWriter) Get() string

type Controller

type Controller interface {
	InitStart(services []*service.Service) error
	StartService(name string) error
	StopService(name string) error
	StartList(list []*service.Service) error
	StopList(list []*service.Service) error
	RestartService(s *service.Service) error
	WriteConfig(s *service.Service) (bool, error)
	RemoveConfig(name string) error
	EnableService(name string) error
	DisableService(name string) error
	CheckBeforeStart() bool
}

Controller service daemon controller

func NewController

func NewController(conf *option.Conf, manager *ManagerService) Controller

NewController At the stage you want to load the configurations of all rainbond components

type ControllerSystemd

type ControllerSystemd struct {
	SysConfigDir string
	NodeType     string
	StartType    string

	ServiceCli string
	// contains filtered or unexported fields
}

func (*ControllerSystemd) CheckBeforeStart

func (m *ControllerSystemd) CheckBeforeStart() bool

CheckBeforeStart check before start

func (*ControllerSystemd) DisableService

func (m *ControllerSystemd) DisableService(serviceName string) error

DisableService disable service

func (*ControllerSystemd) EnableService

func (m *ControllerSystemd) EnableService(serviceName string) error

EnableService enable service

func (*ControllerSystemd) InitStart

func (m *ControllerSystemd) InitStart(services []*service.Service) error

InitStart init start. will start some required service

func (*ControllerSystemd) RemoveConfig

func (m *ControllerSystemd) RemoveConfig(name string) error

RemoveConfig remove config

func (*ControllerSystemd) RestartService

func (m *ControllerSystemd) RestartService(s *service.Service) error

RestartService restart service

func (*ControllerSystemd) StartList

func (m *ControllerSystemd) StartList(list []*service.Service) error

StartList start some service

func (*ControllerSystemd) StartService

func (m *ControllerSystemd) StartService(serviceName string) error

StartService start service

func (*ControllerSystemd) StopList

func (m *ControllerSystemd) StopList(list []*service.Service) error

StopList stop some service

func (*ControllerSystemd) StopService

func (m *ControllerSystemd) StopService(serviceName string) error

StopService stop service

func (*ControllerSystemd) WriteConfig

func (m *ControllerSystemd) WriteConfig(s *service.Service) (bool, error)

WriteConfig write config The first parameter returned represents whether there has been a change If I write it the first time, there is no change

type Manager

type Manager interface {
	Start(*client.HostNode) error
	Stop() error
	GetAllService() ([]*service.Service, error)
	Online() error
	Offline() error
	ReLoadServices() error
	StartService(serviceName string) error
	StopService(serviceName string) error
	SetAPIRoute(apim *api.Manager) error
	GetService(serviceName string) *service.Service
	ListServiceImages() []string
}

Manager Manager

type ManagerService

type ManagerService struct {
	// contains filtered or unexported fields
}

ManagerService manager service

func NewManagerService

func NewManagerService(conf *option.Conf, healthyManager healthy.Manager, cluster client.ClusterClient) *ManagerService

NewManagerService new controller manager

func (*ManagerService) DownOneServiceEndpoint

func (m *ManagerService) DownOneServiceEndpoint(s *service.Service)

DownOneServiceEndpoint down service endpoint

func (*ManagerService) GetAllService

func (m *ManagerService) GetAllService() ([]*service.Service, error)

GetAllService get all service

func (*ManagerService) GetService

func (m *ManagerService) GetService(serviceName string) *service.Service

GetService get service

func (*ManagerService) InjectConfig

func (m *ManagerService) InjectConfig(content string) string

InjectConfig inject config

func (*ManagerService) ListServiceImages

func (m *ManagerService) ListServiceImages() []string

ListServiceImages -

func (*ManagerService) Offline

func (m *ManagerService) Offline() error

Offline stop all service of on the node

func (*ManagerService) Online

func (m *ManagerService) Online() error

Online start all service of on the node

func (*ManagerService) ReLoadServices

func (m *ManagerService) ReLoadServices() error

ReLoadServices -

1. reload services info from local file system 2. regenerate systemd config file and restart with config changes 3. start all newly added services

func (*ManagerService) SetAPIRoute

func (m *ManagerService) SetAPIRoute(apim *api.Manager) error

SetAPIRoute set api route

func (*ManagerService) SetEndpoints

func (m *ManagerService) SetEndpoints(hostIP string)

SetEndpoints regists endpoints in etcd

func (*ManagerService) Start

func (m *ManagerService) Start(node *client.HostNode) error

Start start and monitor all service

func (*ManagerService) StartService

func (m *ManagerService) StartService(serviceName string) error

StartService start a service

func (*ManagerService) StartServiceAPI

func (m *ManagerService) StartServiceAPI(w http.ResponseWriter, r *http.Request)

StartServiceAPI start a service

func (*ManagerService) StartServices

func (m *ManagerService) StartServices()

StartServices start services

func (*ManagerService) Stop

func (m *ManagerService) Stop() error

Stop stop manager

func (*ManagerService) StopService

func (m *ManagerService) StopService(serviceName string) error

StopService start a service

func (*ManagerService) StopServiceAPI

func (m *ManagerService) StopServiceAPI(w http.ResponseWriter, r *http.Request)

StopServiceAPI stop a service

func (*ManagerService) StopSyncService

func (m *ManagerService) StopSyncService()

StopSyncService -

func (*ManagerService) SyncServiceStatusController

func (m *ManagerService) SyncServiceStatusController()

SyncServiceStatusController synchronize all service status to as we expect

func (*ManagerService) UpOneServiceEndpoint

func (m *ManagerService) UpOneServiceEndpoint(s *service.Service)

UpOneServiceEndpoint up service endpoint

func (*ManagerService) UpdateConfigAPI

func (m *ManagerService) UpdateConfigAPI(w http.ResponseWriter, r *http.Request)

UpdateConfigAPI update service config

func (*ManagerService) WaitStart

func (m *ManagerService) WaitStart(name string, duration time.Duration) bool

WaitStart waiting service healty

func (*ManagerService) WriteServices

func (m *ManagerService) WriteServices() error

WriteServices write services

Jump to

Keyboard shortcuts

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