Documentation
¶
Index ¶
- Constants
- func DetectExistingBackend(cfg *config.Config) string
- func Down(cfg *config.Config) error
- func GetStackID(cfg *config.Config) string
- func Init(cfg *config.Config, force bool, backendName string) error
- func Purge(cfg *config.Config, force bool) error
- func SaveBackend(cfg *config.Config, name string) error
- func Up(cfg *config.Config) error
- type Backend
- type K3dBackend
- func (b *K3dBackend) DataDir(cfg *config.Config) string
- func (b *K3dBackend) Destroy(cfg *config.Config, stackID string) error
- func (b *K3dBackend) Down(cfg *config.Config, stackID string) error
- func (b *K3dBackend) Init(cfg *config.Config, stackID string) error
- func (b *K3dBackend) IsRunning(cfg *config.Config, stackID string) (bool, error)
- func (b *K3dBackend) Name() string
- func (b *K3dBackend) Prerequisites(cfg *config.Config) error
- func (b *K3dBackend) Up(cfg *config.Config, stackID string) ([]byte, error)
- type K3sBackend
- func (b *K3sBackend) DataDir(cfg *config.Config) string
- func (b *K3sBackend) Destroy(cfg *config.Config, stackID string) error
- func (b *K3sBackend) Down(cfg *config.Config, stackID string) error
- func (b *K3sBackend) Init(cfg *config.Config, stackID string) error
- func (b *K3sBackend) IsRunning(cfg *config.Config, stackID string) (bool, error)
- func (b *K3sBackend) Name() string
- func (b *K3sBackend) Prerequisites(cfg *config.Config) error
- func (b *K3sBackend) Up(cfg *config.Config, stackID string) ([]byte, error)
Constants ¶
View Source
const ( // BackendK3d is the k3d backend (Docker-based, default) BackendK3d = "k3d" // BackendK3s is the standalone k3s backend (bare-metal) BackendK3s = "k3s" )
Variables ¶
This section is empty.
Functions ¶
func DetectExistingBackend ¶
DetectExistingBackend reads the persisted backend choice without falling back to a default. Returns empty string if no backend file exists, which lets Init() apply its own default.
func GetStackID ¶
GetStackID reads the stored stack ID (exported for use in main)
func SaveBackend ¶
SaveBackend persists the backend choice
Types ¶
type Backend ¶
type Backend interface {
// Name returns the backend identifier (e.g., "k3d", "k3s")
Name() string
// Init generates backend-specific cluster configuration files
Init(cfg *config.Config, stackID string) error
// Up creates or starts the cluster and returns kubeconfig contents
Up(cfg *config.Config, stackID string) (kubeconfigData []byte, err error)
// IsRunning returns true if the cluster is currently running
IsRunning(cfg *config.Config, stackID string) (bool, error)
// Down stops the cluster without destroying configuration or data
Down(cfg *config.Config, stackID string) error
// Destroy removes the cluster entirely (containers/processes)
Destroy(cfg *config.Config, stackID string) error
// DataDir returns the storage path for the local-path-provisioner.
// For k3d this is "/data" (Docker volume mount point).
// For k3s this is the absolute host path to cfg.DataDir.
DataDir(cfg *config.Config) string
// Prerequisites checks that required software/permissions are available
Prerequisites(cfg *config.Config) error
}
Backend abstracts the Kubernetes cluster runtime (k3d, k3s)
func LoadBackend ¶
LoadBackend reads the persisted backend choice from .stack-backend file. Falls back to k3d if no file exists (backward compatibility).
func NewBackend ¶
NewBackend creates a Backend by name
type K3dBackend ¶
type K3dBackend struct{}
K3dBackend manages clusters via k3d (k3s inside Docker containers)
func (*K3dBackend) Name ¶
func (b *K3dBackend) Name() string
func (*K3dBackend) Prerequisites ¶
func (b *K3dBackend) Prerequisites(cfg *config.Config) error
type K3sBackend ¶
type K3sBackend struct{}
K3sBackend manages a standalone k3s cluster (bare-metal)
func (*K3sBackend) Name ¶
func (b *K3sBackend) Name() string
func (*K3sBackend) Prerequisites ¶
func (b *K3sBackend) Prerequisites(cfg *config.Config) error
Click to show internal directories.
Click to hide internal directories.