IP address changed but relation data (hostname and private-address) still not updated

Bug #1876029 reported by Haw Loeung on 2020-04-30
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Repository Cache Charm
Medium
Haw Loeung
charm-haproxy
Undecided
Unassigned
juju
Undecided
Unassigned

Bug Description

Hi,

u-r-c was stopped and started for maintenance in AWS. Unfortunately, the HAProxy unit still has the old IP. The u-r-c charm should really detect IP changes and send it through the relation.

| ubuntu@ip-10-216-204-237:~$ echo "show servers state" | sudo -u haproxy socat stdio $(awk '/stats socket/ { print $3 }' /etc/haproxy/haproxy.cfg)
| 1
| # be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id
| 5 ubuntu-repository-cache 1 ubuntu-repository-cache-0-80 10.167.4.164 2 0 1 1 25 15 3 4 6 0 0 0
| 5 ubuntu-repository-cache 2 ubuntu-repository-cache-1-80 10.174.149.144 2 0 1 1 25 15 3 4 6 0 0 0
| 5 ubuntu-repository-cache 3 ubuntu-repository-cache-2-80 10.187.27.67 0 0 1 1 22 7 0 0 7 0 0 0

| ubuntu@ip-10-127-251-15:~$ ip -4 a show dev eth0 | grep inet
| inet 10.127.251.15/24 brd 10.127.251.255 scope global eth0

| ubuntu@ip-10-127-251-15:~$ sudo juju-run ubuntu-repository-cache/2 "relation-get -r website:4 - ubuntu-repository-cache/2"
| hostname: 10.187.27.67
| port: "80"
| private-address: 10.187.27.67

Related branches

Haw Loeung (hloeung) wrote :

Or maybe this is juju that updates hostname and private-address?

Haw Loeung (hloeung) wrote :

This is juju 2.6.10.

Changed in ubuntu-repository-cache:
status: New → Invalid
summary: - Old/stale IP on HAProxy units
+ IP address changed but relation data (hostname and private-address)
+ still not updated
Haw Loeung (hloeung) wrote :

As discussed with Ian (wallyworld):

|14:34 <wallyworld_> hloeung: if i recall, private-address is set when the relation is first set up. it's use is deprecated
in favour of using network-get. i wonder what that shows. typically i think an address chnage on a host machine generates a
config-change hook and from there you can get any new address values via unit-get private-address, but network-get is
preferred

network-get provides the correct info:

| ubuntu@ip-10-127-251-15:~$ sudo juju-run ubuntu-repository-cache/2 "network-get website"
| bind-addresses:
| - macaddress: ""
| interfacename: ""
| addresses:
| - hostname: ""
| address: 10.127.251.15
| cidr: ""
| egress-subnets:
| - 10.127.251.15/32
| ingress-addresses:
| - 10.127.251.15

So the HAProxy charm should use network-get rather than private-address.

Changed in juju:
status: New → Invalid
Haw Loeung (hloeung) wrote :

Used relation-set to work around it for now:

| sudo juju-run ubuntu-repository-cache/2 "relation-set -r website:4 hostname=10.127.251.15 private-address=10.127.251.15"

Haw Loeung (hloeung) wrote :

u-r-c also uses relation-get private-address for it's peers and the metadatasync.

Changed in ubuntu-repository-cache:
status: Invalid → New
Dmitrii Shcherbakov (dmitriis) wrote :

You can use ingress-address which replaced private-address - it is populated by Juju when a unit enters the relation scope at the Juju level - in other words, on <name>-relation-joined an ingress-address for a remote unit will be present.

`network-get <binding-name>` can be used to retrieve ingress-address and bind-address of the unit for the current hook execution.

As for hostnames, see https://bugs.launchpad.net/juju/+bug/1864086 for more info.

Haw Loeung (hloeung) wrote :

Yeah, ingress-address (via network-get) is what we want the charms to be using as that's what juju keeps up-to-date rather than 'relation-get private-address' which is only changed on establishing the relation.

Haw Loeung (hloeung) on 2020-05-06
Changed in ubuntu-repository-cache:
assignee: nobody → Haw Loeung (hloeung)
status: New → In Progress
Haw Loeung (hloeung) on 2020-12-03
Changed in ubuntu-repository-cache:
importance: Undecided → Medium
Haw Loeung (hloeung) on 2020-12-07
Changed in ubuntu-repository-cache:
status: In Progress → Fix Committed
Haw Loeung (hloeung) on 2020-12-07
Changed in ubuntu-repository-cache:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers