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

detect ipv6 stack and apply correct listen address #180

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions templates/galera/bin/mysql_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ fi
# Generate the mariadb configs from the templates, these will get
# copied by `kolla_start` when the pod's main container will start
PODNAME=$(hostname -f | cut -d. -f1,2)
PODIP=$(grep "${PODNAME}" /etc/hosts | cut -d$'\t' -f1)
PODIPV4=$(grep "${PODNAME}" /etc/hosts | grep -v ':' | cut -d$'\t' -f1)
PODIPV6=$(grep "${PODNAME}" /etc/hosts | grep ':' | cut -d$'\t' -f1)

cd /var/lib/config-data
for cfg in *.cnf.in; do
if [ -s "${cfg}" ]; then
echo "Generating config file from template ${cfg}"

if [[ "" = "${PODIPV6}" ]]; then
PODIP="${PODIPV4}"
IPSTACK="IPV4"
else
PODIP="[::]"
Copy link

@hjensas hjensas Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all this logic?
If we are defaulting to listen on all interfaces in case IPv6 or Dual-Stack IPv6-and-Ipv4 - Can we now simply configure it with "[::]" for all cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it has to work on an ipv4-only stack as well, IIUC galera needs the specific IP number to bind onto in that case cc @dciabrin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We started using [::] for IPv6 as per openstack-archive/puppet-tripleo@84ba7c3.
Galera is probably able to cope with other direct IPv6 addresses now, but that is to be verified. Until then, I think we are good enough with that as it's not a regression from what we used to have.

IPSTACK="IPV6"
fi

echo "Generating config file from template ${cfg}, will use ${IPSTACK} listen address of ${PODIP}"
sed -e "s/{ PODNAME }/${PODNAME}/" -e "s/{ PODIP }/${PODIP}/" "/var/lib/config-data/${cfg}" > "/var/lib/pod-config-data/${cfg%.in}"
fi
done