missing or wrong data in unit relation data (k8s charms)

Bug #1911135 reported by David
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Won't Fix
Undecided
Joseph Phillips

Bug Description

Hello,

I noticed that in the unit relation data provided by default the private-address is wrong.

With the new operator framework, I can obtain both cluster IP and unit IP with the following commands:
- self.model.get_binding(event.relation).network.bind_address # unit ip
- self.model.get_binding(event.relation).network.ingress_address # cluster ip

This is an example of the unit relation data provided by default:
{'egress-subnets': '10.152.183.41/32', 'ingress-address': '10.152.183.41', 'private-address': '10.152.183.41'}

Ingress address is fine, but the private-address is wrong, it should be 10.1.245.73 (in my case)

Changed in juju:
status: New → Won't Fix
assignee: nobody → Joseph Phillips (manadart)
status: Won't Fix → Triaged
Revision history for this message
Leon (sed-i) wrote :
Revision history for this message
Leon (sed-i) wrote :

This is still a problem on Juju 2.9.11:
juju run 'relation-get ...' contradicts juju status.

> $ juju status --relations
Model Controller Cloud/Region Version SLA Timestamp
charm-dev ctrlr microk8s/localhost 2.9.11 unsupported 19:04:57-04:00

App Version Status Scale Charm Store Channel Rev OS Address Message
am active 1 alertmanager-k8s charmhub edge 4 kubernetes 10.152.183.170
karma active 1 karma-k8s local 10 kubernetes 10.152.183.137

Unit Workload Agent Address Ports Message
am/0* active idle 10.1.179.84
karma/0* active idle 10.1.179.81

Relation provider Requirer Interface Type Message
am:replicas am:replicas alertmanager_replica peer
karma:dashboard am:karma-dashboard karma_dashboard regular
karma:replicas karma:replicas karma_replica peer

> $ juju run 'relation-ids karma-dashboard' --unit am/0
karma-dashboard:22

> $ juju run 'relation-get -r karma-dashboard:22 - am' --unit am/0
cluster: charm-dev_am
egress-subnets: 10.152.183.170/32
ingress-address: 10.152.183.170
name: am/0
private-address: 10.152.183.170
uri: http://10.1.179.84:9093

Changed in juju:
status: Triaged → In Progress
Revision history for this message
Joseph Phillips (manadart) wrote :

This behaviour is actually by design. It is also unrelated to the bugs suggested as duplicates.

private-address exists for backward compatibility and is intended to be replaced by ingress-address. It will be removed in Juju 3.0. This is why it is populated with the same value.

In order to achieve what you want, the charm/library will have to explicitly set a value in the relation data.

So you would:
- Call network-get with the relation scope.
- Access the bind-addresses in the return (these are container addresses).
- Set one or more of these in relation data (you could use private-address, but a new field, say bind-address is probably safer).

Changed in juju:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.