rainbond: github.com/goodrain/rainbond/node/nodem/controller Index | Files

package controller

import "github.com/goodrain/rainbond/node/nodem/controller"


Package Files

controller.go controller_systemd_linux.go manager.go manager_api.go manager_service.go


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

func ToConfig Uses

func ToConfig(svc *service.Service) string

type ConfigWriter Uses

type ConfigWriter struct {
    // contains filtered or unexported fields

func (*ConfigWriter) Add Uses

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

func (*ConfigWriter) AddTitle Uses

func (l *ConfigWriter) AddTitle(line string)

func (*ConfigWriter) Get Uses

func (l *ConfigWriter) Get() string

type Controller Uses

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) error
    RemoveConfig(name string) error
    EnableService(name string) error
    DisableService(name string) error
    CheckBeforeStart() bool

Controller service daemon controller

func NewController Uses

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

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

type ControllerSystemd Uses

type ControllerSystemd struct {
    SysConfigDir string
    NodeType     string
    StartType    string

    ServiceCli string
    // contains filtered or unexported fields

func (*ControllerSystemd) CheckBeforeStart Uses

func (m *ControllerSystemd) CheckBeforeStart() bool

CheckBeforeStart check before start

func (*ControllerSystemd) DisableService Uses

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

DisableService disable service

func (*ControllerSystemd) EnableService Uses

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

EnableService enable service

func (*ControllerSystemd) InitStart Uses

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

InitStart init start. will start some required service

func (*ControllerSystemd) RemoveConfig Uses

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

RemoveConfig remove config

func (*ControllerSystemd) RestartService Uses

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

RestartService restart service

func (*ControllerSystemd) StartList Uses

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

StartList start some service

func (*ControllerSystemd) StartService Uses

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

StartService start service

func (*ControllerSystemd) StopList Uses

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

StopList stop some service

func (*ControllerSystemd) StopService Uses

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

StopService stop service

func (*ControllerSystemd) WriteConfig Uses

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

WriteConfig write config

type Manager Uses

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

Manager Manager

type ManagerService Uses

type ManagerService struct {
    // contains filtered or unexported fields

ManagerService manager service

func NewManagerService Uses

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

NewManagerService new controller manager

func (*ManagerService) DownOneServiceEndpoint Uses

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

DownOneServiceEndpoint down service endpoint

func (*ManagerService) GetAllService Uses

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

GetAllService get all service

func (*ManagerService) GetService Uses

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

GetService get service

func (*ManagerService) InjectConfig Uses

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

InjectConfig inject config

func (*ManagerService) Offline Uses

func (m *ManagerService) Offline() error

Offline stop all service of on the node

func (*ManagerService) Online Uses

func (m *ManagerService) Online() error

Online start all service of on the node

func (*ManagerService) ReLoadServices Uses

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 Uses

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

SetAPIRoute set api route

func (*ManagerService) SetEndpoints Uses

func (m *ManagerService) SetEndpoints(hostIP string)

SetEndpoints regists endpoints in etcd

func (*ManagerService) Start Uses

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

Start start and monitor all service

func (*ManagerService) StartService Uses

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

StartService start a service

func (*ManagerService) StartServiceAPI Uses

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

StartServiceAPI start a service

func (*ManagerService) StartServices Uses

func (m *ManagerService) StartServices()

StartServices start services

func (*ManagerService) Stop Uses

func (m *ManagerService) Stop() error

Stop stop manager

func (*ManagerService) StopService Uses

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

StopService start a service

func (*ManagerService) StopServiceAPI Uses

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

StopServiceAPI stop a service

func (*ManagerService) StopSyncService Uses

func (m *ManagerService) StopSyncService()

StopSyncService -

func (*ManagerService) SyncServiceStatusController Uses

func (m *ManagerService) SyncServiceStatusController()

SyncServiceStatusController synchronize all service status to as we expect

func (*ManagerService) UpOneServiceEndpoint Uses

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

UpOneServiceEndpoint up service endpoint

func (*ManagerService) UpdateConfigAPI Uses

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

UpdateConfigAPI update service config

func (*ManagerService) WaitStart Uses

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

WaitStart waiting service healty

func (*ManagerService) WriteServices Uses

func (m *ManagerService) WriteServices() error

WriteServices write services

Package controller imports 20 packages (graph) and is imported by 1 packages. Updated 2019-06-28. Refresh now. Tools for package owners.