Documentation ¶
Index ¶
- func ListControlPlaneNodeIPs(ctx context.Context, s snap.Snap) ([]string, error)
- func MaybePatchCalicoAutoDetectionMethod(ctx context.Context, s snap.Snap, canReachHost string, apply bool) error
- func MaybeUpdateDqliteBindAddress(ctx context.Context, snap snap.Snap, hostPort string, remoteIP string, ...) error
- func UpdateDqliteIP(ctx context.Context, s snap.Snap, host string) error
- type DqliteCluster
- type DqliteClusterNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListControlPlaneNodeIPs ¶
ListControlPlaneNodeIPs returns the internal IPs of the control plane nodes of the MicroK8s cluster.
func MaybePatchCalicoAutoDetectionMethod ¶
func MaybePatchCalicoAutoDetectionMethod(ctx context.Context, s snap.Snap, canReachHost string, apply bool) error
MaybePatchCalicoAutoDetectionMethod attempts to update the calico cni.yaml to update the value of the IP_AUTODETECTION_METHOD option.
The default value is "first-found", which works well for single-node clusters. However, after adding a new node, we want to change this to `can-reach=canReachHost` to mitigate issues with multiple NICs.
If canReachHost is an IPv6 address, IP6_AUTODETECTION_METHOD is updated instead.
Optionally, the new manifest may be applied using the microk8s-kubectl.wrapper script.
func MaybeUpdateDqliteBindAddress ¶
func MaybeUpdateDqliteBindAddress(ctx context.Context, snap snap.Snap, hostPort string, remoteIP string, findMatchingBindAddress func(string) (string, error)) error
MaybeUpdateDqliteBindAddress checks if the node is part of a dqlite cluster and updates it if necessary. It ensures the node's hostPort is included in the cluster configuration.
Types ¶
type DqliteCluster ¶
type DqliteCluster []DqliteClusterNode
DqliteCluster is the format of the dqlite cluster.yaml file.
func GetDqliteCluster ¶
func GetDqliteCluster(s snap.Snap) (DqliteCluster, error)
GetDqliteCluster a list of all currently known dqlite cluster nodes.
func WaitForDqliteCluster ¶
func WaitForDqliteCluster(ctx context.Context, s snap.Snap, f func(DqliteCluster) (bool, error)) (DqliteCluster, error)
WaitForDqliteCluster queries the dqlite cluster nodes repeatedly until f(cluster) becomes true.
type DqliteClusterNode ¶
type DqliteClusterNode struct { // Address is the address of the node in the cluster. Address string `yaml:"Address"` // ID is the unique identifier of the node in the cluster. ID uint64 `yaml:"ID,omitempty"` // NodeRole is the role of the node in the cluster. // 0 -- Voter // 1 -- StandBy // 2 -- Spare NodeRole int `yaml:"Role,omitempty"` }
DqliteClusterNode is a node in the dqlite cluster.