controllers

package
v0.5.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EVENT_CREATION_STARTED   = "CreationStarted"
	EVENT_CREATION_FAILED    = "CreationFailed"
	EVENT_CREATION_COMPLETED = "CreationCompleted"

	EVENT_INVALID_CREDENTIALS = "InvalidCredentials"
	EVENT_CONFIGMAP_ERROR     = "ConfigMapError"

	EVENT_REQUEST_GENERATION         = "RequestGenerated"
	EVENT_REQUEST_GENERATION_FAILURE = "RequestGenerationFailed"
	EVENT_NDB_REQUEST_FAILED         = "NDBRequestFailed"

	EVENT_DEREGISTRATION_STARTED   = "DeregistrationStarted"
	EVENT_DEREGISTRATION_FAILED    = "DeregistrationFailed"
	EVENT_DEREGISTRATION_COMPLETED = "DeregistrationCompleted"

	EVENT_CR_CREATED              = "CustomResourceCreated"
	EVENT_CR_DELETED              = "CustomResourceDeleted"
	EVENT_CR_STATUS_UPDATE_FAILED = "CustomResourceStatusUpdateFailed"

	EVENT_EXTERNAL_DELETE = "ExternalDeleteDetected"

	EVENT_RESOURCE_LOOKUP_ERROR = "ResourceLookupError"

	EVENT_SERVICE_SETUP_FAILED  = "ServiceSetupFailed"
	EVENT_ENDPOINT_SETUP_FAILED = "EndpointSetupFailed"

	EVENT_WAITING_FOR_NDB_RECONCILE = "WaitingForNDBReconcile"
	EVENT_WAITING_FOR_IP_ADDRESS    = "WaitingForIPAddress"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloneManager added in v0.0.8

type CloneManager struct{}

type DatabaseManager added in v0.0.8

type DatabaseManager struct{}

type DatabaseReconciler

type DatabaseReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

DatabaseReconciler reconciles a Database object

func (*DatabaseReconciler) Reconcile

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

The Reconcile method is where the controller logic resides.

func (*DatabaseReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type HAConnectivityManager added in v0.5.5

type HAConnectivityManager interface {
	// PrimaryPort returns the port for the main -svc (e.g. HAProxy write port for Postgres).
	PrimaryPort(haConfig *ndbv1alpha1.InstanceHAConfig) int32
	// AdditionalServices returns specs for any extra services beyond the primary -svc.
	// e.g. Postgres HA returns a single -ro-svc for read replicas.
	AdditionalServices(haConfig *ndbv1alpha1.InstanceHAConfig) []HAServiceSpec
}

HAConnectivityManager defines engine-specific connectivity requirements for HA databases. Each engine that supports HA provides its own implementation. To add HA connectivity support for a new engine, implement this interface and register it in haConnectivityManagers.

type HAIPResolver added in v0.5.5

type HAIPResolver interface {
	// ResolveIPs returns the connection IPs for an HA database.
	// For Postgres, these are the HAProxy VM IPs.
	// Returns an empty slice when no IPs can be resolved.
	ResolveIPs(ctx context.Context, ndbClient ndb_client.NDBClientHTTPInterface, db ndb_api.DatabaseResponse) ([]string, error)
}

HAIPResolver resolves the connection IP(s) for an HA database as reported by the NDB API. Each engine that supports HA provides its own implementation. To add IP resolution support for a new engine, implement this interface and register it in haIPResolvers.

type HAServiceSpec added in v0.5.5

type HAServiceSpec struct {
	// NameSuffix is appended to the Database CR name to form the Service/Endpoint name.
	NameSuffix string
	// Port is the target port for this service.
	Port int32
}

HAServiceSpec describes an extra Kubernetes service+endpoint pair to create for an HA database.

type InstanceManager added in v0.0.8

type InstanceManager interface {
	// contains filtered or unexported methods
}

type NDBServerReconciler added in v0.0.7

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

NDBServerReconciler reconciles a NDBServer object

func (*NDBServerReconciler) Reconcile added in v0.0.7

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

Reconciles the NDBServer custom resources by 1. Checks for deletion 2. Verify credentials and connectivity 3. Take actions based on current status.status, fetch data 4. Update the status if any changes are observed (excluding counter)

func (*NDBServerReconciler) SetupWithManager added in v0.0.7

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

SetupWithManager sets up the controller with the Manager.

type PostgresHAConnectivityManager added in v0.5.5

type PostgresHAConnectivityManager struct{}

PostgresHAConnectivityManager manages HAProxy-based connectivity for Postgres HA. Primary -svc routes to the HAProxy write port; -ro-svc routes to the read port.

func (*PostgresHAConnectivityManager) AdditionalServices added in v0.5.5

func (m *PostgresHAConnectivityManager) AdditionalServices(haConfig *ndbv1alpha1.InstanceHAConfig) []HAServiceSpec

func (*PostgresHAConnectivityManager) PrimaryPort added in v0.5.5

type PostgresHAIPResolver added in v0.5.5

type PostgresHAIPResolver struct{}

PostgresHAIPResolver resolves HAProxy IPs for a Postgres HA database. It first scans databaseNodes[] for nodes whose properties or name identify them as HAProxy, then falls back to querying the DPC (DBServerCluster) endpoint if none are found there.

func (*PostgresHAIPResolver) ResolveIPs added in v0.5.5

Jump to

Keyboard shortcuts

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