common

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package common provides shared utilities for infrastructure controllers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineAPIEndpoint

func DetermineAPIEndpoint(service *corev1.Service) (string, error)

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

func ExtractClusterNameFromDeploymentName(deploymentName, colonyName string) string

ExtractClusterNameFromDeploymentName extracts the cluster name from a ClusterDeployment name. ClusterDeployment names follow the pattern: <colony-name>-<cluster-name>

func GetAPIServerPort

func GetAPIServerPort(service *corev1.Service) int32

GetAPIServerPort returns the API server port from the service. Checks by port name first, then falls back to common port numbers.

func GetServiceExternalAddress

func GetServiceExternalAddress(service *corev1.Service) (string, bool)

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

func ValidateControlPlanePorts(service *corev1.Service) error

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.

Jump to

Keyboard shortcuts

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