Documentation
¶
Overview ¶
Package models provides cluster template models (for each sub-document of multi-doc YAML).
Index ¶
Constants ¶
const KindCluster = "Cluster"
KindCluster is Cluster model kind.
const KindControlPlane = "ControlPlane"
KindControlPlane is ControlPlane model kind.
const KindMachine = "Machine"
KindMachine is a Machine model kind.
const KindWorkers = "Workers"
KindWorkers is Workers model kind.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
Meta `yaml:",inline"`
// Name is the name of the cluster.
Name string `yaml:"name"`
// Labels are the user labels to apply to the cluster.
Labels map[string]string `yaml:"labels"`
// Kubernetes settings.
Kubernetes KubernetesCluster `yaml:"kubernetes"`
// Talos settings.
Talos TalosCluster `yaml:"talos"`
// Cluster-wide patches.
Patches PatchList `yaml:"patches"`
}
Cluster is a top-level template object.
type ControlPlane ¶
type ControlPlane struct {
MachineSet `yaml:",inline"`
}
ControlPlane describes Cluster controlplane nodes.
func (*ControlPlane) Translate ¶
func (controlplane *ControlPlane) Translate(ctx TranslateContext) ([]resource.Resource, error)
Translate the model.
func (*ControlPlane) Validate ¶
func (controlplane *ControlPlane) Validate() error
Validate the model.
type KubernetesCluster ¶
type KubernetesCluster struct {
// Version is the Kubernetes version.
Version string `yaml:"version"`
}
KubernetesCluster is a Kubernetes cluster settings.
func (*KubernetesCluster) Validate ¶
func (kubernetes *KubernetesCluster) Validate() error
Validate the model.
type List ¶
type List []Model
List implements a list of models, essentially it's a template.
func (List) ClusterName ¶
ClusterName retruns the name of the cluster in the template.
type Machine ¶
type Machine struct {
Meta `yaml:",inline"`
// Machine name (ID).
Name MachineID `yaml:"name"`
// Install specification.
Install MachineInstall `yaml:"install"`
// ClusterMachine patches.
Patches PatchList `yaml:"patches"`
}
Machine provides customization for a specific machine.
type MachineIDList ¶
type MachineIDList []MachineID
MachineIDList is a list of Machine UUIDs.
func (MachineIDList) Validate ¶
func (l MachineIDList) Validate() error
Validate the list of machines.
type MachineInstall ¶
type MachineInstall struct {
// Disk device name.
Disk string `yaml:"disk"`
}
MachineInstall provides machine install configuration.
func (*MachineInstall) Validate ¶
func (install *MachineInstall) Validate() error
Validate the model.
type MachineSet ¶
type MachineSet struct {
Meta `yaml:",inline"`
// ControlPlane machines.
Machines MachineIDList `yaml:"machines"`
// Controlplane patches.
Patches PatchList `yaml:"patches"`
}
MachineSet is a base model for controlplane and workers.
type Meta ¶
type Meta struct {
Kind string `yaml:"kind"`
}
Meta is embedded into all template objects.
type Model ¶
type Model interface {
Validate() error
Translate(TranslateContext) ([]resource.Resource, error)
}
Model is a base interface for cluster templates.
type Patch ¶
type Patch struct {
// Name of the patch.
//
// Optional for 'path' patches, mandatory for 'inline' patches.
Name string `yaml:"name"`
// File path to the file containing the patch.
//
// Mutually exclusive with `inline:`.
File string `yaml:"file"`
// Inline patch content.
Inline map[string]any `yaml:"inline"`
}
Patch is a Talos machine configuration patch.
type PatchList ¶
type PatchList []Patch
PatchList is a list of patches.
type TalosCluster ¶
type TalosCluster struct {
// Version is the Talos version.
Version string `yaml:"version"`
}
TalosCluster is a Talos cluster settings.
type TranslateContext ¶
type TranslateContext struct {
// ClusterName is the name of the cluster.
ClusterName string
}
TranslateContext is a context for translation.
type Workers ¶
type Workers struct {
MachineSet `yaml:",inline"`
}
Workers describes Cluster worker nodes.