Documentation
¶
Overview ¶
Package toposerver implements the controller for the TopoServer resource.
The TopoServer controller manages the etcd-based topology storage that Vitess components use for cluster coordination and service discovery. Its responsibilities include:
StatefulSet Management ¶
Creates and maintains a StatefulSet running etcd with:
- Persistent storage for topology data
- Proper clustering configuration for multi-replica deployments
- Container environment variables for etcd peer discovery
Service Management ¶
The controller creates two services:
- Headless Service: Enables peer discovery between etcd replicas using stable DNS names (required for etcd clustering).
- Client Service: Provides a stable endpoint for Vitess components to connect to the topology storage.
Status Aggregation ¶
Monitors the StatefulSet's ready replicas and updates the TopoServer status with current replica counts and health conditions.
TopoServer resources are typically created by the MultigresCluster controller when the cluster is configured with managed topology (as opposed to an external etcd cluster).
Index ¶
- Constants
- func BuildClientService(toposerver *multigresv1alpha1.TopoServer, scheme *runtime.Scheme) (*corev1.Service, error)
- func BuildHeadlessService(toposerver *multigresv1alpha1.TopoServer, scheme *runtime.Scheme) (*corev1.Service, error)
- func BuildStatefulSet(toposerver *multigresv1alpha1.TopoServer, scheme *runtime.Scheme) (*appsv1.StatefulSet, error)
- type TopoServerReconciler
Constants ¶
const ( // ClientPort is the default port for etcd client connections. ClientPort int32 = 2379 // PeerPort is the default port for etcd peer connections. PeerPort int32 = 2380 // MetricsPort is the default port for etcd metrics and health endpoints. MetricsPort int32 = 2381 )
const ( // ComponentName is the component label value for toposerver resources ComponentName = "toposerver" // DefaultReplicas is the default number of etcd replicas DefaultReplicas int32 = 3 // DefaultStorageSize is the default storage size for etcd data DefaultStorageSize = "10Gi" // DataVolumeName is the name of the data volume DataVolumeName = "data" // DataMountPath is the mount path for etcd data DataMountPath = "/var/lib/etcd" )
Variables ¶
This section is empty.
Functions ¶
func BuildClientService ¶
func BuildClientService( toposerver *multigresv1alpha1.TopoServer, scheme *runtime.Scheme, ) (*corev1.Service, error)
BuildClientService creates a client Service for external access to TopoServer. This service load balances across all etcd members.
func BuildHeadlessService ¶
func BuildHeadlessService( toposerver *multigresv1alpha1.TopoServer, scheme *runtime.Scheme, ) (*corev1.Service, error)
BuildHeadlessService creates a headless Service for the TopoServer StatefulSet. Headless services are required for StatefulSet pod DNS records.
func BuildStatefulSet ¶
func BuildStatefulSet( toposerver *multigresv1alpha1.TopoServer, scheme *runtime.Scheme, ) (*appsv1.StatefulSet, error)
BuildStatefulSet creates a StatefulSet for the TopoServer cluster. Returns a deterministic StatefulSet based on the TopoServer spec.
Types ¶
type TopoServerReconciler ¶
type TopoServerReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
}
TopoServerReconciler reconciles a TopoServer object.
func (*TopoServerReconciler) Reconcile ¶
func (r *TopoServerReconciler) Reconcile( ctx context.Context, req ctrl.Request, ) (ctrl.Result, error)
Reconcile manages the etcd StatefulSet, headless service, and client service for a TopoServer.
func (*TopoServerReconciler) SetupWithManager ¶
func (r *TopoServerReconciler) SetupWithManager( mgr ctrl.Manager, opts ...controller.Options, ) error
SetupWithManager sets up the controller with the Manager.