...

Package detector

import "edge-infra.dev/pkg/sds/lanoutage/detector"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Package files

detector.go enter.go lanoutage.go leave.go manifests.go reconciler.go socket.go

Constants

const (
    SocketReadTimeout  time.Duration = 30 * time.Second
    SocketWriteTimeout time.Duration = 300 * time.Second
)

Variables

PlaceholderToken is only set statically to make kubeadm not randomize the token on every run

var PlaceholderToken = bootstraptokenv1.BootstrapToken{
    Token: &bootstraptokenv1.BootstrapTokenString{
        ID:     "abcdef",
        Secret: "0123456789abcdef",
    },
}

func DeleteMember

func DeleteMember(ctx context.Context, cfg leave.Conf) error

deleteEtcdMember() deletes the EtcdMember resource which matches the node name successful completion is not essential for the LAN outage Leave operation so it returns nil in all cases

func RemoveEtcdManifest

func RemoveEtcdManifest(ctx context.Context, cfg leave.Conf) error

func RemoveKubeConfig

func RemoveKubeConfig(ctx context.Context, cfg leave.Conf) error

removeKubeConfig removes the zylevel0.conf kubeconfig and keys from the node's filesystem

func RemoveKubeManifests

func RemoveKubeManifests(ctx context.Context, cfg leave.Conf) error

removeKubeManifests removes the kubernetes kube-apiserver, controller manager, and scheduler static pod manifests from the node's filesystem.

func RemoveLOMFlag

func RemoveLOMFlag(ctx context.Context, cfg leave.Conf) error

func RemoveVipAlias

func RemoveVipAlias(ctx context.Context, cfg leave.Conf) error

func removeVipAlias() removes the VIP alias from the lo interface, doesn't error if there isn't a VIP present

func ReverseIsolateNode

func ReverseIsolateNode(ctx context.Context, cfg leave.Conf) error

func Run

func Run() error

type Action

Action encodes the operations that the reconciler can effect on the node

type Action int
const (
    None Action = iota
    Enter
    Leave
    Stay
)

type Conn

type Conn struct {
    // contains filtered or unexported fields
}

func (*Conn) Receive

func (c *Conn) Receive() (string, error)

Receive reads from the connection

func (*Conn) Respond

func (c *Conn) Respond(response string, errMessage string) error

Respond writes to the connection

type LANDetector

LANDetector performs a connection test to the control plane

type LANDetector struct {
    *LOMReconciler
    // contains filtered or unexported fields
}

func (LANDetector) Detect

func (l LANDetector) Detect() error

Detect makes a ping request for the control plane

type LOMReconciler

type LOMReconciler struct {
    // contains filtered or unexported fields
}

func NewLOMReconciler

func NewLOMReconciler(cfg config.Config, isLOM bool) *LOMReconciler

func (*LOMReconciler) Enter

func (l *LOMReconciler) Enter(ctx context.Context) error

main function for entering LAN outage mode

func (LOMReconciler) EnterPreconditionCheck

func (l LOMReconciler) EnterPreconditionCheck(ctx context.Context) (bool, error)

Checks if the following pre-conditions for Enter are true: - LOM is enabled in the LOMConfig file - local node is not already acting as a control plane - etcd is provisioned on the worker node

func (LOMReconciler) GetFs

func (l LOMReconciler) GetFs() afero.Fs

func (*LOMReconciler) Leave

func (l *LOMReconciler) Leave(ctx context.Context) error

main function for leaving LAN outage mode

func (LOMReconciler) LeavePreconditionCheck

func (l LOMReconciler) LeavePreconditionCheck(ctx context.Context) (bool, error)

Checks if the following pre-conditions for Leave are true: - LOM is enabled in the LOMConfig file - local node is not already acting as a control plane - the main etcd cluster is healthy

func (LOMReconciler) WithLock

func (l LOMReconciler) WithLock(fn func() error) (bool, error)

WithLock returns the error of the input function and reports whether the lock was acquired.

type SocketHandler

type SocketHandler struct {
    // contains filtered or unexported fields
}

func NewSocketHandler

func NewSocketHandler(path string) (*SocketHandler, error)

NewSocketHandler creates a new SocketHandler, clearing any stale sockets

func (*SocketHandler) Clear

func (s *SocketHandler) Clear() error

Clear removes the socket file

func (*SocketHandler) ReceiveConnection

func (s *SocketHandler) ReceiveConnection() (*Conn, error)

ReceiveConnection waits for a connection and returns it

type SocketResponse

type SocketResponse struct {
    Message string `json:"message,omitempty"`
    Error   string `json:"error,omitempty"`
}

type Step

type Step func() error

Subdirectories

Name Synopsis
..
helper