config

package
v0.0.0-...-08b45ed Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package config reads, parses, and represents the warewulf.conf config file.

warewulf.conf is a yaml-formatted configuration file that includes configuration for the Warewulf daemon and commands, as well as the DHCP, TFTP and NFS services that Warewulf manages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DHCPConf

type DHCPConf struct {
	Enabled     bool   `yaml:"enabled" default:"true"`
	Template    string `yaml:"template" default:"default"`
	RangeStart  string `yaml:"range start,omitempty"`
	RangeEnd    string `yaml:"range end,omitempty"`
	SystemdName string `yaml:"systemd name" default:"dhcpd"`
}

DHCPConf represents the configuration for the DHCP service that Warewulf will configure.

type MountEntry

type MountEntry struct {
	Source   string `yaml:"source"`
	Dest     string `yaml:"dest,omitempty"`
	ReadOnly bool   `yaml:"readonly,omitempty"`
	Options  string `yaml:"options,omitempty"` // ignored at the moment
}

A MountEntry represents a bind mount that is applied to a container during exec and shell.

type NFSConf

type NFSConf struct {
	Enabled         bool             `yaml:"enabled" default:"true"`
	ExportsExtended []*NFSExportConf `yaml:"export paths" default:"[]"`
	SystemdName     string           `yaml:"systemd name" default:"nfsd"`
}

NFSConf represents the NFS configuration that will be used by Warewulf to generate exports on the server and mounts on compute nodes.

func (*NFSConf) Unmarshal

func (conf *NFSConf) Unmarshal(unmarshal func(interface{}) error) error

Implements the Unmarshal interface for NFSConf to set default values.

type NFSExportConf

type NFSExportConf struct {
	Path          string `yaml:"path" default:"/dev/null"`
	ExportOptions string `default:"rw,sync,no_subtree_check" yaml:"export options"`
	MountOptions  string `default:"defaults" yaml:"mount options"`
	Mount         bool   `default:"true" yaml:"mount"`
}

An NFSExportConf reprents a single NFS export / mount.

type RootConf

type RootConf struct {
	WWInternal      int           `yaml:"WW_INTERNAL"`
	Comment         string        `yaml:"comment,omitempty"`
	Ipaddr          string        `yaml:"ipaddr"`
	Ipaddr6         string        `yaml:"ipaddr6,omitempty"`
	Netmask         string        `yaml:"netmask"`
	Network         string        `yaml:"network,omitempty"`
	Ipv6net         string        `yaml:"ipv6net,omitempty"`
	Fqdn            string        `yaml:"fqdn,omitempty"`
	Warewulf        *WarewulfConf `yaml:"warewulf"`
	DHCP            *DHCPConf     `yaml:"dhcp"`
	TFTP            *TFTPConf     `yaml:"tftp"`
	NFS             *NFSConf      `yaml:"nfs"`
	SSH             *SSHConf      `yaml:"ssh,omitempty"`
	MountsContainer []*MountEntry `yaml:"container mounts" default:"[{\"source\": \"/etc/resolv.conf\", \"dest\": \"/etc/resolv.conf\"}]"`
	Paths           *BuildConfig  `yaml:"paths"`
	// contains filtered or unexported fields
}

RootConf is the main Warewulf configuration structure. It stores some information about the Warewulf server locally, and has [WarewulfConf], DHCPConf, [TFTPConf], and NFSConf sub-sections.

func Get

func Get() *RootConf

Get returns a previously cached RootConf if it exists, or returns a new RootConf.

func New

func New() *RootConf

New caches and returns a new RootConf initialized with empty values, clearing replacing any previously cached value.

func (*RootConf) InitializedFromFile

func (conf *RootConf) InitializedFromFile() bool

InitializedFromFile returns true if RootConf memory was read from a file, or false otherwise.

func (*RootConf) Parse

func (conf *RootConf) Parse(data []byte) error

Parse populates RootConf with the values from a yaml document.

func (*RootConf) Read

func (conf *RootConf) Read(confFileName string) error

Read populates RootConf with the values from a configuration file.

func (*RootConf) SetDynamicDefaults

func (conf *RootConf) SetDynamicDefaults() (err error)

SetDynamicDefaults populates RootConf with plausible defaults for the runtime environment.

type SSHConf

type SSHConf struct {
	KeyTypes []string `yaml:"key types" default:"[\"rsa\",\"dsa\",\"ecdsa\",\"ed25519\"]"`
}

Jump to

Keyboard shortcuts

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