talos

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package talos provides a programmatic interface to bootstrap Talos control plane nodes.

Index

Constants

View Source
const (
	KUBELET_SERVICE_NAME   = "kubelet"
	KUBELET_STATUS_RUNNING = "Running"
)
View Source
const (
	DefaultTalosImage = "ghcr.io/siderolabs/installer"
)
View Source
const (
	MaintenanceMode = true
)

Variables

View Source
var (
	InstallDisk = `
machine:
  install:
    disk: %s
`
	InstallImage = `
machine:
  install:
    image: %s
`
	WipeDisk = `
machine:
  install:
    wipe: %t
`
	AirGapp = `
machine:
  time:
    disabled: true
cluster:
  discovery:
    enabled: false
`
	AllowSchedulingOnControlPlanes = `
cluster:
  allowSchedulingOnControlPlanes: true
`
	ImageCache = `
machine:
  features:
    imageCache:
      localEnabled: true
`
	ImageCacheVolumeConfig = `
---
apiVersion: v1alpha1
kind: VolumeConfig
name: IMAGECACHE
provisioning:
  diskSelector:
    match: 'system_disk'
`
)

Functions

func GenerateControlPlaneConfig

func GenerateControlPlaneConfig(cfg *BundleConfig, patches *[]string) (*[]byte, error)

func GenerateWorkerConfig

func GenerateWorkerConfig(cfg *BundleConfig, patches *[]string) (*[]byte, error)

func GetSecretBundleFromConfig added in v0.2.4

func GetSecretBundleFromConfig(ctx context.Context, machineConfig []byte) (*secrets.Bundle, error)

func NewCPBundle

func NewCPBundle(cfg *BundleConfig, patches *[]string) (*bundle.Bundle, error)

func NewClock

func NewClock() secrets.Clock

func NewWorkerBundle

func NewWorkerBundle(cfg *BundleConfig, patches *[]string) (*bundle.Bundle, error)

func TalosConfig

func TalosConfig(b *bundle.Bundle) *clientconfig.Config

func WriteControlPlaneConfig

func WriteControlPlaneConfig(bundle *bundle.Bundle, dir string) error

func WriteTalosConfig

func WriteTalosConfig(bundle *bundle.Bundle, dir string) error

func WriteWorkerConfig

func WriteWorkerConfig(bundle *bundle.Bundle, dir string) error

Types

type BundleConfig

type BundleConfig struct {
	ClusterName   string          `json:"clusterName"`    // Name of the Talos cluster
	Endpoint      string          `json:"endpoint"`       // Control plane endpoint for the Talos cluster
	Version       string          `json:"version"`        // Talos version to use
	KubeVersion   string          `json:"kubeVersion"`    // Kubernetes version to use
	SecretsBundle *secrets.Bundle `json:"-"`              // Secrets bundle for the Talos cluster
	Sans          []string        `json:"sans,omitempty"` // Additional Subject Alternative Names for the API server
	//nolint:lll // Description is long
	PodCIDR        *[]string           `json:"podCIDR,omitempty"`        // Pod CIDR ranges
	ServiceCIDR    *[]string           `json:"serviceCIDR,omitempty"`    // Service CIDR ranges
	ClientEndpoint *[]string           `json:"clientEndpoint,omitempty"` // Optional client endpoint for Talos API
	CNI            *v1alpha1.CNIConfig `json:"cni,omitempty"`            // CNI configuration
}

func ParseBundleConfig

func ParseBundleConfig(bc string) (*BundleConfig, error)

type SecretBundle

type SecretBundle *secrets.Bundle

func NewSecretBundle

func NewSecretBundle() (SecretBundle, error)

type TalosClient

type TalosClient struct {
	*client.Client
	Endpoint string
}

func NewClient

func NewClient(ctx context.Context, cfg *BundleConfig, insecure bool) (*TalosClient, error)

NewClient constructs a Talos API client using the default talosconfig file and context name. It returns an initialized client or an error.

func (*TalosClient) ApplyConfig

func (tc *TalosClient) ApplyConfig(ctx context.Context, machineConfig []byte) error

ApplyConfig applies the config to the machine by using talos client

func (*TalosClient) ApplyMetaKey added in v0.2.5

func (tc *TalosClient) ApplyMetaKey(ctx context.Context, endpoint string, meta *talosv1alpha1.META) error

func (*TalosClient) BootstrapNode

func (tc *TalosClient) BootstrapNode(ctx context.Context) error

BootstrapNode replicates `talosctl bootstrap` by invoking the Bootstrap RPC on the node.

func (*TalosClient) EtcdSnapshotReader added in v0.3.0

func (tc *TalosClient) EtcdSnapshotReader(ctx context.Context) (io.ReadCloser, error)

EtcdSnapshotReader returns an io.ReadCloser for streaming the etcd snapshot This avoids writing the snapshot to disk, allowing direct streaming to S3

func (*TalosClient) GetInstallDisk

func (tc *TalosClient) GetInstallDisk(ctx context.Context, tm *talosv1alpha1.TalosMachine) (*string, error)

func (*TalosClient) GetServiceStatus

func (tc *TalosClient) GetServiceStatus(ctx context.Context, svcName string) (*string, error)

func (*TalosClient) GetTalosVersion

func (tc *TalosClient) GetTalosVersion(ctx context.Context) (string, error)

func (*TalosClient) UpgradeKubeVersion

func (tc *TalosClient) UpgradeKubeVersion(ctx context.Context, version string, endpoint string) error

func (*TalosClient) UpgradeTalosVersion

func (tc *TalosClient) UpgradeTalosVersion(ctx context.Context, image string) error

Jump to

Keyboard shortcuts

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