cybozu-go / moco

MySQL operator on Kubernetes using GTID-based semi-synchronous replication.

Home Page:https://cybozu-go.github.io/moco/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backup doesn't work on IPv6-only clusters

eplightning opened this issue · comments

Describe the bug
Backups fail when Kubernetes cluster networking is configured to be IPv6 SingleStack (pods and services don't have any IPv4 addresses).

Environments

  • Version: 0.20.0
  • OS: Debian 12

To Reproduce

  1. Install moco on a singlestack IPv6 Kubernetes cluster (for example IPv6 AWS EKS)
  2. Create MySQLCluster, BackupPolicy
  3. Wait for a backup job to get created
  4. Backup job fails with following logs:
# kubectl logs moco-backup-mysql-<snip> -n mysql
Error: failed to get server status: failed to show master status: dial tcp: lookup 2a01:0:0:0:0:6b38:0:2d9c:3306: no such host
failed to get server status: failed to show master status: dial tcp: lookup 2a01:0:0:0:0:6b38:0:2d9c:3306: no such host

Expected behavior
Backup gets created successfully (assuming all other configuration is correct)

Additional context
There are few places in backup code that assume hosts to be IPv4 addresses:

fmt.Sprintf("mysql://%s@%s:%d", o.user, o.host, o.port),

cfg.Addr = fmt.Sprintf("%s:%d", host, port)

I corrected these instances in my fork, seems to be running fine after that:
main...eplightning:moco:main

Thank you for the report. will fix.

It seems MySQL does not support IPv6 address format...
https://dev.mysql.com/doc/refman/8.0/en/clone-plugin-options-variables.html#sysvar_clone_valid_donor_list

Internet Protocol version 6 (IPv6) address format is not supported. Internet Protocol version 6 (IPv6) address format is not supported. An alias to the IPv6 address can be used instead. An IPv4 address can be used as is.

I see, thank you. I guess for the clone plugin we'll need to wait for MySQL upstream fix or use statefulset pod hostnames instead as a workaround.