k3s

package
v0.0.61 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const K3S_VERSION = "v1.33.1+k3s1"
View Source
const (
	// K3sUninstallScriptPath is the default location of the K3s uninstall script.
	K3sUninstallScriptPath = "/usr/local/bin/k3s-uninstall.sh"
)

Variables

This section is empty.

Functions

func NewK8sClient

func NewK8sClient(kubeConfigFile string) (*dynamic.DynamicClient, error)

func Uninstall

func Uninstall(uninstallScriptPath string, logChan chan<- string) error

Uninstall executes the K3s uninstall script.

Types

type CheckResult

type CheckResult struct {
	IsInstalled     bool
	UninstallScript string // Path to the uninstall script if found
}

CheckResult holds the result of the K3s check.

func CheckInstalled

func CheckInstalled() (*CheckResult, error)

CheckInstalled checks if a K3s installation (specifically the uninstall script) exists.

type FactRotator added in v0.0.27

type FactRotator struct {
	// contains filtered or unexported fields
}

FactRotator manages educational facts display without repetition

func NewFactRotator added in v0.0.27

func NewFactRotator(facts []string) *FactRotator

NewFactRotator creates a new fact rotator with shuffled facts

func (*FactRotator) GetNext added in v0.0.27

func (f *FactRotator) GetNext() string

GetNext returns the next fact, reshuffling when all facts are exhausted

type InstallationStep

type InstallationStep struct {
	Description string
	Progress    float64
	Action      func(context.Context) error
}

InstallationStep represents a single step in the k3s setup

type Installer

type Installer struct {
	// Channel to send log messages
	LogChan chan<- string
	// Update message channel
	UpdateChan chan<- K3SUpdateMessage
	// Fact message channel
	FactChan chan<- string
	// contains filtered or unexported fields
}

Installer manages k3s setup

func NewInstaller

func NewInstaller(logChan chan<- string, updateChan chan<- K3SUpdateMessage, factChan chan<- string) *Installer

NewInstaller creates an installer instance

func (*Installer) GetInstallationState

func (self *Installer) GetInstallationState() (status string, startTime time.Time, endTime time.Time)

GetInstallationState returns status with timing info

func (*Installer) GetLastUpdateMessage

func (self *Installer) GetLastUpdateMessage() K3SUpdateMessage

GetLastUpdateMessage returns current status

func (*Installer) Install

func (self *Installer) Install(ctx context.Context) (string, error)

Install sets up k3s and returns the kubeconfig path

type K3SUpdateMessage

type K3SUpdateMessage struct {
	Progress    float64   // Progress from 0.0 to 1.0
	Status      string    // Current status: "pending", "installing", "completed", "failed"
	Description string    // Current step description
	Error       error     // Error if any
	StartTime   time.Time // Start time of the installation
	EndTime     time.Time // End time of the installation
	StepHistory []string  // History of steps executed
}

K3SUpdateMessage contains progress info for the UI

Jump to

Keyboard shortcuts

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