Documentation
¶
Index ¶
- Constants
- func NewCommand() *cobra.Command
- func NewDaemonCSRApprover(c client.Client, kubeClient kubernetes.Interface) (*daemoncred.CSRApproverReconciler, error)
- func RunManager(ctx context.Context, cfg Config) error
- type ClusterInfo
- type Config
- type DefaultReachabilityChecker
- type MachineConfigurationBindingReconciler
- type MachineConfigurationReconciler
- type MachineProvisioner
- type MachineReconciler
- type ReachabilityChecker
Constants ¶
const ( // RequeueAfterReady is the requeue interval for machines in Ready phase. RequeueAfterReady = 5 * time.Minute // RequeueAfterPending is the requeue interval for machines in Pending phase. RequeueAfterPending = 30 * time.Second // RequeueAfterFailed is the requeue interval for machines in Failed phase. RequeueAfterFailed = 1 * time.Minute // RequeueAfterJoining is the requeue interval for machines in // Joining phase. Short interval because we are waiting for the // Node to appear with the matching label. RequeueAfterJoining = 30 * time.Second // TODO: Make this configurable ProvisioningTimeout = 5 * time.Minute // TCPProbeTimeout is the timeout for TCP connection probes. TCPProbeTimeout = 10 * time.Second // SSHConnectTimeout is the timeout for SSH connections. SSHConnectTimeout = 30 * time.Second // SecretNamespaceUnboundedKube is the namespace where SSH key secrets // must reside. Machine is cluster-scoped, so we use a fixed namespace // for secret lookup. SecretNamespaceUnboundedKube = "unbounded-kube" )
Variables ¶
This section is empty.
Functions ¶
func NewDaemonCSRApprover ¶ added in v0.1.10
func NewDaemonCSRApprover( c client.Client, kubeClient kubernetes.Interface, ) (*daemoncred.CSRApproverReconciler, error)
Types ¶
type ClusterInfo ¶
type ClusterInfo struct {
// APIServer is the HTTPS endpoint of the Kubernetes API server
// (e.g. "my-cluster-dns-abc123.hcp.eastus.azmk8s.io:443").
APIServer string
// CACertBase64 is the base64-encoded cluster CA certificate from the
// kube-root-ca.crt ConfigMap in the kube-public namespace.
CACertBase64 string
// ClusterDNS is the ClusterIP of the kube-dns Service in kube-system.
ClusterDNS string
// Provider is the detected cluster provider (e.g. AKS). It is nil
// when the provider cannot be determined.
Provider cloudprovider.Provider
// KubeVersion is the Kubernetes server version (e.g. "v1.34.2") obtained
// from the API server's /version endpoint. It is used as the default
// KUBE_VERSION for bootstrap scripts unless the Machine's
// Spec.Kubernetes.Version overrides it.
KubeVersion string
}
ClusterInfo holds cluster-level values resolved once at startup and passed to bootstrap scripts as environment variables.
func ResolveClusterInfo ¶
func ResolveClusterInfo(ctx context.Context, cfg Config, k kubernetes.Interface) (*ClusterInfo, error)
ResolveClusterInfo queries the Kubernetes API to populate all four dynamic values needed by the bootstrap script. It is intended to be called once at controller startup so the results can be reused across reconcile loops.
type Config ¶
type Config struct {
APIServerEndpoint string `yaml:"apiServerEndpoint"`
MetricsAddr string `yaml:"metricsAddr"`
ProbeAddr string `yaml:"probeAddr"`
EnableLeaderElection bool `yaml:"enableLeaderElection"`
MaxConcurrentReconciles int `yaml:"maxConcurrentReconciles"`
ProvisioningTimeout time.Duration `yaml:"provisioningTimeout"`
}
Config holds the controller configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a config with default values.
func LoadConfig ¶
LoadConfig loads configuration from a YAML file.
type DefaultReachabilityChecker ¶
DefaultReachabilityChecker implements ReachabilityChecker using TCP dial. When the Machine has a bastion configured, it first establishes an SSH connection to the bastion and then TCP-dials the target through the tunnel.
func (*DefaultReachabilityChecker) CheckReachable ¶
func (c *DefaultReachabilityChecker) CheckReachable(ctx context.Context, machine *unboundedv1alpha3.Machine) error
CheckReachable checks if the machine is reachable via TCP. For machines behind a bastion, the probe is routed through the bastion's SSH tunnel. For direct machines, a plain TCP dial is performed.
type MachineConfigurationBindingReconciler ¶ added in v0.1.4
MachineConfigurationBindingReconciler resolves Machine configurationRef selection and pins it to a concrete MachineConfigurationVersion. It does not copy template fields into Machine spec; configurationRef remains the source of truth for later provisioning or repave logic.
func (*MachineConfigurationBindingReconciler) Reconcile ¶ added in v0.1.4
func (r *MachineConfigurationBindingReconciler) Reconcile( ctx context.Context, req ctrl.Request, ) (ctrl.Result, error)
Reconcile resolves a Machine's selected MachineConfigurationVersion. Explicit configurationRef wins; otherwise matching MachineConfiguration selectors are evaluated by priority and name.
func (*MachineConfigurationBindingReconciler) SetupWithManager ¶ added in v0.1.4
func (r *MachineConfigurationBindingReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type MachineConfigurationReconciler ¶ added in v0.1.4
MachineConfigurationReconciler manages versioned snapshots for MachineConfiguration resources.
func (*MachineConfigurationReconciler) Reconcile ¶ added in v0.1.4
func (r *MachineConfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile ensures each MachineConfiguration has a latest MachineConfigurationVersion. The latest undeployed version is editable; once deployed, further MachineConfiguration spec changes create a new version.
func (*MachineConfigurationReconciler) SetupWithManager ¶ added in v0.1.4
func (r *MachineConfigurationReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type MachineProvisioner ¶
type MachineProvisioner interface {
ProvisionMachine(ctx context.Context, machine *unboundedv1alpha3.Machine, sshConfig *ssh.ClientConfig, bootstrapToken string, clusterInfo *ClusterInfo) error
}
MachineProvisioner handles the actual provisioning of a machine via SSH.
type MachineReconciler ¶
type MachineReconciler struct {
client.Client
Scheme *runtime.Scheme
ReachabilityChecker ReachabilityChecker
Provisioner MachineProvisioner
ClusterInfo *ClusterInfo
MaxConcurrentReconciles int
ProvisioningTimeoutDuration time.Duration
}
MachineReconciler reconciles a Machine object.
func (*MachineReconciler) Reconcile ¶
Reconcile handles Machine reconciliation: reachability checks and provisioning.
func (*MachineReconciler) SetupWithManager ¶
func (r *MachineReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type ReachabilityChecker ¶
type ReachabilityChecker interface {
CheckReachable(ctx context.Context, machine *unboundedv1alpha3.Machine) error
}
ReachabilityChecker checks if a machine is reachable via TCP. When a bastion is configured, the check dials through the bastion's SSH tunnel to probe the target; otherwise a direct TCP dial is used.