Documentation
¶
Overview ¶
Package models provides cluster template models (for each sub-document of multi-doc YAML).
Index ¶
- Constants
- type BackupConfiguration
- type BootstrapSpec
- type Cluster
- type ControlPlane
- type Descriptors
- type Features
- type KernelArgs
- type KubernetesCluster
- type List
- type Machine
- type MachineClassConfig
- type MachineID
- type MachineIDList
- type MachineInstall
- type MachineSet
- type Meta
- type Model
- type Patch
- type PatchList
- type RollingUpdateStrategyConfig
- type Size
- type SystemExtensions
- type TalosCluster
- type TranslateContext
- type UpdateStrategyConfig
- type UpdateStrategyType
- type Workers
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 BackupConfiguration ¶
type BackupConfiguration struct {
// Interval configures intervals between backups. If set to 0, etcd backups for this cluster are disabled.
Interval time.Duration `yaml:"interval,omitempty"`
}
BackupConfiguration contains backup configuration settings.
type BootstrapSpec ¶
type BootstrapSpec struct {
// ClusterUUID defines the UUID of the cluster to restore from.
ClusterUUID string `yaml:"clusterUUID"`
// Snapshot defines the snapshot file name to restore from.
Snapshot string `yaml:"snapshot"`
}
BootstrapSpec defines the model for setting the bootstrap specification, i.e. restoring from a backup, in the machine set. Only valid for the control plane machine set.
type Cluster ¶
type Cluster struct {
Meta `yaml:",inline"`
SystemExtensions `yaml:",inline"`
// Name is the name of the cluster.
Name string `yaml:"name"`
// Descriptors are the user descriptors to apply to the cluster.
Descriptors Descriptors `yaml:",inline"`
// Kubernetes settings.
Kubernetes KubernetesCluster `yaml:"kubernetes"`
// Talos settings.
Talos TalosCluster `yaml:"talos"`
// Features settings.
Features Features `yaml:"features,omitempty"`
// Cluster-wide patches.
Patches PatchList `yaml:"patches,omitempty"`
// KernelArgs are the additional kernel arguments.
KernelArgs KernelArgs `yaml:",inline"`
}
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 Descriptors ¶
type Descriptors struct {
// Labels are the user labels to apply to the resource.
Labels map[string]string `yaml:"labels,omitempty"`
// Annotations are the user annotations to apply to the resource.
Annotations map[string]string `yaml:"annotations,omitempty"`
}
Descriptors are the user descriptors (i.e. Labels, Annotations) to apply to the resource.
func (*Descriptors) Apply ¶
func (d *Descriptors) Apply(res resource.Resource)
Apply applies the descriptors to the given resource.
func (*Descriptors) Validate ¶
func (d *Descriptors) Validate() error
Validate validates the descriptors.
type Features ¶
type Features struct {
// DiskEncryption enables KMS encryption.
DiskEncryption bool `yaml:"diskEncryption,omitempty"`
// EnableWorkloadProxy enables workload proxy.
EnableWorkloadProxy bool `yaml:"enableWorkloadProxy,omitempty"`
// UseEmbeddedDiscoveryService enables the use of embedded discovery service.
UseEmbeddedDiscoveryService bool `yaml:"useEmbeddedDiscoveryService,omitempty"`
// BackupConfiguration contains backup configuration settings.
BackupConfiguration BackupConfiguration `yaml:"backupConfiguration,omitempty"`
}
Features defines cluster-wide features.
type KernelArgs ¶ added in v1.5.0
type KernelArgs struct {
Value *[]string `yaml:"kernelArgs,omitempty"`
}
KernelArgs is a wrapper type for the kernel args, which can be specified at a Cluster, MachineSet, or Machine level in cluster templates.
This type needs to be included in the models as an inline YAML, e.g., via `yaml:",inline"`.
func (*KernelArgs) Get ¶ added in v1.5.0
func (ka *KernelArgs) Get() (args []string, defined bool)
Get returns the kernel args value and whether they are actually defined.
func (*KernelArgs) Set ¶ added in v1.5.0
func (ka *KernelArgs) Set(args []string)
Set sets the kernel args value.
type KubernetesCluster ¶
type KubernetesCluster struct {
// Version is the Kubernetes version.
Version string `yaml:"version"`
}
KubernetesCluster is a Kubernetes cluster settings.
type List ¶
type List []Model
List implements a list of models, essentially it's a template.
func (List) ClusterName ¶
ClusterName returns the name of the cluster in the template.
type Machine ¶
type Machine struct {
Meta `yaml:",inline"`
SystemExtensions `yaml:",inline"`
// Machine name (ID).
Name MachineID `yaml:"name"`
// Descriptors are the user descriptors to apply to the cluster.
Descriptors Descriptors `yaml:",inline"`
// Locked locks the machine, so no config updates, upgrades and downgrades will be performed on the machine.
Locked bool `yaml:"locked,omitempty"`
// Install specification.
Install MachineInstall `yaml:"install,omitempty"`
// ClusterMachine patches.
Patches PatchList `yaml:"patches,omitempty"`
// KernelArgs are the additional kernel arguments.
KernelArgs KernelArgs `yaml:",inline"`
}
Machine provides customization for a specific machine.
type MachineClassConfig ¶
type MachineClassConfig struct {
// Name defines used machine class name.
Name string `yaml:"name"`
// Size sets the number of machines to be pulled from the machine class.
Size Size `yaml:"size"`
}
MachineClassConfig defines the model for setting the machine class based machine selector in the machine set.
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"`
SystemExtensions `yaml:",inline"`
// Name is the name of the machine set. When empty, the default name will be used.
Name string `yaml:"name,omitempty"`
// Descriptors are the user descriptors to apply to the cluster.
Descriptors Descriptors `yaml:",inline"`
BootstrapSpec *BootstrapSpec `yaml:"bootstrapSpec,omitempty"`
// MachineSet machines.
Machines MachineIDList `yaml:"machines,omitempty"`
MachineClass *MachineClassConfig `yaml:"machineClass,omitempty"`
// UpdateStrategy defines the update strategy for the machine set.
UpdateStrategy *UpdateStrategyConfig `yaml:"updateStrategy,omitempty"`
// DeleteStrategy defines the delete strategy for the machine set.
DeleteStrategy *UpdateStrategyConfig `yaml:"deleteStrategy,omitempty"`
// MachineSet patches.
Patches PatchList `yaml:"patches,omitempty"`
// KernelArgs are the additional kernel arguments.
KernelArgs KernelArgs `yaml:",inline"`
}
MachineSet is a base model for controlplane and workers.
func (*MachineSet) Validate ¶
func (machineset *MachineSet) Validate() error
Validate checks the machine set fields correctness.
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 if idOverride is not set.
Name string `yaml:"name,omitempty"`
// IDOverride overrides the ID of the patch. When set, the ID will not be generated using the name and/or the file path.
IDOverride string `yaml:"idOverride,omitempty"`
// Descriptors are the user descriptors to apply to the resource.
Descriptors Descriptors `yaml:",inline"`
// File path to the file containing the patch.
//
// Mutually exclusive with `inline:`.
File string `yaml:"file,omitempty"`
// Inline patch content.
Inline map[string]any `yaml:"inline,omitempty"`
}
Patch is a Talos machine configuration patch.
type PatchList ¶
type PatchList []Patch
PatchList is a list of patches.
type RollingUpdateStrategyConfig ¶
type RollingUpdateStrategyConfig struct {
MaxParallelism uint32 `yaml:"maxParallelism,omitempty"`
}
RollingUpdateStrategyConfig defines the model for setting the rolling update strategy in the machine set.
type Size ¶
type Size struct {
Value uint32
AllocationType specs.MachineSetSpec_MachineAllocation_Type
}
Size extends protobuf generated allocation type enum to parse string constants.
func (Size) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
type SystemExtensions ¶ added in v0.33.1
type SystemExtensions struct {
SystemExtensions []string `yaml:"systemExtensions,omitempty"`
}
SystemExtensions is embedded in Cluster, MachineSet and Machine objects.
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 {
LockedMachines map[MachineID]struct{}
MachineDescriptors map[MachineID]Descriptors
MachineSetLevelKernelArgs map[MachineID]KernelArgs
ClusterLevelKernelArgs KernelArgs
ClusterName string
}
TranslateContext is a context for translation.
type UpdateStrategyConfig ¶
type UpdateStrategyConfig struct {
Type *UpdateStrategyType `yaml:"type,omitempty"`
Rolling *RollingUpdateStrategyConfig `yaml:"rolling,omitempty"`
}
UpdateStrategyConfig defines the model for setting the update strategy in the machine set.
type UpdateStrategyType ¶
type UpdateStrategyType uint32
UpdateStrategyType extends protobuf generated update strategy enum to parse string constants.
func (UpdateStrategyType) MarshalYAML ¶
func (t UpdateStrategyType) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler.
func (*UpdateStrategyType) UnmarshalYAML ¶
func (t *UpdateStrategyType) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements yaml.Unmarshaler.
type Workers ¶
type Workers struct {
MachineSet `yaml:",inline"`
}
Workers describes Cluster worker nodes.