canonical / grafana-agent-operator

https://charmhub.io/grafana-agent
Apache License 2.0
4 stars 10 forks source link

Cannot deploy agent to Charmed PostgreSQL VM ARM charm (as subordinated) #54

Closed taurus-forever closed 5 months ago

taurus-forever commented 8 months ago

Bug Description

Hi,

As a part of 24.04 sprint we are testing Charmed PostgreSQL ARM build with COS and currently it crashes due to the lack of ARM snap (see the full log below):

charms.operator_libs_linux.v2.snap.SnapNotFoundError: Snap 'grafana-agent' not found!

AFAIK, ARM support is not yet implemented for VM grafana agent => it is a bugreport to add it. Tnx!

To Reproduce

juju deploy postgresql --channel 14/edge --config profile=testing --constraints arch=arm64 --series jammy
git clone https://github.com/canonical/grafana-agent-operator/ && cd grafana-agent-operator
sed -i 's/amd64/arm64/' charmcraft.yaml 
charmcraft pack
juju deploy ./grafana-agent_ubuntu-22.04-arm64.charm
juju relate postgresql:cos-agent grafana-agent

Environment

ARM CPU

[taurus@armjuju ~]$ lscpu
Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  4
  On-line CPU(s) list:   0-3
Vendor ID:               ARM
  Model name:            Cortex-A55
...

[taurus@armjuju ~]$ snap list
Name                Version       Rev    Tracking       Publisher        Notes
charmcraft          2.5.4         2097   latest/stable  canonical**      classic
charmed-postgresql  14.10         97     14/edge/…      dataplatformbot  -
core                16-2.60.4     16204  latest/stable  canonical**      core
core20              20231123      2107   latest/stable  canonical**      base
core22              20231123      1035   latest/stable  canonical**      base
jhack               0.3.28        283    latest/edge    ppasotti         -
juju                3.1.7         25752  3.1/stable     canonical**      -
lxd                 5.20-c4bbef1  26717  latest/stable  canonical**      -

Relevant log output

unit-grafana-agent-0: 22:25:06 INFO unit.grafana-agent/0.juju-log Running legacy hooks/install.
unit-grafana-agent-0: 22:25:08 DEBUG unit.grafana-agent/0.juju-log ops 2.10.0 up and running.
unit-grafana-agent-0: 22:25:08 DEBUG unit.grafana-agent/0.juju-log Charm called itself via hooks/install.
unit-grafana-agent-0: 22:25:09 DEBUG unit.grafana-agent/0.juju-log Legacy hooks/install exited with status 0.
unit-grafana-agent-0: 22:25:09 DEBUG unit.grafana-agent/0.juju-log Invalid Prometheus alert rules folder at /var/lib/juju/agents/unit-grafana-agent-0/charm/prometheus_alert_rules: directory does not exist
unit-grafana-agent-0: 22:25:11 ERROR unit.grafana-agent/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 763, in _request_raw
    response = self.opener.open(request, timeout=self.timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 829, in __getitem__
    self._snap_map[snap_name] = self._load_info(snap_name)
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 877, in _load_info
    info = self._snap_client.get_snap_information(name)
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 785, in get_snap_information
    return self._request("GET", "find", {"name": name})[0]
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 742, in _request
    response = self._request_raw(method, path, query, headers, data)
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 774, in _request_raw
    raise SnapAPIError(body, code, status, message)
charms.operator_libs_linux.v2.snap.SnapAPIError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/./src/charm.py", line 531, in <module>
    main(GrafanaAgentMachineCharm)
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/venv/ops/main.py", line 444, in main
    charm = charm_class(framework)
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/./src/charm.py", line 172, in __init__
    self.snap = snap.SnapCache()["grafana-agent"]
  File "/var/lib/juju/agents/unit-grafana-agent-0/charm/lib/charms/operator_libs_linux/v2/snap.py", line 831, in __getitem__
    raise SnapNotFoundError("Snap '{}' not found!".format(snap_name))
charms.operator_libs_linux.v2.snap.SnapNotFoundError: Snap 'grafana-agent' not found!
unit-grafana-agent-0: 22:25:12 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1


### Additional context

_No response_
lucabello commented 5 months ago

We now support ARM for the grafana-agent snap!

Please try again, and if the issue is still there feel free to re-open the issue :)

754bcb6a-c690-41f3-bdda-1171ae3fbb77