Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertToCOS(config *HarvesterConfig) (*yipSchema.YipConfig, error)
- func GenerateRancherdConfig(config *HarvesterConfig) (*yipSchema.YipConfig, error)
- func GetSystemSettingsAllowList() []string
- func NewToBool() mapper.Mapper
- func NewToMap() mapper.Mapper
- func NewToSlice() mapper.Mapper
- func NewTypeConverter(fieldType string, converter Converter) mapper.Mapper
- func PrintInstall(cfg HarvesterConfig) ([]byte, error)
- func RestoreOriginalNetworkConfig() error
- func SaveOriginalNetworkConfig() error
- func ToEnv(prefix string, obj interface{}) ([]string, error)
- func UpdateManagementInterfaceConfig(stage *yipSchema.Stage, mgmtInterface Network, run bool) (string, error)
- func UpdateWifiConfig(stage *yipSchema.Stage, wifis []Wifi, run bool) error
- type Addon
- type Converter
- type ElementalConfig
- type ElementalDefaultPartition
- type ElementalInstallSpec
- type ElementalPartition
- type ElementalSystem
- type File
- type FuzzyNames
- type HTTPBasicAuth
- type HarvesterChartValues
- type HarvesterConfig
- func (c *HarvesterConfig) DeepCopy() (*HarvesterConfig, error)
- func (c *HarvesterConfig) GetKubeletArgs() ([]string, error)
- func (c *HarvesterConfig) Merge(other HarvesterConfig) error
- func (c HarvesterConfig) ShouldCreateDataPartitionOnOsDisk() bool
- func (c HarvesterConfig) ShouldMountDataPartition() bool
- func (c *HarvesterConfig) String() string
- func (c *HarvesterConfig) ToCosInstallEnv() ([]string, error)
- type Install
- type LHDefaultSettings
- type LonghornChartValues
- type NTPSettings
- type Network
- type NetworkInterface
- type OS
- type SSHDConfig
- type StorageClass
- type Webhook
- type Wifi
Constants ¶
const ( SchemeVersion = 1 SanitizeMask = "***" )
const ( BondModeBalanceRR = "balance-rr" BondModeActiveBackup = "active-backup" BondModeBalnaceXOR = "balance-xor" BondModeBroadcast = "broadcast" BondModeIEEE802_3ad = "802.3ad" BondModeBalanceTLB = "balance-tlb" BondModeBalanceALB = "balance-alb" )
const ( SingleDiskMinSizeGiB = 250 MultipleDiskMinSizeGiB = 180 HardMinDataDiskSizeGiB = 50 MaxPods = 200 )
const ( ModeCreate = "create" ModeJoin = "join" ModeUpgrade = "upgrade" ModeInstall = "install" RoleDefault = "default" RoleWitness = "witness" RoleMgmt = "management" RoleWorker = "worker" NetworkMethodDHCP = "dhcp" NetworkMethodStatic = "static" NetworkMethodNone = "none" MgmtInterfaceName = "mgmt-br" MgmtBondInterfaceName = "mgmt-bo" RancherdConfigFile = "/etc/rancher/rancherd/config.yaml" DefaultCosOemSizeMiB = 50 DefaultCosStateSizeMiB = 15360 DefaultCosRecoverySizeMiB = 8192 DefaultPersistentPercentageNum = 0.3 PersistentSizeMinGiB = 150 )
Variables ¶
var ( // Following variables are replaced by ldflags RKE2Version = "" RancherVersion = "" HarvesterChartVersion = "" MonitoringChartVersion = "" LoggingChartVersion = "" )
Functions ¶
func ConvertToCOS ¶ added in v0.2.0
func ConvertToCOS(config *HarvesterConfig) (*yipSchema.YipConfig, error)
ConvertToCOS converts HarvesterConfig to cOS configuration.
func GenerateRancherdConfig ¶ added in v1.2.0
func GenerateRancherdConfig(config *HarvesterConfig) (*yipSchema.YipConfig, error)
func GetSystemSettingsAllowList ¶ added in v1.0.1
func GetSystemSettingsAllowList() []string
refer: https://github.com/harvester/harvester/blob/master/pkg/settings/settings.go
func NewToSlice ¶ added in v0.2.0
func NewTypeConverter ¶ added in v0.2.0
func PrintInstall ¶
func PrintInstall(cfg HarvesterConfig) ([]byte, error)
func RestoreOriginalNetworkConfig ¶ added in v0.2.3
func RestoreOriginalNetworkConfig() error
RestoreOriginalNetworkConfig restores the previous state of network configurations saved by `SaveOriginalNetworkConfig`.
func SaveOriginalNetworkConfig ¶ added in v0.2.3
func SaveOriginalNetworkConfig() error
SaveOriginalNetworkConfig saves the current state of network configurations. Namely - all `/etc/sysconfig/network/ifroute-*` files, and - all `/etc/sysconfig/network/ifcfg-*` files
It can only be invoked once for the whole lifetime of this program.
func UpdateManagementInterfaceConfig ¶ added in v1.1.0
func UpdateManagementInterfaceConfig(stage *yipSchema.Stage, mgmtInterface Network, run bool) (string, error)
UpdateManagementInterfaceConfig updates a cOS config stage to include steps that: - generates wicked interface files (`/etc/sysconfig/network/ifcfg-*` and `ifroute-*`) - manipulates nameservers in `/etc/resolv.conf`. - call `wicked ifreload all` if `run` flag is true.
Types ¶
type ElementalConfig ¶ added in v1.1.2
type ElementalConfig struct {
Install ElementalInstallSpec `yaml:"install,omitempty"`
}
refer: https://github.com/rancher/elemental-cli/blob/v0.1.0/config.yaml.example
func ConvertToElementalConfig ¶ added in v1.1.2
func ConvertToElementalConfig(config *HarvesterConfig) (*ElementalConfig, error)
func CreateRootPartitioningLayout ¶ added in v1.0.1
func CreateRootPartitioningLayout(elementalConfig *ElementalConfig, hvstConfig *HarvesterConfig) (*ElementalConfig, error)
func NewElementalConfig ¶ added in v1.1.2
func NewElementalConfig() *ElementalConfig
type ElementalDefaultPartition ¶ added in v1.1.2
type ElementalDefaultPartition struct { OEM *ElementalPartition `yaml:"oem,omitempty"` State *ElementalPartition `yaml:"state,omitempty"` Recovery *ElementalPartition `yaml:"recovery,omitempty"` Persistent *ElementalPartition `yaml:"persistent,omitempty"` }
type ElementalInstallSpec ¶ added in v1.1.2
type ElementalInstallSpec struct { Target string `yaml:"target,omitempty"` Firmware string `yaml:"firmware,omitempty"` PartTable string `yaml:"part-table,omitempty"` Partitions *ElementalDefaultPartition `yaml:"partitions,omitempty"` ExtraPartitions []ElementalPartition `yaml:"extra-partitions,omitempty"` CloudInit string `yaml:"cloud-init,omitempty"` Tty string `yaml:"tty,omitempty"` System *ElementalSystem `yaml:"system,omitempty"` }
type ElementalPartition ¶ added in v1.1.2
type ElementalSystem ¶ added in v1.2.0
type FuzzyNames ¶ added in v0.2.0
type FuzzyNames struct { mappers.DefaultMapper // contains filtered or unexported fields }
func (*FuzzyNames) ModifySchema ¶ added in v0.2.0
func (*FuzzyNames) ToInternal ¶ added in v0.2.0
func (f *FuzzyNames) ToInternal(data map[string]interface{}) error
type HTTPBasicAuth ¶
type HarvesterChartValues ¶ added in v1.1.3
type HarvesterChartValues struct { StorageClass StorageClass `json:"storageClass,omitempty"` Longhorn LonghornChartValues `json:"longhorn,omitempty"` EnableGoCoverDir bool `json:"enableGoCoverDir,omitempty"` }
type HarvesterConfig ¶
type HarvesterConfig struct { // Harvester will use scheme version to determine current version and migrate config to new scheme version SchemeVersion uint32 `json:"schemeVersion,omitempty"` ServerURL string `json:"serverUrl,omitempty"` Token string `json:"token,omitempty"` OS `json:"os,omitempty"` Install `json:"install,omitempty"` RuntimeVersion string `json:"runtimeVersion,omitempty"` RancherVersion string `json:"rancherVersion,omitempty"` HarvesterChartVersion string `json:"harvesterChartVersion,omitempty"` MonitoringChartVersion string `json:"monitoringChartVersion,omitempty"` SystemSettings map[string]string `json:"systemSettings,omitempty"` LoggingChartVersion string `json:"loggingChartVersion,omitempty"` }
func LoadHarvesterConfig ¶
func LoadHarvesterConfig(yamlBytes []byte) (*HarvesterConfig, error)
func NewHarvesterConfig ¶
func NewHarvesterConfig() *HarvesterConfig
func ReadConfig ¶
func ReadConfig() (HarvesterConfig, error)
ReadConfig constructs a config by reading various sources
func ReadUserDataConfig ¶ added in v1.2.0
func ReadUserDataConfig() (HarvesterConfig, error)
ReadUserDataConfig constructs a config from userdata
func (*HarvesterConfig) DeepCopy ¶ added in v0.2.0
func (c *HarvesterConfig) DeepCopy() (*HarvesterConfig, error)
func (*HarvesterConfig) GetKubeletArgs ¶ added in v0.2.6
func (c *HarvesterConfig) GetKubeletArgs() ([]string, error)
func (*HarvesterConfig) Merge ¶ added in v1.0.1
func (c *HarvesterConfig) Merge(other HarvesterConfig) error
func (HarvesterConfig) ShouldCreateDataPartitionOnOsDisk ¶ added in v1.0.1
func (c HarvesterConfig) ShouldCreateDataPartitionOnOsDisk() bool
func (HarvesterConfig) ShouldMountDataPartition ¶ added in v1.0.1
func (c HarvesterConfig) ShouldMountDataPartition() bool
func (*HarvesterConfig) String ¶
func (c *HarvesterConfig) String() string
func (*HarvesterConfig) ToCosInstallEnv ¶ added in v0.2.0
func (c *HarvesterConfig) ToCosInstallEnv() ([]string, error)
type Install ¶
type Install struct { Automatic bool `json:"automatic,omitempty"` SkipChecks bool `json:"skipchecks,omitempty"` Mode string `json:"mode,omitempty"` ManagementInterface Network `json:"managementInterface,omitempty"` Vip string `json:"vip,omitempty"` VipHwAddr string `json:"vipHwAddr,omitempty"` VipMode string `json:"vipMode,omitempty"` ForceEFI bool `json:"forceEfi,omitempty"` Device string `json:"device,omitempty"` ConfigURL string `json:"configUrl,omitempty"` Silent bool `json:"silent,omitempty"` ISOURL string `json:"isoUrl,omitempty"` PowerOff bool `json:"powerOff,omitempty"` NoFormat bool `json:"noFormat,omitempty"` Debug bool `json:"debug,omitempty"` TTY string `json:"tty,omitempty"` ForceGPT bool `json:"forceGpt,omitempty"` Role string `json:"role,omitempty"` WithNetImages bool `json:"withNetImages,omitempty"` WipeDisks bool `json:"wipeDisks,omitempty"` // Following options are not cOS installer flag ForceMBR bool `json:"forceMbr,omitempty"` DataDisk string `json:"dataDisk,omitempty"` Webhooks []Webhook `json:"webhooks,omitempty"` Addons map[string]Addon `json:"addons,omitempty"` Harvester HarvesterChartValues `json:"harvester,omitempty"` RawDiskImagePath string `json:"rawDiskImagePath,omitempty"` PersistentPartitionSize string `json:"persistentPartitionSize,omitempty"` }
type LHDefaultSettings ¶ added in v1.2.0
type LonghornChartValues ¶ added in v1.2.0
type LonghornChartValues struct {
DefaultSettings LHDefaultSettings `json:"defaultSettings,omitempty"`
}
type NTPSettings ¶ added in v1.2.0
type NTPSettings struct {
NTPServers []string `json:"ntpServers,omitempty"`
}
type Network ¶
type Network struct { Interfaces []NetworkInterface `json:"interfaces,omitempty"` Method string `json:"method,omitempty"` IP string `json:"ip,omitempty"` SubnetMask string `json:"subnetMask,omitempty"` Gateway string `json:"gateway,omitempty"` DefaultRoute bool `json:"-"` BondOptions map[string]string `json:"bondOptions,omitempty"` MTU int `json:"mtu,omitempty"` VlanID int `json:"vlanId,omitempty"` }
type NetworkInterface ¶ added in v0.2.3
type NetworkInterface struct { Name string `json:"name,omitempty"` HwAddr string `json:"hwAddr,omitempty"` }
func (*NetworkInterface) FindNetworkInterfaceHwAddr ¶ added in v1.1.0
func (n *NetworkInterface) FindNetworkInterfaceHwAddr() error
FindNetworkInterfaceHwAddr uses device name to lookup hardware address
func (*NetworkInterface) FindNetworkInterfaceName ¶ added in v0.2.8
func (n *NetworkInterface) FindNetworkInterfaceName() error
FindNetworkInterfaceName uses MAC address to lookup interface name
func (*NetworkInterface) FindNetworkInterfaceNameAndHwAddr ¶ added in v1.1.0
func (n *NetworkInterface) FindNetworkInterfaceNameAndHwAddr() error
type OS ¶
type OS struct { AfterInstallChrootCommands []string `json:"afterInstallChrootCommands,omitempty"` SSHAuthorizedKeys []string `json:"sshAuthorizedKeys,omitempty"` WriteFiles []File `json:"writeFiles,omitempty"` Hostname string `json:"hostname,omitempty"` Modules []string `json:"modules,omitempty"` Sysctls map[string]string `json:"sysctls,omitempty"` NTPServers []string `json:"ntpServers,omitempty"` DNSNameservers []string `json:"dnsNameservers,omitempty"` Wifi []Wifi `json:"wifi,omitempty"` Password string `json:"password,omitempty"` Environment map[string]string `json:"environment,omitempty"` Labels map[string]string `json:"labels,omitempty"` SSHD SSHDConfig `json:"sshd,omitempty"` PersistentStatePaths []string `json:"persistentStatePaths,omitempty"` }
type SSHDConfig ¶ added in v1.2.2
type SSHDConfig struct {
SFTP bool `json:"sftp,omitempty"`
}
SSHDConfig is the SSHD configuration for the node
- SFTP: the switch to enable/disable SFTP
type StorageClass ¶ added in v1.2.0
type StorageClass struct { // 0 is invalid, will be omitted ReplicaCount uint32 `json:"replicaCount,omitempty"` }
type Webhook ¶
type Webhook struct { Event string `json:"event,omitempty"` Method string `json:"method,omitempty"` Headers map[string][]string `json:"headers,omitempty"` URL string `json:"url,omitempty"` Payload string `json:"payload,omitempty"` Insecure bool `json:"insecure,omitempty"` BasicAuth HTTPBasicAuth `json:"basicAuth,omitempty"` }