forge

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WireguardSubnet = "192.168.254.0/24"

	//TODO get from foundryd
	InfranetGateway = "172.30.0.1"
)

Variables

This section is empty.

Functions

func AddGroup

func AddGroup(name string) error

func AddMounts added in v0.1.11

func AddMounts(mounts []*api.Mount) error

AddMounts adds mounts to node

func AddSshAuthorizedKeys

func AddSshAuthorizedKeys(user string, keys []string) error

func AddUser

func AddUser(name, passwd string) error

func AddUserToGroup

func AddUserToGroup(name, group string) error

func Error

func Error(message string) error

Error creates an error, and logs it righteously

func ErrorE

func ErrorE(message string, err error) error

Encapsulate err in a structured log and return an abstracted high-level error with message as the payload

func ErrorEF

func ErrorEF(message string, err error, fields log.Fields) error

Encapsulate fields and err in a structured log and return an abstracted high-level error with message as the payload

func ErrorF

func ErrorF(message string, fields log.Fields) error

Encapsulate fields in a structured log and return an abstracted high-level error with message as the payload

func Forge

func Forge(mc *api.MachineConfig) error

Forge is the top level function responsible for implementing "forging" a set of foundry instructions onto a node

func ForgeHostname added in v0.1.5

func ForgeHostname(hostname string) error

func ForgeInterfaces

func ForgeInterfaces(interfaces []*api.Interface) error

func ForgePhy

func ForgePhy(ifx *api.Interface) error

func ForgeRootfs added in v0.1.8

func ForgeRootfs() error

func ForgeRoutes added in v0.1.13

func ForgeRoutes() error

func ForgeStaticRoutes added in v0.1.13

func ForgeStaticRoutes(routes []*api.Route, interfaces []*api.Interface) error

func ForgeUsers

func ForgeUsers(users []*api.User) error

func ForgeVlan

func ForgeVlan(ifx *api.Interface) error

func ForgeVxlan

func ForgeVxlan(ifx *api.Interface) error

TODO

func GetIds

func GetIds() ([]string, error)

func ValidateAddress

func ValidateAddress(addr string) bool

func ValidateDHCP added in v0.1.11

func ValidateDHCP(dhcp string) bool

Types

type FSTab added in v0.1.11

type FSTab struct {
	Device    string
	Directory string
	Type      string
	Options   []string
	Dump      int
	Fsck      int
}

FSTab is the internal fstab format

type FSTabFile added in v0.1.11

type FSTabFile struct {
	// Entries is a linux user to FsTab Entry, the user key, tells us how to chown the directory
	// username: /mnt, /dev, ...
	Entries map[string][]*FSTab
}

FSTabFile wraps all the FSTab entries in /etc/fstab

func (*FSTabFile) AddFSTabEntry added in v0.1.11

func (f *FSTabFile) AddFSTabEntry(mount *api.Mount) error

AddFSTabEntry places entries into fstab for durability

func (*FSTabFile) FSTabParse added in v0.1.11

func (f *FSTabFile) FSTabParse() error

FSTabParse parses fstab file

func (*FSTabFile) FSTabWrite added in v0.1.11

func (f *FSTabFile) FSTabWrite() error

FSTabWrite writes out the fstab file

func (*FSTabFile) FindEntryByDevice added in v0.1.11

func (f *FSTabFile) FindEntryByDevice(device string) *FSTab

FindEntryByDevice checks fstab file for an entry using specified device

func (*FSTabFile) RunMount added in v0.1.11

func (f *FSTabFile) RunMount() error

RunMount runs the mount command to mount all items in fstab

type PosixUser

type PosixUser struct {
	Uid      int
	Gid      int
	Username string
	Name     string
	HomeDir  string
}

func GetPosixUser

func GetPosixUser(name string) (*PosixUser, error)

type SystemdConfig

type SystemdConfig map[string][]*unit.UnitSection

SystemdConfig keeps track of the UnitSections we are writing and updating.

func Read added in v0.1.6

func Read(filename string) (SystemdConfig, error)

Read and parse the given unit file into a SystemdConfig instance.

func (SystemdConfig) MatchName

func (c SystemdConfig) MatchName(name string)

MatchName creates Match Name unit file entry.

func (SystemdConfig) Netdev added in v0.1.6

func (c SystemdConfig) Netdev(name, kind string)

Netdev creates two unit file NetDev entries, Name and Kind.

func (SystemdConfig) NetdevVlan added in v0.1.6

func (c SystemdConfig) NetdevVlan(vid int)

NetdevVlan creates a VLAN Id unit file entry.

func (SystemdConfig) PushSection added in v0.1.13

func (c SystemdConfig) PushSection(section string)

PushSection starts a new section. Any SetEntries will be applied to the new section.

func (SystemdConfig) SetAddress

func (c SystemdConfig) SetAddress(value string)

SetAddress creates a Network Address unit file entry.

func (SystemdConfig) SetDHCP added in v0.1.11

func (c SystemdConfig) SetDHCP(value string)

SetDHCP configues systemd-networkd's dhcp value

func (SystemdConfig) SetEntry

func (c SystemdConfig) SetEntry(section, name, value string)

SetEntry appends the given name, value pair to newest section given.

func (SystemdConfig) SetMtu added in v0.1.6

func (c SystemdConfig) SetMtu(value int)

SetMtu creates a Link MTUBytes unit file entry.

func (SystemdConfig) SetVlan added in v0.1.6

func (c SystemdConfig) SetVlan(name string, vid int)

SetVlan creates a Network VLAN unti file entry.

func (SystemdConfig) Write

func (c SystemdConfig) Write(name, kind string) error

Write the current unit file entries to the appropriate Network config file.

Jump to

Keyboard shortcuts

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