config

package
v3.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: BSD-3-Clause Imports: 32 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LatestTalosVersion = "v1.8.0"

renovate: depName=siderolabs/talos datasource=github-releases

View Source
var OfficialExtensions = generateExtensionSchema(schemaFile)

Functions

func FromFile added in v3.0.3

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

FromFile is a wrapper for `os.ReadFile` with modified error if path doesn't exist.

func ValidateFromByte

func ValidateFromByte(source []byte) (Errors, Warnings, error)

func ValidateFromFile

func ValidateFromFile(path string) (Errors, Warnings, error)

Types

type Error

type Error struct {
	Kind    string
	Field   string
	Message error
}

type Errors

type Errors []*Error

func (*Errors) Append

func (errs *Errors) Append(err *Error) *Errors

func (Errors) HasField

func (errs Errors) HasField(field string) bool

type ExtensionService

type ExtensionService struct {
	Name        string                    `yaml:"name" jsonschema:"description=Name of the extension service config"`
	ConfigFiles extensions.ConfigFileList `yaml:"configFiles,omitempty" jsonschema:"description=The config files for the extension service"`
	Environment []string                  `yaml:"environment,omitempty" jsonschema:"description=The environment for the extension service"`
}

type ImageFactory

type ImageFactory struct {
	RegistryURL       string `yaml:"registryURL,omitempty" jsonschema:"default=factory.talos.dev,description=Registry url or the image"`
	SchematicEndpoint string `` /* 126-byte string literal not displayed */
	Protocol          string `yaml:"protocol,omitempty" jsonschema:"default=https,description=Protocol of the registry(https or http)"`
	InstallerURLTmpl  string `` /* 183-byte string literal not displayed */
	ISOURLTmpl        string `` /* 260-byte string literal not displayed */
}

type IngressConfigWrapper

type IngressConfigWrapper struct {
	Subnet string `yaml:"subnet" jsonschema:"description=Source subnet"`
	Except string `yaml:"except" jsonschema:"description=Source subnet to exclude from the subnet"`
}

type IngressFirewall

type IngressFirewall struct {
	DefaultAction nethelpers.DefaultAction `` /* 126-byte string literal not displayed */
	NetworkRules  []NetworkRule            `yaml:"rules,omitempty" jsonschema:"description=List of matching network rules to allow or block against the defaultAction"`
}

func (IngressFirewall) JSONSchemaAlias

func (IngressFirewall) JSONSchemaAlias() any

type IngressFirewallWrapper

type IngressFirewallWrapper struct {
	DefaultAction string               `yaml:"defaultAction" jsonschema:"default=block,description=Default action for all not explicitly configured traffic"`
	NetworkRules  []NetworkRuleWrapper `yaml:"rules" jsonschema:"description=List of matching network rules to allow or block against the defaultAction"`
}

type InstallDiskSelectorWrapper

type InstallDiskSelectorWrapper struct {
	Size     string `yaml:"size" jsonschema:"description=Disk size,example=4GB"`
	Name     string `yaml:"name" jsonschema:"Disk name"`
	Model    string `yaml:"model" jsonschema:"Disk model"`
	Serial   string `yaml:"serial" jsonschema:"Disk serial number"`
	Modalias string `yaml:"modalias" jsonschema:"Disk modalias"`
	UUID     string `yaml:"uuid" jsonschema:"Disk UUID"`
	WWID     string `yaml:"wwid" jsonschema:"Disk WWID"`
	Type     string `yaml:"type" jsonschema:"Disk type,example=ssd"`
	BusPath  string `yaml:"busPath" jsonschema:"Disk bus path"`
}

type MachineSpec

type MachineSpec struct {
	Mode       string `yaml:"mode,omitempty" jsonschema:"default=metal,description=Machine mode (e.g: metal)"`
	Arch       string `yaml:"arch,omitempty" jsonschema:"default=amd64,description=Machine architecture (e.g: amd64, arm64)"`
	Secureboot bool   `yaml:"secureboot,omitempty" jsonschema:"default=false,description=Whether to enable Secure Boot"`
	UseUKI     bool   `yaml:"useUKI,omitempty" jsonschema:"default=false,description=Whether to use UKI if Secure Boot is enabled"`
}

type NetworkRule

type NetworkRule struct {
	Name         string                   `yaml:"name" jsonschema:"description=Name of the rule"`
	PortSelector network.RulePortSelector `yaml:"portSelector" jsonschema:"description=Ports and protocols on the host affected by the rule"`
	Ingress      network.IngressConfig    `yaml:"ingress" jsonschema:"description=List of source subnets allowed to access the host ports/protocols"`
}

type NetworkRuleWrapper

type NetworkRuleWrapper struct {
	Name         string                 `yaml:"name" jsonschema:"description=Name of the rule"`
	PortSelector PortSelectorWrapper    `yaml:"portSelector" jsonschema:"description=Ports and protocols on the host affected by the rule"`
	Ingress      []IngressConfigWrapper `yaml:"ingress" jsonschema:"description=List of source subnets allowed to access the host ports/protocols"`
}

type Node

type Node struct {
	Hostname               string                        `yaml:"hostname" jsonschema:"required,description=Hostname of the node"`
	IPAddress              string                        `` /* 168-byte string literal not displayed */
	ControlPlane           bool                          `yaml:"controlPlane" jsonschema:"description=Whether the node is a controlplane"`
	InstallDisk            string                        `yaml:"installDisk,omitempty" jsonschema:"oneof_required=installDiskSelector,description=The disk used for installation"`
	InstallDiskSelector    *v1alpha1.InstallDiskSelector `yaml:"installDiskSelector,omitempty" jsonschema:"oneof_required=installDisk,description=Look up disk used for installation"`
	IgnoreHostname         bool                          `yaml:"ignoreHostname" jsonschema:"description=Whether to set \"machine.network.hostname\" to the generated config file"`
	OverridePatches        bool                          `` /* 136-byte string literal not displayed */
	OverrideExtraManifests bool                          `` /* 150-byte string literal not displayed */
	NodeConfigs            `yaml:",inline" jsonschema:"description=Node specific configurations that will override node group configurations"`
}

func (*Node) ContainsIP

func (n *Node) ContainsIP(ip string) bool

ContainsIP returns true if `n.IPAddress` contains `ip`

func (*Node) GetIPAddresses

func (n *Node) GetIPAddresses() []string

GetIPAddresses returns list of IPaddresses

func (*Node) GetMachineSpec

func (n *Node) GetMachineSpec() *MachineSpec

GetMachineSpec returns default `MachineSpec` for `Node` if not specified.

func (Node) JSONSchemaProperty

func (Node) JSONSchemaProperty(prop string) any

func (*Node) OverrideGlobalCfg

func (node *Node) OverrideGlobalCfg(cfg NodeConfigs) *Node

type NodeConfigs

type NodeConfigs struct {
	NodeLabels          map[string]string              `yaml:"nodeLabels" jsonschema:"description=Labels to be added to the node"`
	NodeAnnotations     map[string]string              `yaml:"nodeAnnotations" jsonschema:"description=Annotations to be added to the node"`
	NodeTaints          map[string]string              `yaml:"nodeTaints" jsonschema:"description=Node taints for the node. Effect is optional"`
	MachineDisks        []*v1alpha1.MachineDisk        `yaml:"machineDisks,omitempty" jsonschema:"description=List of additional disks to partition, format, mount"`
	MachineFiles        []*v1alpha1.MachineFile        `yaml:"machineFiles,omitempty" jsonschema:"description=List of files to create inside the node"`
	DisableSearchDomain bool                           `yaml:"disableSearchDomain,omitempty" jsonschema:"description=Whether to disable generating default search domain"`
	KernelModules       []*v1alpha1.KernelModuleConfig `yaml:"kernelModules,omitempty" jsonschema:"description=List of additional kernel modules to load inside the node"`
	Nameservers         []string                       `yaml:"nameservers,omitempty" jsonschema:"description=List of nameservers for the node"`
	NetworkInterfaces   []*v1alpha1.Device             `yaml:"networkInterfaces,omitempty" jsonschema:"description=List of network interface configuration for the node"`
	ExtraManifests      []string                       `yaml:"extraManifests,omitempty" jsonschema:"description=List of manifest files to be added to the node"`
	Patches             []string                       `yaml:"patches,omitempty" jsonschema:"description=Patches to be applied to the node"`
	TalosImageURL       string                         `` /* 185-byte string literal not displayed */
	NoSchematicValidate bool                           `yaml:"noSchematicValidate" jsonschema:"description=Whether to skip schematic validation"`
	Schematic           *schematic.Schematic           `yaml:"schematic,omitempty" jsonschema:"description=Talos image customization to be used in the installer image"`
	MachineSpec         MachineSpec                    `yaml:"machineSpec,omitempty" jsonschema:"description=Machine hardware specification"`
	IngressFirewall     *IngressFirewall               `yaml:"ingressFirewall,omitempty" jsonschema:"description=Machine firewall specification"`
	ExtensionServices   []*ExtensionService            `yaml:"extensionServices,omitempty" jsonschema:"description=Machine extension services specification"`
}

type PortSelectorWrapper

type PortSelectorWrapper struct {
	Ports    []any  `yaml:"ports" jsonschema:"description=List of ports or port ranges"`
	Protocol string `yaml:"protocol" jsonschema:"description=Protocol (can be tcp or udp)"`
}

type TalhelperConfig

type TalhelperConfig struct {
	ClusterName                    string              `yaml:"clusterName" jsonschema:"required,description=Name of the cluster"`
	TalosVersion                   string              `yaml:"talosVersion,omitempty" jsonschema:"example=v1.5.4,description=Talos version to perform installation"`
	KubernetesVersion              string              `yaml:"kubernetesVersion,omitempty" jsonschema:"example=v1.27.0,description=Kubernetes version to use"`
	Endpoint                       string              `yaml:"endpoint" jsonschema:"required,example=https://192.168.200.10:6443,description=Cluster's controlplane endpoint"`
	Domain                         string              `yaml:"domain,omitempty" jsonschema:"example=cluster.local,description=The domain to be used by Kubernetes DNS"`
	AllowSchedulingOnMasters       bool                `yaml:"allowSchedulingOnMasters,omitempty" jsonschema:"description=Whether to allow running workload on controlplane nodes"`
	AllowSchedulingOnControlPlanes bool                `` /* 176-byte string literal not displayed */
	AdditionalMachineCertSans      []string            `yaml:"additionalMachineCertSans,omitempty" jsonschema:"description=Extra certificate SANs for the machine's certificate"`
	AdditionalApiServerCertSans    []string            `yaml:"additionalApiServerCertSans,omitempty" jsonschema:"description=Extra certificate SANs for the API server's certificate"`
	ClusterPodNets                 []string            `yaml:"clusterPodNets,omitempty" jsonschema:"description=The pod subnet CIDR list"`
	ClusterSvcNets                 []string            `yaml:"clusterSvcNets,omitempty" jsonschema:"description=The service subnet CIDR list"`
	CNIConfig                      *v1alpha1.CNIConfig `yaml:"cniConfig,omitempty" jsonschema:"description=The CNI to be used for the cluster's network"`
	Patches                        []string            `yaml:"patches,omitempty" jsonschema:"description=Patches to be applied to all nodes"`
	Nodes                          []Node              `yaml:"nodes" jsonschema:"required,description=List of configurations for Node"`
	ImageFactory                   ImageFactory        `yaml:"imageFactory,omitempty" jsonschema:"Configuration for image factory"`
	ControlPlane                   NodeConfigs         `yaml:"controlPlane,omitempty" jsonschema:"description=Configurations targetted for all controlplane nodes"`
	Worker                         NodeConfigs         `yaml:"worker,omitempty" jsonschema:"description=Configurations targetted for all worker nodes"`
}

func LoadAndValidateFromFile

func LoadAndValidateFromFile(filePath string, envPaths []string, showWarns bool) (*TalhelperConfig, error)

LoadAndValidateFromFile takes a file path and yaml encoded env files path, do envsubst from envPaths. The resulted TalhelperConfig will be validated before being returned. It returns an error, if any.

func NewFromByte

func NewFromByte(source []byte) (*TalhelperConfig, error)

NewFromByte takes bytes and convert it into Talhelper config. It also returns an error, if any.

func NewFromFile

func NewFromFile(path string) (c *TalhelperConfig, err error)

NewFromFile takes a file path and convert the contents into Talhelper config. It also returns an error, if any.

func (*TalhelperConfig) ApplyInlinePatch

func (c *TalhelperConfig) ApplyInlinePatch(patch []byte) ([]byte, error)

func (*TalhelperConfig) Encode

func (c *TalhelperConfig) Encode(cfg []byte) ([]byte, error)

Encode encodes Talhelper config into yaml bytes. It also returns an error, if any.

func (*TalhelperConfig) GenerateGitignore

func (config *TalhelperConfig) GenerateGitignore(outputDir string) error

GenerateGitignore generates `.gitignore` file in the specified path. It returns an error, if any.

func (*TalhelperConfig) GetClusterPodNets

func (c *TalhelperConfig) GetClusterPodNets() []string

GetClusterPodNets returns `ClusterPodNets` strings.

func (*TalhelperConfig) GetClusterSvcNets

func (c *TalhelperConfig) GetClusterSvcNets() []string

GetClusterSvcNets returns `ClusterSvcNets` strings.

func (*TalhelperConfig) GetImageFactory

func (c *TalhelperConfig) GetImageFactory() *ImageFactory

GetImageFactory returns default `imageFactory` if not specified.

func (*TalhelperConfig) GetK8sVersion

func (c *TalhelperConfig) GetK8sVersion() string

GetK8sVersion returns Kubernetes version string without `v` prefix.

func (*TalhelperConfig) GetTalosVersion

func (c *TalhelperConfig) GetTalosVersion() string

GetTalosVersion returns Talos version string prefixed with `v`.

func (TalhelperConfig) Validate

func (c TalhelperConfig) Validate() (Errors, Warnings)

Validate returns `Errors` and `Warnings` if the given `TalhelperConfig` is not correct

type Warning

type Warning struct {
	Kind    string
	Field   string
	Message string
}

type Warnings

type Warnings []*Warning

func (*Warnings) Append

func (warns *Warnings) Append(warn *Warning) *Warnings

func (Warnings) HasField

func (warns Warnings) HasField(field string) bool

Directories

Path Synopsis
schemas

Jump to

Keyboard shortcuts

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