controller

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: BSD-3-Clause Imports: 50 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// PluginFinalizer is the finalizer added to Plugin resources to ensure JAR cleanup.
	PluginFinalizer = "mc.k8s.lex.la/plugin-cleanup"

	// AnnotationApplyNow triggers immediate update application, bypassing maintenance window.
	// Value should be a Unix timestamp (seconds since epoch) of when the annotation was set.
	// Annotations older than 5 minutes are ignored to prevent stale triggers.
	AnnotationApplyNow = "mc.k8s.lex.la/apply-now"

	// AnnotationBackupNow triggers immediate VolumeSnapshot backup.
	// Value should be a Unix timestamp (seconds since epoch) of when the annotation was set.
	// Annotations older than 5 minutes are ignored to prevent stale triggers.
	AnnotationBackupNow = "mc.k8s.lex.la/backup-now"
)

Finalizer and annotation constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupReconciler added in v1.0.1

type BackupReconciler struct {
	client.Client
	Scheme      *runtime.Scheme
	Snapshotter backup.Snapshotter
	Metrics     metrics.Recorder
	// contains filtered or unexported fields
}

BackupReconciler reconciles PaperMCServer resources for VolumeSnapshot backups.

func (*BackupReconciler) PerformBackup added in v1.0.1

func (r *BackupReconciler) PerformBackup(
	ctx context.Context,
	server *mcv1beta1.PaperMCServer,
	trigger string,
) error

PerformBackup creates a VolumeSnapshot with RCON hooks for the given server. This is exported so UpdateReconciler can call it for pre-update backups. Concurrent calls for the same server are serialized via a per-server mutex.

func (*BackupReconciler) Reconcile added in v1.0.1

func (r *BackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, retErr error)

Reconcile handles backup scheduling and execution for PaperMCServer resources.

func (*BackupReconciler) SetCron added in v1.0.1

func (r *BackupReconciler) SetCron(scheduler mccron.Scheduler)

SetCron sets the cron scheduler for the reconciler.

func (*BackupReconciler) SetupWithManager added in v1.0.1

func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type K8sPodExecutor added in v1.0.0

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

K8sPodExecutor implements PodExecutor using client-go remotecommand (SPDY).

func NewK8sPodExecutor added in v1.0.0

func NewK8sPodExecutor(config *rest.Config) (*K8sPodExecutor, error)

NewK8sPodExecutor creates a new PodExecutor from a rest.Config.

func (*K8sPodExecutor) ExecInPod added in v1.0.0

func (e *K8sPodExecutor) ExecInPod(
	ctx context.Context,
	namespace, podName, container string,
	command []string,
) ([]byte, error)

ExecInPod executes a command inside a pod and returns the combined stdout output.

type PaperAPI added in v1.0.0

type PaperAPI interface {
	GetPaperVersions(ctx context.Context) ([]string, error)
	GetPaperBuild(ctx context.Context, ver string) (*paper.BuildInfo, error)
	GetBuilds(ctx context.Context, ver string) ([]int, error)
}

PaperAPI abstracts PaperMC API operations for testability.

type PaperMCServerReconciler

type PaperMCServerReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	Config            *rest.Config
	PaperClient       PaperAPI
	Solver            solver.Solver
	RegistryClient    RegistryAPI
	Metrics           metrics.Recorder
	OperatorNamespace string
}

PaperMCServerReconciler reconciles a PaperMCServer object.

func (*PaperMCServerReconciler) Reconcile

func (r *PaperMCServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, retErr error)

Reconcile implements the reconciliation loop for PaperMCServer resources.

func (*PaperMCServerReconciler) SetupWithManager

func (r *PaperMCServerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PluginReconciler

type PluginReconciler struct {
	client.Client
	Scheme       *runtime.Scheme
	PluginClient plugins.PluginClient
	Solver       solver.Solver
	Metrics      metrics.Recorder
	HTTPClient   *http.Client
}

PluginReconciler reconciles a Plugin object. Note: URL-source plugins download entire JARs (up to MaxJARSize=100MB) into memory during metadata extraction. The default MaxConcurrentReconciles=1 keeps this safe; increasing concurrency will multiply peak memory usage accordingly.

func (*PluginReconciler) Reconcile

func (r *PluginReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, retErr error)

Reconcile implements the reconciliation loop for Plugin resources.

func (*PluginReconciler) SetupWithManager

func (r *PluginReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PodExecutor added in v1.0.0

type PodExecutor interface {
	ExecInPod(ctx context.Context, namespace, podName, container string, command []string) ([]byte, error)
}

PodExecutor executes commands inside Kubernetes pods.

type RCONClientFactory added in v1.0.1

type RCONClientFactory func(host, password string, port int) (rcon.Client, error)

RCONClientFactory creates RCON clients. Allows injection for testing.

type RegistryAPI added in v1.0.0

type RegistryAPI interface {
	ListTags(ctx context.Context, repository string, pageSize int) ([]string, error)
	ImageExists(ctx context.Context, repository, tag string) (bool, error)
}

RegistryAPI abstracts Docker registry operations for testability.

type UpdateReconciler

type UpdateReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	PaperClient      PaperAPI
	PluginClient     plugins.PluginClient
	PodExecutor      PodExecutor
	Metrics          metrics.Recorder
	BackupReconciler *BackupReconciler
	// contains filtered or unexported fields
}

UpdateReconciler reconciles PaperMCServer resources for scheduled updates.

func (*UpdateReconciler) Reconcile

func (r *UpdateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, retErr error)

Reconcile reconciles PaperMCServer resources for update management.

func (*UpdateReconciler) SetCron

func (r *UpdateReconciler) SetCron(scheduler mccron.Scheduler)

SetCron sets the cron scheduler for the reconciler.

func (*UpdateReconciler) SetupWithManager

func (r *UpdateReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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