controller

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const VALKEY_BUS_PORT int = 16379
View Source
const VALKEY_PORT int = 6379

Variables

This section is empty.

Functions

This section is empty.

Types

type ValkeyClusterReconciler

type ValkeyClusterReconciler struct {
	client.Client
	Scheme     *runtime.Scheme
	Recorder   record.EventRecorder
	RestConfig *rest.Config
	ClientSet  *kubernetes.Clientset
}

ValkeyClusterReconciler reconciles a ValkeyCluster object

func (*ValkeyClusterReconciler) NewValkeyClient added in v0.0.19

func (r *ValkeyClusterReconciler) NewValkeyClient(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster, ip string, port int) (valkey.Client, error)

instantiates the client and performs auth if required

func (*ValkeyClusterReconciler) NewValkeyJobManager added in v0.0.32

func (r *ValkeyClusterReconciler) NewValkeyJobManager() *ValkeyJobManager

NewValkeyJobManager creates a new job manager

func (*ValkeyClusterReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ValkeyCluster object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile

func (*ValkeyClusterReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ValkeyJobManager added in v0.0.32

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

ValkeyJobManager provides high-level operations for managing valkey cluster operations via Kubernetes Jobs. Each method represents a specific cluster management task.

func (*ValkeyJobManager) CheckCluster added in v0.0.32

func (m *ValkeyJobManager) CheckCluster(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster) (string, error)

CheckCluster verifies the cluster health and slot distribution. Returns the check output which can be analyzed for issues.

func (*ValkeyJobManager) CheckForStuckSlots added in v0.0.32

func (m *ValkeyJobManager) CheckForStuckSlots(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster) (bool, error)

CheckForStuckSlots checks if the cluster has any open (stuck) slots. Returns true if stuck slots are detected.

func (*ValkeyJobManager) DeleteNode added in v0.0.32

func (m *ValkeyJobManager) DeleteNode(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster, nodeID string) error

DeleteNode removes a node from the cluster. This is used during scale-down operations after slots have been migrated away.

func (*ValkeyJobManager) FixClusterSlots added in v0.0.32

func (m *ValkeyJobManager) FixClusterSlots(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster, logger logr.Logger) error

FixClusterSlots attempts to fix stuck slots in the cluster. This is called when slots are in "migrating" or "importing" state and need manual intervention.

func (*ValkeyJobManager) FixStuckSlotsIfNeeded added in v0.0.32

func (m *ValkeyJobManager) FixStuckSlotsIfNeeded(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster, logger logr.Logger) (bool, error)

FixStuckSlotsIfNeeded checks for and fixes stuck slots if they exist. This is a convenience method that combines check and fix operations. Returns true if slots were stuck and fixed, false if no action was needed.

func (*ValkeyJobManager) IsClusterDown added in v0.0.32

func (m *ValkeyJobManager) IsClusterDown(stdout, stderr string, err error) bool

IsClusterDown checks if the error indicates the cluster is down. This is useful for determining if a retry is appropriate.

func (*ValkeyJobManager) ReshardSlots added in v0.0.32

func (m *ValkeyJobManager) ReshardSlots(ctx context.Context, valkeyCluster *cachev1alpha1.ValkeyCluster, fromNodeID, toNodeID string, slotCount int) error

ReshardSlots migrates slots from one node to another using a Kubernetes Job. This is the primary operation for rebalancing the cluster during scaling.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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