config

package
v0.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K3sConfigDir    = "/etc/rancher/k3s/config.yaml.d"
	K3sManifestPath = "/var/lib/rancher/k3s/server/manifests/"

	InitramfsStage          = "initramfs"
	RootfsStage             = "rootfs"
	NetworkBeforeStage      = "network.before"
	NetworkAfterStage       = "network.after"
	AfterInstallChrootStage = "after-install-chroot"
)

Variables

This section is empty.

Functions

func AddStageAfterInstallChroot

func AddStageAfterInstallChroot(llmosCfg string, cfg *Config) (*yipSchema.Stage, error)

func ConvertToCosStages

func ConvertToCosStages(cfg *Config, afterInstall yipSchema.Stage) (*yipSchema.YipConfig, error)

ConvertToCosStages converts Config into the cOS stage configurations

func EncodeToMap

func EncodeToMap(obj interface{}) (map[string]interface{}, error)

func GetLocalLLMOSConfig

func GetLocalLLMOSConfig(path string) ([]byte, error)

func GetRemoteLLMOSConfig

func GetRemoteLLMOSConfig(url string) ([]byte, error)

func Render

func Render(template string, context interface{}) (*bytes.Buffer, error)

Render renders a templates in the package `templates` folder. The templates files are embedded in build-time.

func RenderTemplate

func RenderTemplate(tpl string, context interface{}) (*bytes.Buffer, error)

func ToEnv

func ToEnv(prefix string, obj interface{}) ([]string, error)

func ToYAMLKey

func ToYAMLKey(str string) string

Types

type Config

type Config struct {
	// +optional, specify llmos os configurations
	OS LLMOS `json:"os,omitempty" yaml:"os,omitempty"`
	// +optional, specify llmos install configurations
	Install Install `json:"install,omitempty" yaml:"install,omitempty"`
	// +optional, specify llmos config file location (file path or http URL)
	ConfigURL string `json:"config-url,omitempty" yaml:"config-url,omitempty"`
	// +optional, specify the configuration version
	Version string `json:"version" yaml:"version"`
	// +optional, specify if the configuration is for debug purposes
	Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"`
}

func LoadLLMOSConfig

func LoadLLMOSConfig(yamlBytes []byte) (*Config, error)

func NewLLMOSConfig

func NewLLMOSConfig() *Config

func ReadLLMOSConfigFile

func ReadLLMOSConfigFile(file string) (*Config, error)

func (*Config) DeepCopy

func (c *Config) DeepCopy() (*Config, error)

func (*Config) GetK3sDisabledComponents

func (c *Config) GetK3sDisabledComponents() []string

func (*Config) GetK3sNodeExternalIP

func (c *Config) GetK3sNodeExternalIP() string

func (*Config) GetK3sNodeLabels

func (c *Config) GetK3sNodeLabels() []string

func (*Config) HasDataPartition

func (c *Config) HasDataPartition() bool

func (*Config) Merge

func (c *Config) Merge(cfg *Config) error

func (*Config) ToCosInstallEnv

func (c *Config) ToCosInstallEnv() ([]string, error)

type File

type File struct {
	Encoding           string `json:"encoding" yaml:"encoding"`
	Content            string `json:"content" yaml:"content"`
	Owner              string `json:"owner" yaml:"owner"`
	Path               string `json:"path" yaml:"path"`
	RawFilePermissions string `json:"permissions" yaml:"permissions"`
}

type Install

type Install struct {
	Device     string   `json:"device" yaml:"device" binding:"required"`
	Silent     bool     `json:"silent,omitempty" yaml:"silent,omitempty"`
	ISOUrl     string   `json:"iso,omitempty" yaml:"iso,omitempty"`
	SystemURI  string   `json:"system-uri,omitempty" yaml:"system-uri,omitempty"`
	PowerOff   bool     `json:"poweroff,omitempty" yaml:"poweroff,omitempty"`
	Debug      bool     `json:"debug,omitempty" yaml:"debug,omitempty"`
	TTY        string   `json:"tty,omitempty" yaml:"tty,omitempty"`
	DataDevice string   `json:"data-device,omitempty" yaml:"data-device,omitempty"`
	Env        []string `json:"env,omitempty" yaml:"env,omitempty"`
	Reboot     bool     `json:"reboot,omitempty" yaml:"reboot,omitempty"`
	ConfigDir  string   `json:"config-dir,omitempty" yaml:"config-dir,omitempty"`
}

func (*Install) DeepCopy

func (i *Install) DeepCopy() (*Install, error)

type K3SConfig

type K3SConfig struct {
	Token          string   `json:"token,omitempty" yaml:"token,omitempty"`
	NodeExternalIP string   `json:"node-external-ip,omitempty" yaml:"node-external-ip,omitempty"`
	NodeLabel      []string `json:"node-label,omitempty" yaml:"node-label,omitempty"`
}

type LLMOS

type LLMOS struct {
	SSHAuthorizedKeys    []string          `json:"ssh-authorized-keys,omitempty" yaml:"ssh-authorized-keys,omitempty"`
	WriteFiles           []File            `json:"write-files,omitempty" yaml:"write-files,omitempty"`
	Hostname             string            `json:"hostname,omitempty" yaml:"hostname,omitempty"`
	Modules              []string          `json:"modules,omitempty" yaml:"modules,omitempty"`
	Sysctl               map[string]string `json:"sysctl,omitempty" yaml:"sysctl,omitempty"`
	Username             string            `json:"username,omitempty" yaml:"username,omitempty"`
	Password             string            `json:"password,omitempty" yaml:"password,omitempty"`
	NTPServers           []string          `json:"ntp-servers,omitempty" yaml:"ntp-servers,omitempty"`
	DNSNameservers       []string          `json:"dns-nameservers,omitempty" yaml:"dns-nameservers,omitempty"`
	Environment          map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"`
	Labels               map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	PersistentStatePaths []string          `json:"persistent-state-paths,omitempty" yaml:"persistent-state-paths,omitempty"`
	K3SConfig            `json:",inline,omitempty" yaml:",inline,omitempty"`
}

func (*LLMOS) DeepCopy

func (l *LLMOS) DeepCopy() (*LLMOS, error)

type Upgrade

type Upgrade struct {
	Source          string `json:"source,omitempty" yaml:"source,omitempty"`
	UpgradeRecovery bool   `json:"upgrade-recovery,omitempty" yaml:"upgrade-recovery,omitempty"`
	HostDir         string `json:"host-dir,omitempty" yaml:"host-dir,omitempty"`
	Debug           bool   `json:"debug,omitempty" yaml:"debug,omitempty"`
	Force           bool   `json:"force,omitempty" yaml:"force,omitempty"`
	Dev             bool   `json:"dev,omitempty" yaml:"dev,omitempty"`
}

Jump to

Keyboard shortcuts

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