Documentation
¶
Overview ¶
Package common provides shared utilities for infrastructure controllers.
Index ¶
- func DetermineAPIEndpoint(service *corev1.Service) (string, error)
- func DiscoverControlPlaneService(ctx context.Context, c client.Client, ...) (*corev1.Service, error)
- func ExtractClusterNameFromDeploymentName(deploymentName, colonyName string) string
- func GetAPIServerPort(service *corev1.Service) int32
- func GetServiceExternalAddress(service *corev1.Service) (string, bool)
- func ValidateControlPlanePorts(service *corev1.Service) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetermineAPIEndpoint ¶
DetermineAPIEndpoint determines the API endpoint for a control plane service. If the service is a LoadBalancer with an external address, it returns the external address. Otherwise, it returns the ClusterIP. Returns the endpoint in format "host:port" and an error if the endpoint cannot be determined.
func DiscoverControlPlaneService ¶
func DiscoverControlPlaneService(ctx context.Context, c client.Client, namespace, colonyName, clusterName string) (*corev1.Service, error)
DiscoverControlPlaneService discovers the k0smotron control plane Service for a cluster. Uses label selectors to find services, supporting name variations like -nodeport or -loadbalancer suffixes. Returns the service with validated ClusterIP and ports 30443, 30132.
func ExtractClusterNameFromDeploymentName ¶
ExtractClusterNameFromDeploymentName extracts the cluster name from a ClusterDeployment name. ClusterDeployment names follow the pattern: <colony-name>-<cluster-name>
func GetAPIServerPort ¶
GetAPIServerPort returns the API server port from the service. Checks by port name first, then falls back to common port numbers.
func GetServiceExternalAddress ¶
GetServiceExternalAddress extracts the external address from a LoadBalancer service. Returns the hostname or IP and a boolean indicating if an external address was found.
func ValidateControlPlanePorts ¶
ValidateControlPlanePorts validates that required ports exist in the service. Checks by port name (more reliable) and falls back to common port numbers.
Types ¶
This section is empty.