Documentation
¶
Index ¶
- Constants
- func GetClusterNameAndDomain(kubeconfigPath, clusterConfigPath string) (clusterName string, clusterDomain string, err error)
- func GetIpFromFile(filePath string) (net.IP, error)
- func GetKubeconfigClusterNameAndDomain(kubeconfigPath string) (name, domain string, err error)
- func GetMasterNodesWithConfig(kubeApiServerUrl, kubeconfigPath string, nodeCache NodeCacheGetter) (*v1.NodeList, error)
- func GetNodes(kubeconfigPath string, nodeCache NodeCacheGetter) (*v1.NodeList, error)
- func GetVRRPConfig(apiVip, ingressVip net.IP) (vipIface net.Interface, nonVipAddr *net.IPNet, err error)
- func IsUpgradeStillRunning(kubeconfigPath string, nodeCache NodeCacheGetter) (bool, error)
- func PopulateNodeAddresses(kubeconfigPath string, node *Node, nodeCache NodeCacheGetter)
- func SetDebugLogLevel()
- func SetInfoLogLevel()
- type ApiLBConfig
- type Backend
- type Cluster
- type ClusterLBConfig
- type IngressConfig
- type Node
- type NodeAddress
- type NodeCacheGetter
Constants ¶
const ( NodeIpIpV6File = "/run/nodeip-configuration/ipv6" NodeIpIpV4File = "/run/nodeip-configuration/ipv4" )
Variables ¶
This section is empty.
Functions ¶
func GetClusterNameAndDomain ¶
func GetIpFromFile ¶
Return ip from primaryIp file if file and ip exists and readable In case of error return empty string
func GetMasterNodesWithConfig ¶
func GetMasterNodesWithConfig(kubeApiServerUrl, kubeconfigPath string, nodeCache NodeCacheGetter) (*v1.NodeList, error)
GetMasterNodesWithConfig returns a list of master nodes in the cluster. Supports custom API server URL for special cases (e.g., localhost for bootstrap).
Args:
- kubeApiServerUrl - custom API server URL (empty string for default)
- kubeconfigPath - path to kubeconfig
- nodeCache (optional) - if provided, uses cached data instead of API call
Returns:
- v1.NodeList or error
func GetNodes ¶
func GetNodes(kubeconfigPath string, nodeCache NodeCacheGetter) (*v1.NodeList, error)
GetNodes will return a list of all nodes in the cluster
Args:
- kubeconfigPath as string
- nodeCache (optional) - if provided, uses cached data instead of API call
Returns:
- v1.NodeList or error
func GetVRRPConfig ¶
func IsUpgradeStillRunning ¶
func IsUpgradeStillRunning(kubeconfigPath string, nodeCache NodeCacheGetter) (bool, error)
IsUpgradeStillRunning check if the upgrade is still running by looking at the nodes' machineconfiguration state and kubelet version. Once all of the machineconfigurations are Done and all kubelet versions match we know it is safe to trigger the unicast migration.
Args:
- kubeconfigPath as string
- nodeCache (optional) - if provided, uses cached data instead of API call
Returns:
- true (upgrade still running), false (upgrade complete) or error
func PopulateNodeAddresses ¶
func PopulateNodeAddresses(kubeconfigPath string, node *Node, nodeCache NodeCacheGetter)
func SetDebugLogLevel ¶
func SetDebugLogLevel()
func SetInfoLogLevel ¶
func SetInfoLogLevel()
Types ¶
type ApiLBConfig ¶
type ApiLBConfig struct {
ApiPort uint16
LbPort uint16
StatPort uint16
Backends []Backend
FrontendAddr string
}
func GetLBConfig ¶
func GetLBConfig(kubeconfigPath string, apiPort, lbPort, statPort uint16, vips []net.IP, controlPlaneTopology string, nodeCache NodeCacheGetter) (ApiLBConfig, error)
type Cluster ¶
type Cluster struct {
Name string
Domain string
APIVIP string
APIVirtualRouterID uint8
APIVIPRecordType string
APIVIPEmptyType string
IngressVIP string
IngressVirtualRouterID uint8
IngressVIPRecordType string
IngressVIPEmptyType string
VIPNetmask int
MasterAmount int64
NodeAddresses []NodeAddress
APILBIPs []string
APIIntLBIPs []string
IngressLBIPs []string
CloudLBRecordType string
CloudLBEmptyType string
PlatformType string
ControlPlaneTopology string
}
func (*Cluster) PopulateVRIDs ¶
PopulateVRIDs fills in the Virtual Router information for the provided Node configuration
type ClusterLBConfig ¶
type IngressConfig ¶
type IngressConfig struct {
Peers []string
}
func GetIngressConfig ¶
func GetIngressConfig(kubeconfigPath string, vips []string, nodeCache NodeCacheGetter) (IngressConfig, error)
type Node ¶
type Node struct {
Cluster Cluster
LBConfig ApiLBConfig
NonVirtualIP string
ShortHostname string
VRRPInterface string
DNSUpstreams []string
IngressConfig IngressConfig
EnableUnicast bool
Configs *[]Node
}
func GetConfig ¶
func GetConfig(kubeconfigPath, clusterConfigPath, resolvConfPath string, apiVips, ingressVips []net.IP, apiPort, lbPort, statPort uint16, clusterLBConfig ClusterLBConfig, platformType string, controlPlaneTopology string) (node Node, err error)
Returns a Node object populated with the configuration specified by the parameters to the function. kubeconfigPath: The path to a kubeconfig that can be used to read cluster status from the k8s api. clusterConfigPath: The path to cluster-config.yaml. This is only available on the bootstrap node so it is optional. If the file is not available, set this to "". resolvConfPath: The path to resolv.conf. Typically either /etc/resolv.conf or /var/run/NetworkManager/resolv.conf. apiVips and ingressVips: Lists of VIPs for API and Ingress, respectively. apiPort: The port on which the k8s api listens. Should be 6443. lbPort: The port on which haproxy listens. statPort: The port on which the haproxy stats endpoint listens. clusterLBConfig: A struct containing IPs for API, API-Int and Ingress LBs platformType: Name of the platform.
func PopulateCloudLBIPAddresses ¶
func PopulateCloudLBIPAddresses(clusterLBConfig ClusterLBConfig, node Node) (updatedNode Node, err error)