Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speaker: Allow configuring MemberList timeouts for WAN environments #2178

Merged
merged 2 commits into from Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/metallb/templates/speaker.yaml
Expand Up @@ -241,6 +241,9 @@ spec:
{{- if .Values.loadBalancerClass }}
- --lb-class={{ .Values.loadBalancerClass }}
{{- end }}
{{- if .Values.speaker.wanConfig }}
- --ml-wan-config
{{- end }}
env:
- name: METALLB_NODE_NAME
valueFrom:
Expand Down
5 changes: 4 additions & 1 deletion internal/speakerlist/speakerlist.go
Expand Up @@ -43,7 +43,7 @@ type SpeakerList struct {
}

// New creates a new SpeakerList and returns a pointer to it.
func New(logger log.Logger, nodeName, bindAddr, bindPort, secret, namespace, labels string, stopCh chan struct{}) (*SpeakerList, error) {
func New(logger log.Logger, nodeName, bindAddr, bindPort, secret, namespace, labels string, WANNetwork bool, stopCh chan struct{}) (*SpeakerList, error) {
sl := SpeakerList{
l: logger,
stopCh: stopCh,
Expand All @@ -57,6 +57,9 @@ func New(logger log.Logger, nodeName, bindAddr, bindPort, secret, namespace, lab
}

mconfig := memberlist.DefaultLANConfig()
if WANNetwork {
mconfig = memberlist.DefaultWANConfig()
}

// mconfig.Name MUST be equal to the spec.nodeName field of the speaker pod as we match it
// against the nodeName field of Endpoint objects inside usableNodes().
Expand Down
3 changes: 2 additions & 1 deletion speaker/main.go
Expand Up @@ -76,6 +76,7 @@ func main() {
mlBindPort = flag.String("ml-bindport", os.Getenv("METALLB_ML_BIND_PORT"), "Bind port for MemberList (fast dead node detection)")
mlLabels = flag.String("ml-labels", os.Getenv("METALLB_ML_LABELS"), "Labels to match the speakers (for MemberList / fast dead node detection)")
mlSecretKeyPath = flag.String("ml-secret-key-path", os.Getenv("METALLB_ML_SECRET_KEY_PATH"), "Path to where the MemberList's secret key is mounted")
mlWANConfig = flag.Bool("ml-wan-config", false, "WAN network type for MemberList default config, bool")
myNode = flag.String("node-name", os.Getenv("METALLB_NODE_NAME"), "name of this Kubernetes node (spec.nodeName)")
port = flag.Int("port", 7472, "HTTP listening port")
logLevel = flag.String("log-level", "info", fmt.Sprintf("log level. must be one of: [%s]", logging.Levels.String()))
Expand Down Expand Up @@ -136,7 +137,7 @@ func main() {
mlSecret = string(mlSecretBytes)
}

sList, err := speakerlist.New(logger, *myNode, *mlBindAddr, *mlBindPort, mlSecret, *namespace, *mlLabels, stopCh)
sList, err := speakerlist.New(logger, *myNode, *mlBindAddr, *mlBindPort, mlSecret, *namespace, *mlLabels, *mlWANConfig, stopCh)
if err != nil {
os.Exit(1)
}
Expand Down