Documentation
¶
Overview ¶
Package talos provides a programmatic interface to bootstrap Talos control plane nodes.
Index ¶
- Constants
- Variables
- func GenerateControlPlaneConfig(cfg *BundleConfig, patches *[]string) (*[]byte, error)
- func GenerateWorkerConfig(cfg *BundleConfig, patches *[]string) (*[]byte, error)
- func GetSecretBundleFromConfig(ctx context.Context, machineConfig []byte) (*secrets.Bundle, error)
- func NewCPBundle(cfg *BundleConfig, patches *[]string) (*bundle.Bundle, error)
- func NewClock() secrets.Clock
- func NewWorkerBundle(cfg *BundleConfig, patches *[]string) (*bundle.Bundle, error)
- func TalosConfig(b *bundle.Bundle) *clientconfig.Config
- func WriteControlPlaneConfig(bundle *bundle.Bundle, dir string) error
- func WriteTalosConfig(bundle *bundle.Bundle, dir string) error
- func WriteWorkerConfig(bundle *bundle.Bundle, dir string) error
- type BundleConfig
- type SecretBundle
- type TalosClient
- func (tc *TalosClient) ApplyConfig(ctx context.Context, machineConfig []byte) error
- func (tc *TalosClient) ApplyMetaKey(ctx context.Context, endpoint string, meta *talosv1alpha1.META) error
- func (tc *TalosClient) BootstrapNode(ctx context.Context) error
- func (tc *TalosClient) EtcdSnapshotReader(ctx context.Context) (io.ReadCloser, error)
- func (tc *TalosClient) GetInstallDisk(ctx context.Context, tm *talosv1alpha1.TalosMachine) (*string, error)
- func (tc *TalosClient) GetServiceStatus(ctx context.Context, svcName string) (*string, error)
- func (tc *TalosClient) GetTalosVersion(ctx context.Context) (string, error)
- func (tc *TalosClient) UpgradeKubeVersion(ctx context.Context, version string, endpoint string) error
- func (tc *TalosClient) UpgradeTalosVersion(ctx context.Context, image string) error
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 NewCPBundle ¶
func NewCPBundle(cfg *BundleConfig, patches *[]string) (*bundle.Bundle, error)
func NewWorkerBundle ¶
func NewWorkerBundle(cfg *BundleConfig, patches *[]string) (*bundle.Bundle, error)
func TalosConfig ¶
func TalosConfig(b *bundle.Bundle) *clientconfig.Config
func WriteControlPlaneConfig ¶
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 ¶
func NewSecretBundle ¶
func NewSecretBundle() (SecretBundle, error)
type TalosClient ¶
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 (*TalosClient) GetTalosVersion ¶
func (tc *TalosClient) GetTalosVersion(ctx context.Context) (string, error)
func (*TalosClient) UpgradeKubeVersion ¶
func (*TalosClient) UpgradeTalosVersion ¶
func (tc *TalosClient) UpgradeTalosVersion(ctx context.Context, image string) error
Click to show internal directories.
Click to hide internal directories.