config

package
v0.0.0-...-5a13187 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeIpIpV6File = "/run/nodeip-configuration/ipv6"
	NodeIpIpV4File = "/run/nodeip-configuration/ipv4"
)

Variables

This section is empty.

Functions

func GetClusterNameAndDomain

func GetClusterNameAndDomain(kubeconfigPath, clusterConfigPath string) (clusterName string, clusterDomain string, err error)

func GetIpFromFile

func GetIpFromFile(filePath string) (net.IP, error)

Return ip from primaryIp file if file and ip exists and readable In case of error return empty string

func GetKubeconfigClusterNameAndDomain

func GetKubeconfigClusterNameAndDomain(kubeconfigPath string) (name, domain string, err error)

func GetNodes

func GetNodes(kubeconfigPath string) (*v1.NodeList, error)

GetNodes will return a list of all nodes in the cluster

Args:

  • kubeconfigPath as string

Returns:

  • v1.NodeList or error

func GetVRRPConfig

func GetVRRPConfig(apiVip, ingressVip net.IP) (vipIface net.Interface, nonVipAddr *net.IPNet, err error)

func IsUpgradeStillRunning

func IsUpgradeStillRunning(kubeconfigPath string) (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

Returns:

  • true (upgrade still running), false (upgrade complete) or error

func PopulateNodeAddresses

func PopulateNodeAddresses(kubeconfigPath string, node *Node)

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) (ApiLBConfig, error)

type Backend

type Backend struct {
	Host    string
	Address string
	Port    uint16
}

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
}

func (*Cluster) PopulateVRIDs

func (c *Cluster) PopulateVRIDs() error

PopulateVRIDs fills in the Virtual Router information for the provided Node configuration

type ClusterLBConfig

type ClusterLBConfig struct {
	ApiLBIPs     []net.IP
	ApiIntLBIPs  []net.IP
	IngressLBIPs []net.IP
}

type IngressConfig

type IngressConfig struct {
	Peers []string
}

func GetIngressConfig

func GetIngressConfig(kubeconfigPath string, vips []string) (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) (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

func PopulateCloudLBIPAddresses

func PopulateCloudLBIPAddresses(clusterLBConfig ClusterLBConfig, node Node) (updatedNode Node, err error)

type NodeAddress

type NodeAddress struct {
	Address string
	Name    string
	Ipv6    bool
}

Jump to

Keyboard shortcuts

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