infrastructure

package
v1.10.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Copyright 2026.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrPooledMachineNotFound = fmt.Errorf("free pooled machine not found")

ErrPooledMachineNotFound is returned when a RemoteMachine references a pool but no free machine is found in the pool.

Functions

This section is empty.

Types

type ClusterController

type ClusterController struct {
	client.Client
	Scheme *runtime.Scheme
}

ClusterController is responsible for reconciling the RemoteCluster resource, which represents a remote cluster that is being managed by k0smotron.

func (*ClusterController) Reconcile

func (r *ClusterController) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

Reconcile reconciles the RemoteCluster resource and ensures it is in a ready state.

func (*ClusterController) SetupWithManager

func (r *ClusterController) SetupWithManager(mgr ctrl.Manager, opts controller.Options) error

SetupWithManager sets up the controller with the Manager.

type JobProvisioner added in v0.9.6

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

JobProvisioner is responsible for provisioning a remote machine using a Kubernetes Job. It creates a Job that runs a container with the necessary tools to SSH into the remote machine and execute the bootstrap commands.

func (*JobProvisioner) Cleanup added in v0.9.6

Cleanup cleans up the resources created for provisioning the remote machine.

func (*JobProvisioner) Provision added in v0.9.6

func (p *JobProvisioner) Provision(ctx context.Context) error

Provision provisions the remote machine by creating a Kubernetes Job that executes the bootstrap commands on the remote machine.

type Provisioner

type Provisioner interface {
	Provision(ctx context.Context) error
	Cleanup(ctx context.Context, mode RemoteMachineMode) error
}

Provisioner defines the interface for provisioning a remote machine.

type RemoteMachineController

type RemoteMachineController struct {
	client.Client
	SecretCachingClient client.Client
	Scheme              *runtime.Scheme
	ClientSet           *kubernetes.Clientset
	RESTConfig          *rest.Config
}

RemoteMachineController is responsible for reconciling the RemoteMachine resource.

func (*RemoteMachineController) Reconcile

func (r *RemoteMachineController) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

Reconcile reconciles the RemoteMachine resource and ensures the remote machine is provisioned and in a ready state.

func (*RemoteMachineController) SetupWithManager

func (r *RemoteMachineController) SetupWithManager(mgr ctrl.Manager, opts controller.Options) error

SetupWithManager sets up the controller with the Manager.

type RemoteMachineMode added in v0.8.0

type RemoteMachineMode int

RemoteMachineMode defines the mode of the RemoteMachine, which can be either a control plane node, a worker node, or a non-k0s machine.

const (
	// RemoteMachineFinalizer is the finalizer used for RemoteMachine resources to ensure proper cleanup.
	RemoteMachineFinalizer = "remotemachine.k0smotron.io/finalizer"
	// ModeController indicates that the RemoteMachine is a control plane node.
	ModeController RemoteMachineMode = iota
	// ModeWorker indicates that the RemoteMachine is a worker node.
	ModeWorker
	// ModeNonK0s indicates that the RemoteMachine is not a k0s node, and should be treated as a generic machine.
	ModeNonK0s
)

type SSHProvisioner added in v0.9.6

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

SSHProvisioner is responsible for provisioning a remote machine using SSH.

func (*SSHProvisioner) Cleanup added in v0.9.6

func (p *SSHProvisioner) Cleanup(ctx context.Context, mode RemoteMachineMode) error

Cleanup cleans up a machine The provisioning process is as follows: 1. Open SSH connection to the machine 2. Stops k0s 3. Removes node from etcd 4. Runs k0s reset

func (*SSHProvisioner) Provision added in v0.9.6

func (p *SSHProvisioner) Provision(ctx context.Context) error

Provision provisions a new machine The provisioning process is as follows: 1. Open SSH connection to the machine 2. Execute the bootstrap script 3. Check sentinel file at /run/cluster-api/bootstrap-success.complete 4. success

Jump to

Keyboard shortcuts

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