network-get returns wrong ip for cluster_address when rendering the etcd.conf template
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Etcd Charm |
New
|
Undecided
|
Unassigned |
Bug Description
In some cases where a node has a mix of ipv4 and ipv6 addresses, etcd may pull the wrong one. This shows in `juju status` as:
```
etcd 3.4.5 active 1 etcd charmstore stable 607 ubuntu Errored with 0 known peers
```
with:
```
$ juju debug-log -i etcd/0 --replay
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:16 ERROR unit.etcd/
unit-etcd-0: 14:34:16 ERROR unit.etcd/
unit-etcd-0: 14:34:16 ERROR unit.etcd/
unit-etcd-0: 14:34:16 ERROR unit.etcd/
unit-etcd-0: 14:34:16 WARNING unit.etcd/
unit-etcd-0: 14:34:17 WARNING unit.etcd/
unit-etcd-0: 14:34:17 WARNING unit.etcd/
unit-etcd-0: 14:34:17 WARNING unit.etcd/
unit-etcd-0: 14:34:17 WARNING unit.etcd/
unit-etcd-0: 14:34:17 WARNING unit.etcd/
unit-etcd-0: 14:34:17 WARNING unit.etcd/
unit-etcd-0: 14:34:17 ERROR unit.etcd/
unit-etcd-0: 14:34:17 ERROR unit.etcd/
unit-etcd-0: 14:34:17 ERROR unit.etcd/
unit-etcd-0: 14:34:17 ERROR unit.etcd/
```
and (from the unit)
```
$ journalctl -u snap.etcd.
Oct 13 18:39:42 frank-moose systemd[1]: snap.etcd.
Oct 13 18:39:52 frank-moose systemd[1]: snap.etcd.
Oct 13 18:39:52 frank-moose systemd[1]: Stopped Service for snap application etcd.etcd.
Oct 13 18:39:52 frank-moose systemd[1]: Started Service for snap application etcd.etcd.
Oct 13 18:39:52 frank-moose etcd.etcd[93173]: Running as system with data in /var/snap/etcd/230
Oct 13 18:39:52 frank-moose etcd.etcd[93173]: Configuration from /var/snap/
Oct 13 18:39:52 frank-moose etcd.etcd[93173]: unexpected error setting up initial-
Oct 13 18:39:52 frank-moose systemd[1]: snap.etcd.
Oct 13 18:39:52 frank-moose systemd[1]: snap.etcd.
```
where we see an ipv6 address being used. This is pulled from the top of ingress-addresses
```
$ juju run --unit etcd/0 'network-get cluster'
bind-addresses:
- mac-address: 00:16:3e:02:69:96
interface-name: eth2
addresses:
- hostname: ""
address: 2607:fea8:
cidr: 2607:fea8:
- hostname: ""
address: 2607:fea8:
cidr: 2607:fea8:
- hostname: ""
address: 10.0.0.42
cidr: 10.0.0.0/24
macaddress: 00:16:3e:02:69:96
interfacename: eth2
egress-subnets:
- 2607:fea8:
ingress-addresses:
- 2607:fea8:
- 2607:fea8:
- 10.0.0.42
```
where [this](https:/
As a quick fix, changing all entries of the ipv6 addresses in /var/snap/ etcd/common/ etcd.conf. yml to the correct ipv4 address for etcd up and running with a healthy peer.