uccd

package module
v0.0.0-...-e77e560 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 21 Imported by: 0

README

ccd

Client controller daemon.

Currently it is working only with Uyuni Server Cluster Extension. But essentially it is a daemon that does specific actions on events, coming from the Cluster controller and that should be abstracted to a configuration and plugins layer, rather then embedded directly into the code.

As of now, the ccd does the following:

  • Configures Salt Minion against specific Uyuni Server node in the cluster
  • Starts Salt Minion
  • Listens to the cluster controller endpoint for events

If the cluster controller responds with another status and/or points to another cluster node, ccd will stop Salt Minion, reconfigure it and restart it again.

All that should be a configurable scenario, rather then a code inside the daemon.

Documentation

Index

Constants

View Source
const (
	CS_NEW        = iota // new to the cluster
	CS_REGISTERED        // registered in the cluster
	CS_ORPHANED          // orphaned from the current cluster node, needs remapping
	CS_DELETED           // deleted from the cluster, needs complete shutdown of all cluster services
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CDStats

type CDStats struct {
	ClusterNodeFQDN string

	Status int
	// contains filtered or unexported fields
}

Cluster Director Stats

func NewCDStats

func NewCDStats() *CDStats

func (*CDStats) GetPubKeyFp

func (cds *CDStats) GetPubKeyFp(keypath string) string

GetPubKeyFp is just reimplementation of "salt.utils.crypt.pem_finger". Salt gets fingerprint by not stripping any newlines "\n" symbol from the key cipher text.

Default location of keys is $SALT_CONFIG/pki. If path starts with "/", it is used entirely (absolute), otherwise appended to the default root of known Salt Config root path.

func (*CDStats) SetClusterDirectorURL

func (cds *CDStats) SetClusterDirectorURL(url string) *CDStats

SetClusterDirectorURL sets the main url of the Cluster Director API endpoint, or the main entry URL to the entire cluster.

func (*CDStats) SetPubKeyFP

func (cds *CDStats) SetPubKeyFP(fp string) *CDStats

Set Salt configuration directory

func (*CDStats) SetSaltConfigDir

func (cds *CDStats) SetSaltConfigDir(confpath string) *CDStats

Set Salt configuration directory

func (*CDStats) UpdateStats

func (cds *CDStats) UpdateStats()

UpdateStats calls Cluster Director with the current Salt Minion fingerprint, and fetches current registered machine status and Cluster Node FQDN.

type Pinger

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

Pinger object

func NewPinger

func NewPinger() *Pinger

Constructor

func (*Pinger) Ping

func (p *Pinger) Ping(addr string) *ping.Statistics

Ping method pings a network address and returns statistics

type SaltOps

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

SaltOps object

func NewSaltOps

func NewSaltOps() *SaltOps

NewSaltOps is a SaltOps constructor

func (*SaltOps) GetConfDOption

func (sop *SaltOps) GetConfDOption(conf string, key string) (interface{}, string)

GetConfDOption looks for a key of the additional Salt configuration. if it was in any of config files of a ".d" directory. If none is found, an empty string is returned (and it indicates a default value is used or main config has it).

func (*SaltOps) GetConfOpion

func (sop *SaltOps) GetConfOpion(conf string, key string) interface{}

GetConfOpion looks for a key of the main Salt configuration. If none is found, an empty string is returned (and it indicates a default value is used)

func (*SaltOps) SetConfDOption

func (sop *SaltOps) SetConfDOption(conf string, key string, value interface{})

SetConfOption writes a configuration option to a .d "drop-in" config file. If parameter conf is already a full path, it will be used. Otherwise new config file "/path/to/foo.d/mgr-uccd.conf" will be used.

func (*SaltOps) SetConfOption

func (sop *SaltOps) SetConfOption(conf string, key string, value interface{})

Write a configuration option to the main config file

func (*SaltOps) SetSaltConfigDir

func (sop *SaltOps) SetSaltConfigDir(cfgdir string) *SaltOps

SetSaltConfigDir sets Salt configuration directory

func (*SaltOps) SetSaltExecPath

func (sop *SaltOps) SetSaltExecPath(execpath string) *SaltOps

SetSaltConfigDir sets Salt configuration directory

func (*SaltOps) StartSaltMinion

func (sop *SaltOps) StartSaltMinion()

StartSaltMinion starts Salt Minion in background and watches it.

func (*SaltOps) StopSaltMinion

func (sop *SaltOps) StopSaltMinion()

StopSaltMinion terminates currently running Salt Minion.

type SysOp

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

///////////////////////////////

SysOp object

func NewSysOp

func NewSysOp() *SysOp

NewSysOp is a SysOp constructor

func (*SysOp) GetSaltOps

func (sysop *SysOp) GetSaltOps() *SaltOps

GetSaltOps returns all methods to Salt Operation configuration on the client

type Uccd

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

func NewUccd

func NewUccd() *Uccd

func (*Uccd) SetClusterURL

func (d *Uccd) SetClusterURL(url string) *Uccd

SetClusterURL sets cluster main entry URL

func (*Uccd) SetMinionPEMPubKey

func (d *Uccd) SetMinionPEMPubKey(pem string) *Uccd

SetMinionPEMPubKey sets PEM public key of the current minion

func (*Uccd) SetPingTimeDuration

func (d *Uccd) SetPingTimeDuration(duration int64) *Uccd

SetPingTimeDuration sets ping pause duration to ping Cluster Node

func (*Uccd) SetSaltConfigPath

func (d *Uccd) SetSaltConfigPath(confpath string) *Uccd

SetSaltConfigPath sets configuration path to the Salt Minion

func (*Uccd) SetSaltExec

func (d *Uccd) SetSaltExec(execpath string) *Uccd

SetSaltConfigPath sets configuration path to the Salt Minion

func (*Uccd) Start

func (d *Uccd) Start()

Start the Salt Minion service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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