canonical / grafana-agent-k8s-operator

This charmed operator automates the operational procedures of running Grafana Agent, an open-soruce telemetry collector.
https://charmhub.io/grafana-agent-k8s
Apache License 2.0
8 stars 18 forks source link

Grafana agent crashes postgresql-k8s ARM charm in loki_push_api._setup_promtail() : KeyError: 'aarch64' #298

Closed taurus-forever closed 2 months ago

taurus-forever commented 2 months ago

Bug Description

Data Team has created ARM support for PostgreSQL VM and K8s. VM works well, but K8s crashes on relation postgresql-k8s<>grafana-ahent-k8s:

> juju status 
Model    Controller  Cloud/Region    Version  SLA          Timestamp
testk3s  lxd         k3sarm/default  3.4.2    unsupported  10:35:54+02:00

SAAS        Status  Store  URL
grafana     active  lxd    admin/cos.grafana
loki        active  lxd    admin/cos.loki
prometheus  active  lxd    admin/cos.prometheus

App                  Version  Status   Scale  Charm                Channel        Rev  Address        Exposed  Message
grafana-agent-k8s             active       1  grafana-agent-k8s    latest/edge     75  10.43.218.46   no       
postgresql-k8s       14.11    waiting      1  postgresql-k8s       14/candidate   248  10.43.110.157  no       installing agent
postgresql-test-app           active       1  postgresql-test-app  latest/stable  118  10.43.6.229    no       received database credentials of the first database

Unit                    Workload  Agent  Address      Ports  Message
grafana-agent-k8s/0*    active    idle   10.42.0.142         
postgresql-k8s/0*       error     idle   10.42.0.140         hook failed: "logging-relation-changed"
postgresql-test-app/0*  active    idle   10.42.0.143         received database credentials of the first database

See the debug-log below.

To Reproduce

juju set-model-constraints arch=arm64 juju deploy postgresql-k8s --trust --channel 14/edge --config profile=testing # rev248 juju deploy grafana-agent-k8s --trust --channel edge # rev75 ... relate all together with COS.

Environment

10:37:17 ✔ taurus:((rev248))~/canonical/postgresql-k8s-operator$ grep LIB lib/charms/loki_k8s/v0/loki_push_api.py LIBID = "bf76f23cdd03464b877c52bd1d2f563e" LIBAPI = 0 LIBPATCH = 29

Relevant log output

unit-grafana-agent-k8s-0: 09:31:18 ERROR juju.worker.uniter.operation hook "agent-pebble-ready" (via hook dispatching script: dispatch) failed: exit status
 1
unit-grafana-agent-k8s-0: 09:31:18 ERROR juju.worker.uniter pebble poll failed for container "agent": failed to send pebble-ready event: hook failed
unit-postgresql-k8s-0: 09:31:20 ERROR unit.postgresql-k8s/0.juju-log logging:13: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 1690, in <module>
    main(PostgresqlOperatorCharm, use_juju_for_storage=True)
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/main.py", line 544, in main
    manager.run()
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/main.py", line 520, in run
    self._emit()
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/main.py", line 509, in _emit
    _emit_charm_event(self.charm, self.dispatcher.event_name)
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/main.py", line 143, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/framework.py", line 352, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/framework.py", line 851, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/ops/framework.py", line 941, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/lib/charms/loki_k8s/v0/loki_push_api.py", line 1855, in _on_relation_changed
    self._setup_promtail()
  File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/lib/charms/loki_k8s/v0/loki_push_api.py", line 2321, in _setup_promtail
    if not self._is_promtail_installed(promtail_binaries[self._arch]):
KeyError: 'aarch64'


### Additional context

The charm is using the latest loki library LIBPATCH 29.
simskij commented 2 months ago

You are using the v0 library. Loki is currently on v1, where this has been addressed.