node

package
v0.0.0-...-9a4260c Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HostSpecServiceType indicates host service of ceph spec yaml
	HostSpecServiceType = "host"
	// SSHCmdTimeout  defines max delay time for SSH connection
	SSHCmdTimeout = 20 * time.Minute
)

Variables

This section is empty.

Functions

func GetDistro

func GetDistro(n *Node) error

GetDistro fetch linux distribution info from the target node

Types

type Distro

type Distro string

Distro contains linux distribution info of each node

const (
	// Ubuntu is a Linux distribution based on Debian
	Ubuntu Distro = "ubuntu"
	// Centos is a Linux distribution that functionally compatible with its upstream source, RHEL
	Centos Distro = "centos"
)

type HostSpec

type HostSpec struct {
	// ServiceType indicates service_type field
	ServiceType string `yaml:"service_type"` // use const var
	// Addr indicates addr field
	Addr string `yaml:"addr"`
	// HostName indicates hostname field
	HostName string `yaml:"hostname"`
	// Labels indicates labels field
	Labels []string `yaml:"labels,omitempty"`
	// Status indicates status field
	Status string `yaml:"status,omitempty"`
}

HostSpec is struct to define ceph host spec of ceph spec yaml

func (*HostSpec) AddLabels

func (hs *HostSpec) AddLabels(labels ...string) error

AddLabels adds value to Labels

func (*HostSpec) GetAddr

func (hs *HostSpec) GetAddr() string

GetAddr gets value of Addr

func (*HostSpec) GetHostName

func (hs *HostSpec) GetHostName() string

GetHostName gets value of HostName

func (*HostSpec) GetLabels

func (hs *HostSpec) GetLabels() []string

GetLabels gets value of Labels

func (*HostSpec) GetServiceType

func (hs *HostSpec) GetServiceType() string

GetServiceType gets HostSpecServiceTypee

func (*HostSpec) GetStatus

func (hs *HostSpec) GetStatus() string

GetStatus gets value of Status

func (*HostSpec) MakeYmlFile

func (hs *HostSpec) MakeYmlFile(yamlWrapper wrapper.YamlInterface, ioUtilWrapper wrapper.IoUtilInterface, fileName string) error

MakeYmlFile creates ceph host service file using HostSpec

func (*HostSpec) SetAddr

func (hs *HostSpec) SetAddr(addr string) error

SetAddr sets Addr to value

func (*HostSpec) SetHostName

func (hs *HostSpec) SetHostName(hostName string) error

SetHostName sets HostName to value

func (*HostSpec) SetLabels

func (hs *HostSpec) SetLabels(labels []string) error

SetLabels sets Labels to value

func (*HostSpec) SetServiceType

func (hs *HostSpec) SetServiceType() error

SetServiceType sets ServiceType to value

func (*HostSpec) SetStatus

func (hs *HostSpec) SetStatus(status string) error

SetStatus sets Status to value

type Node

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

Node contains node info to deploy ceph

func NewNodesFromCephCr

func NewNodesFromCephCr(cephSpec hypersdsv1alpha1.CephClusterSpec) ([]*Node, error)

NewNodesFromCephCr reads node information from cephclusterspec and creates Node list

func (*Node) GetHostSpec

func (n *Node) GetHostSpec() HostSpec

GetHostSpec gets value of hostSpec

func (*Node) GetOs

func (n *Node) GetOs() OS

GetOs retrieves operating system info

func (*Node) GetUserID

func (n *Node) GetUserID() string

GetUserID gets value of userID

func (*Node) GetUserPw

func (n *Node) GetUserPw() string

GetUserPw gets value of userPw

func (*Node) RunSSHCmd

func (n *Node) RunSSHCmd(sshWrapper wrapper.SSHInterface, cmdQuery string) (bytes.Buffer, error)

RunSSHCmd executes the command on the node using ssh package

func (*Node) RunScpCmd

func (n *Node) RunScpCmd(exec wrapper.ExecInterface, srcFile, destFile string, role Role) (bytes.Buffer, error)

RunScpCmd executes file copy between source node and destination node using scp

func (*Node) SetHostSpec

func (n *Node) SetHostSpec(hostSpec *HostSpec) error

SetHostSpec sets hostSpec to value

func (*Node) SetOs

func (n *Node) SetOs(name Distro, packager Packager, version float64) error

SetOs sets operating system info to its struct

func (*Node) SetUserID

func (n *Node) SetUserID(userID string) error

SetUserID sets userID to value

func (*Node) SetUserPw

func (n *Node) SetUserPw(userPw string) error

SetUserPw sets userPw to value

type OS

type OS struct {
	Distro   Distro
	Packager Packager
	Version  float64
}

OS contains operating system info of each node

type Packager

type Packager string

Packager contains linux package manager info of each distro

const (
	// Yum is a primary package management tool for linux distro using rpm package manager
	Yum Packager = "yum "
	// Apt is a package management tool in Debian and Ubuntu
	Apt Packager = "apt-get "
)

type Role

type Role int

Role indicates target of SSH connection

const (
	// SOURCE indicates source of SSH connection
	SOURCE Role = iota
	// DESTINATION indicates destination of SSH connection
	DESTINATION
)

Jump to

Keyboard shortcuts

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