From d5a01e0fbec8bde14af7f1160df0a965dec886df Mon Sep 17 00:00:00 2001 From: Sebastian Hasler Date: Wed, 9 Oct 2024 10:44:26 +0200 Subject: [PATCH] fix(raft): bind to Pod IP instead of hostname to support DualStack cluster In a cluster where `.Env.HOSTNAME` resolves to an IPv6 address, the orchestrator fails to start due to a syntax error in the raft bind address. This was reported here: https://github.com/bitpoke/mysql-operator/issues/929 This commit fixes this, at least for DualStack clusters, by using `.Env.POD_IP` instead, which is defined as ```yaml - name: POD_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.podIP ``` and thus typically points to an IPv4 address in DualStack clusters. For a general fix, the orchestrator code itself probably needs to be modified to correctly handle the bind hostname. --- deploy/charts/mysql-operator/templates/orchestrator-config.yaml | 2 +- deploy/charts/mysql-operator/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/charts/mysql-operator/templates/orchestrator-config.yaml b/deploy/charts/mysql-operator/templates/orchestrator-config.yaml index dbe538e19..7aceaf446 100644 --- a/deploy/charts/mysql-operator/templates/orchestrator-config.yaml +++ b/deploy/charts/mysql-operator/templates/orchestrator-config.yaml @@ -8,7 +8,7 @@ {{- $_ := set $conf "RaftEnabled" true }} {{- $_ := set $conf "RaftDataDir" "/var/lib/orchestrator" }} {{- $_ := set $conf "RaftAdvertise" "{{ .Env.HOSTNAME }}-orc-svc" }} -{{- $_ := set $conf "RaftBind" "{{ .Env.HOSTNAME }}"}} +{{- $_ := set $conf "RaftBind" "{{ .Env.POD_IP }}"}} {{- $_ := set $conf "HTTPAdvertise" "http://{{ .Env.HOSTNAME }}-orc-svc:80" }} {{- if eq 1 $replicas -}} {{- $_ := set $conf "RaftNodes" (list) }} diff --git a/deploy/charts/mysql-operator/values.yaml b/deploy/charts/mysql-operator/values.yaml index 00b818571..f1a9a47d1 100644 --- a/deploy/charts/mysql-operator/values.yaml +++ b/deploy/charts/mysql-operator/values.yaml @@ -212,7 +212,7 @@ orchestrator: # - SQLite3DataFile /var/lib/orchestrator/orc.db # - RaftEnabled true # - RaftDataDir /var/lib/orchestrator - # - RaftBind $HOSTNAME + # - RaftBind $POD_IP # - RaftNodes The statefullset members config: Debug: false