canonical / opensearch-operator

OpenSearch operator
Apache License 2.0
9 stars 5 forks source link

Endpoints relation-data passed to client applications are refreshed in random order every `update-status` #269

Closed marcoppenheimer closed 2 months ago

marcoppenheimer commented 2 months ago

Issue

Non-sorted Opensearch endpoints causing unnecessary relation-changed events every update-status for client applications. Cause is because they are not sorted, resulting in random ordering each time, causing a 'change' that isn't necessary

Steps to reproduce

Relate a charm to opensearch:opensearch-client, log out relation-changed events and the endpoints in it

Expected behavior

Not getting relation-changed every update-status with the same content

Actual behavior

Getting relation-changed every update-status with the same content

Log output

(from a client application, printing out what it gets from the relation-changed event)

❯ juju debug-log -l DEBUG --lines 10000 --exclude-module juju | grep self.charm.state.opensearch_server.endpoints | grep dashboards-32 | tail -n 5

unit-opensearch-dashboards-32: 15:54:10 INFO unit.opensearch-dashboards/32.juju-log opensearch_client:35: self.charm.state.opensearch_server.endpoints=['10.103.116.180:9200', '10.103.116.216:9200', '10.103.116.16:9200']
unit-opensearch-dashboards-32: 15:54:20 INFO unit.opensearch-dashboards/32.juju-log opensearch_client:35: self.charm.state.opensearch_server.endpoints=['10.103.116.216:9200', '10.103.116.180:9200', '10.103.116.16:9200']
unit-opensearch-dashboards-32: 15:54:30 INFO unit.opensearch-dashboards/32.juju-log opensearch_client:35: self.charm.state.opensearch_server.endpoints=['10.103.116.216:9200', '10.103.116.16:9200', '10.103.116.180:9200']
unit-opensearch-dashboards-32: 15:54:39 INFO unit.opensearch-dashboards/32.juju-log opensearch_client:35: self.charm.state.opensearch_server.endpoints=['10.103.116.16:9200', '10.103.116.180:9200', '10.103.116.216:9200']
unit-opensearch-dashboards-32: 15:54:48 INFO unit.opensearch-dashboards/32.juju-log opensearch_client:35: self.charm.state.opensearch_server.endpoints=['10.103.116.216:9200', '10.103.116.180:9200', '10.103.116.16:9200']
github-actions[bot] commented 2 months ago

https://warthogs.atlassian.net/browse/DPE-4230