Documentation
¶
Index ¶
- Constants
- func BuildComponentsStatus(env v1alpha1.Environment) *v1alpha1.ComponentsStatus
- func Dryrun(log *logger.FunLogger, env v1alpha1.Environment) error
- type ClusterHealth
- type ClusterProvisioner
- type DependencyConfigurator
- type DependencyResolver
- type DirectTransport
- type NodeHealth
- type NodeInfo
- type Option
- type ProvisionFunc
- type Provisioner
- type SSMTransport
- type Transport
Constants ¶
const Shebang = `#! /usr/bin/env bash
set -xe
`
Variables ¶
This section is empty.
Functions ¶
func BuildComponentsStatus ¶ added in v0.3.0
func BuildComponentsStatus(env v1alpha1.Environment) *v1alpha1.ComponentsStatus
BuildComponentsStatus creates a ComponentsStatus from the environment spec. This captures what was requested for provisioning (source, version, git refs) so the CLI can display provenance information.
Types ¶
type ClusterHealth ¶ added in v0.3.0
type ClusterHealth struct {
Healthy bool
TotalNodes int
ReadyNodes int
ControlPlanes int
Workers int
APIServerStatus string
Nodes []NodeHealth
Message string
}
ClusterHealth represents the health status of a multinode cluster
func GetClusterHealthFromEnv ¶ added in v0.3.0
func GetClusterHealthFromEnv(log *logger.FunLogger, env *v1alpha1.Environment) (*ClusterHealth, error)
GetClusterHealthFromEnv gets cluster health using environment configuration
type ClusterProvisioner ¶ added in v0.3.0
type ClusterProvisioner struct {
// SSH credentials
KeyPath string
UserName string
// Cluster information
Environment *v1alpha1.Environment
// JoinToken is generated after kubeadm init and used by joining nodes
JoinToken string
// CertificateKey is used for control-plane joins in HA mode
CertificateKey string
// ControlPlaneEndpoint is the API server endpoint (LB DNS or first CP IP)
ControlPlaneEndpoint string
// CACertHash is the CA certificate hash for secure joins
CACertHash string
// contains filtered or unexported fields
}
ClusterProvisioner handles provisioning of multinode Kubernetes clusters
func NewClusterProvisioner ¶ added in v0.3.0
func NewClusterProvisioner(log *logger.FunLogger, keyPath, userName string, env *v1alpha1.Environment) *ClusterProvisioner
NewClusterProvisioner creates a new cluster provisioner
func (*ClusterProvisioner) GetClusterHealth ¶ added in v0.3.0
func (cp *ClusterProvisioner) GetClusterHealth(firstCPHost string) (*ClusterHealth, error)
GetClusterHealth checks the health of a multinode cluster by querying the first control-plane. firstCPHost is the SSH-reachable address — PublicIP for direct SSH, PrivateIP for SSM transport.
func (*ClusterProvisioner) ProvisionCluster ¶ added in v0.3.0
func (cp *ClusterProvisioner) ProvisionCluster(nodes []NodeInfo) error
ProvisionCluster provisions a multinode Kubernetes cluster It follows the order: init first CP → join additional CPs → join workers
type DependencyConfigurator ¶ added in v0.2.0
type DependencyConfigurator interface {
Resolve() []ProvisionFunc
// contains filtered or unexported methods
}
DependencyConfigurator defines methods for configuring dependencies
type DependencyResolver ¶ added in v0.2.0
type DependencyResolver struct {
Dependencies []ProvisionFunc
// contains filtered or unexported fields
}
DependencySolver is a struct that holds the dependency list
func NewDependencies ¶ added in v0.2.0
func NewDependencies(env *v1alpha1.Environment) *DependencyResolver
NewDependencies creates a new DependencyResolver for the given environment.
func (*DependencyResolver) Resolve ¶ added in v0.2.0
func (d *DependencyResolver) Resolve() []ProvisionFunc
Resolve returns the dependency list in the correct order
func (*DependencyResolver) SetBaseDir ¶ added in v0.3.0
func (d *DependencyResolver) SetBaseDir(dir string)
SetBaseDir sets the base directory for resolving relative file paths in custom templates.
type DirectTransport ¶ added in v0.3.0
type DirectTransport struct {
// contains filtered or unexported fields
}
DirectTransport establishes SSH connections via direct TCP to host:22. This is the default transport for single-node environments and the SSH provider.
func NewDirectTransport ¶ added in v0.3.0
func NewDirectTransport(host string) *DirectTransport
NewDirectTransport creates a DirectTransport that dials host:22.
func (*DirectTransport) Close ¶ added in v0.3.0
func (d *DirectTransport) Close() error
Close is a no-op for DirectTransport since there are no resources to release.
func (*DirectTransport) Dial ¶ added in v0.3.0
func (d *DirectTransport) Dial() (net.Conn, error)
Dial connects directly to the host via TCP with a 10-second timeout.
func (*DirectTransport) Target ¶ added in v0.3.0
func (d *DirectTransport) Target() string
Target returns the host (without port) for display purposes.
type NodeHealth ¶ added in v0.3.0
type NodeHealth struct {
Name string
Role string
Ready bool
Status string
Version string
InternalIP string
}
NodeHealth represents the health status of a single node
type NodeInfo ¶ added in v0.3.0
type NodeInfo struct {
Name string
PublicIP string
PrivateIP string
Role string // "control-plane" or "worker"
SSHUsername string // SSH username for this node (optional, falls back to ClusterProvisioner.UserName)
InstanceID string // EC2 instance ID (used by SSMTransport for private-subnet nodes)
Transport Transport // Transport controls how SSH connections are established; nil falls back to DirectTransport
}
NodeInfo represents a node to be provisioned
type Option ¶ added in v0.3.0
type Option func(*Provisioner)
Option is a functional option for configuring a Provisioner.
func WithTransport ¶ added in v0.3.0
WithTransport sets the transport used for SSH connections. If not provided, the Provisioner defaults to DirectTransport(hostUrl).
type ProvisionFunc ¶
type ProvisionFunc func(tpl *bytes.Buffer, env v1alpha1.Environment) error
type Provisioner ¶
type Provisioner struct {
Client *ssh.Client
SessionManager *ssm.Client
HostUrl string
UserName string
KeyPath string
// contains filtered or unexported fields
}
func (*Provisioner) Run ¶
func (p *Provisioner) Run(env v1alpha1.Environment) (*v1alpha1.ComponentsStatus, error)
Run provisions the environment and returns component provenance status. The returned ComponentsStatus captures source/version/commit information for each installed component.
type SSMTransport ¶ added in v0.3.0
type SSMTransport struct {
InstanceID string
Region string
Profile string
// contains filtered or unexported fields
}
SSMTransport establishes SSH connections through AWS Systems Manager (SSM) port forwarding. This is used for cluster nodes in private subnets that do not have public IP addresses.
Known limitation (D2): There is a TOCTOU race between finding a free port and starting the SSM session. If the port is taken between these two operations, Dial() will fail with "connection refused" after SSM started. The caller should retry with a new SSMTransport instance if this occurs.
func (*SSMTransport) Close ¶ added in v0.3.0
func (s *SSMTransport) Close() error
Close terminates the SSM port-forwarding session.
func (*SSMTransport) Dial ¶ added in v0.3.0
func (s *SSMTransport) Dial() (net.Conn, error)
Dial starts an SSM port-forwarding session and connects to the local tunnel endpoint. Uses retry-based dial with exponential backoff (D1) instead of a fixed sleep. Idempotent: if a previous session exists, it is closed before starting a new one.
func (*SSMTransport) Target ¶ added in v0.3.0
func (s *SSMTransport) Target() string
Target returns the EC2 instance ID.
type Transport ¶ added in v0.3.0
type Transport interface {
// Dial establishes a TCP connection to the target node's SSH port.
Dial() (net.Conn, error)
// Target returns a human-readable identifier for the target (hostname or instance ID).
Target() string
// Close releases any resources held by the transport (e.g., SSM tunnel processes).
Close() error
}
Transport abstracts how SSH connections are established to a target node. Each provider controls the transport mechanism (direct TCP, SSM tunnel, etc.) while the Provisioner simply receives working connections.