canonical / postgresql-k8s-operator

A Charmed Operator for running PostgreSQL on Kubernetes
https://charmhub.io/postgresql-k8s
Apache License 2.0
9 stars 18 forks source link

Block charm on inappropriate architecture (warn users about ARM revision deployed to AMD hardware) #463

Open cbartz opened 4 months ago

cbartz commented 4 months ago

Steps to reproduce

  1. juju deploy postgresql-k8s --trust --channel 14/edge --revision=240

Expected behavior

Unit goes into active status.

Actual behavior

Unit goes into error status.

image

Versions

Operating system: Ubuntu 22.04.4 LTS

Juju CLI: 3.1.8-genericlinux-amd64

Juju agent: 3.1.8

Charm revision: 240

microk8s: MicroK8s v1.29.2 revision 6529

Log output

Juju debug log:

unit-postgresql-k8s-0: 10:16:28 WARNING juju.worker.proxyupdater unable to set snap core settings [proxy.http= proxy.https= proxy.store=]: exec: "snap": executable file not found in $PATH, output: ""
unit-postgresql-k8s-0: 10:17:15 WARNING unit.postgresql-k8s/0.install Traceback (most recent call last):
unit-postgresql-k8s-0: 10:17:15 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 15, in <module>
unit-postgresql-k8s-0: 10:17:15 WARNING unit.postgresql-k8s/0.install     import psycopg2
unit-postgresql-k8s-0: 10:17:15 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/psycopg2/__init__.py", line 51, in <module>
unit-postgresql-k8s-0: 10:17:15 WARNING unit.postgresql-k8s/0.install     from psycopg2._psycopg import (                     # noqa
unit-postgresql-k8s-0: 10:17:15 WARNING unit.postgresql-k8s/0.install ModuleNotFoundError: No module named 'psycopg2._psycopg'
unit-postgresql-k8s-0: 10:17:15 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-postgresql-k8s-0: 10:17:21 WARNING unit.postgresql-k8s/0.install Traceback (most recent call last):
unit-postgresql-k8s-0: 10:17:21 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 15, in <module>
unit-postgresql-k8s-0: 10:17:21 WARNING unit.postgresql-k8s/0.install     import psycopg2
unit-postgresql-k8s-0: 10:17:21 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/psycopg2/__init__.py", line 51, in <module>
unit-postgresql-k8s-0: 10:17:21 WARNING unit.postgresql-k8s/0.install     from psycopg2._psycopg import (                     # noqa
unit-postgresql-k8s-0: 10:17:21 WARNING unit.postgresql-k8s/0.install ModuleNotFoundError: No module named 'psycopg2._psycopg'
unit-postgresql-k8s-0: 10:17:21 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-postgresql-k8s-0: 10:17:31 WARNING unit.postgresql-k8s/0.install Traceback (most recent call last):
unit-postgresql-k8s-0: 10:17:31 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 15, in <module>
unit-postgresql-k8s-0: 10:17:31 WARNING unit.postgresql-k8s/0.install     import psycopg2
unit-postgresql-k8s-0: 10:17:31 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/psycopg2/__init__.py", line 51, in <module>
unit-postgresql-k8s-0: 10:17:31 WARNING unit.postgresql-k8s/0.install     from psycopg2._psycopg import (                     # noqa
unit-postgresql-k8s-0: 10:17:31 WARNING unit.postgresql-k8s/0.install ModuleNotFoundError: No module named 'psycopg2._psycopg'
unit-postgresql-k8s-0: 10:17:31 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-postgresql-k8s-0: 10:17:52 WARNING unit.postgresql-k8s/0.install Traceback (most recent call last):
unit-postgresql-k8s-0: 10:17:52 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 15, in <module>
unit-postgresql-k8s-0: 10:17:52 WARNING unit.postgresql-k8s/0.install     import psycopg2
unit-postgresql-k8s-0: 10:17:52 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/psycopg2/__init__.py", line 51, in <module>
unit-postgresql-k8s-0: 10:17:52 WARNING unit.postgresql-k8s/0.install     from psycopg2._psycopg import (                     # noqa
unit-postgresql-k8s-0: 10:17:52 WARNING unit.postgresql-k8s/0.install ModuleNotFoundError: No module named 'psycopg2._psycopg'
unit-postgresql-k8s-0: 10:17:52 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-postgresql-k8s-0: 10:18:32 WARNING unit.postgresql-k8s/0.install Traceback (most recent call last):
unit-postgresql-k8s-0: 10:18:32 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 15, in <module>
unit-postgresql-k8s-0: 10:18:32 WARNING unit.postgresql-k8s/0.install     import psycopg2
unit-postgresql-k8s-0: 10:18:32 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/psycopg2/__init__.py", line 51, in <module>
unit-postgresql-k8s-0: 10:18:32 WARNING unit.postgresql-k8s/0.install     from psycopg2._psycopg import (                     # noqa
unit-postgresql-k8s-0: 10:18:32 WARNING unit.postgresql-k8s/0.install ModuleNotFoundError: No module named 'psycopg2._psycopg'
unit-postgresql-k8s-0: 10:18:32 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-postgresql-k8s-0: 10:19:55 WARNING unit.postgresql-k8s/0.install Traceback (most recent call last):
unit-postgresql-k8s-0: 10:19:55 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/./src/charm.py", line 15, in <module>
unit-postgresql-k8s-0: 10:19:55 WARNING unit.postgresql-k8s/0.install     import psycopg2
unit-postgresql-k8s-0: 10:19:55 WARNING unit.postgresql-k8s/0.install   File "/var/lib/juju/agents/unit-postgresql-k8s-0/charm/venv/psycopg2/__init__.py", line 51, in <module>
unit-postgresql-k8s-0: 10:19:55 WARNING unit.postgresql-k8s/0.install     from psycopg2._psycopg import (                     # noqa
unit-postgresql-k8s-0: 10:19:55 WARNING unit.postgresql-k8s/0.install ModuleNotFoundError: No module named 'psycopg2._psycopg'
unit-postgresql-k8s-0: 10:19:55 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1

Additional context

github-actions[bot] commented 4 months ago

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

taurus-forever commented 3 months ago

Hi @cbartz , as I can see the revision 240 was an ARM build.

Did you deploy it to ARM hardware? As your juju CLI is AMD 3.1.8-genericlinux-amd64, but the controller architecture is not mentioned.

For AMD architecture you should use revision 239 . However I recommend to let juju choose proper revision for your architecture (by using channel without specifying revision). If you still need ARM build, please consider to use 14/candidate revisions (they are going to be stable soon).

Resolved?

taurus-forever commented 3 months ago

@marceloneppel IMHO, we should improve our charm to make sure extected architecture matching to the running hardware and block the charm otherwise, I think such issues will be popular (due to revision pinning in many places).

I will keep this open for @lucasgameiroborges to pickup. ACK?

cbartz commented 3 months ago

@taurus-forever Looking at the shell history, it seems I explicitly specified revision 240 (not sure why to be honest, probably to make sure I get the latest rev) and it is on amd. Sorry about that!

The experience on charmhub is not good regarding different revs per architecture, it is not even mentioning arm there!

dragomirp commented 3 months ago

The experience on charmhub is not good regarding different revs per architecture, it is not even mentioning arm there!

I find it easiest to filter with juju info postgresql-k8s --arch=amd64 --base=ubuntu@22.04

taurus-forever commented 3 months ago

@cbartz there is an upcoming improvements on CharmHub WEB, so it will be easier to navigate between architectures. Also we are trying to indicate clearly the revisions in all official release notes.

Meanwhile, yes, the command recommended above is the safest way to go here. We will keep it open to check architecture in the charm and produce reasonable blocking message on the user mistake.

TODO: https://github.com/canonical/postgresql-k8s-operator/issues/463#issuecomment-2154712719

Thank you for reporting anyway!

carlcsaposs-canonical commented 1 month ago

FYI, related juju feature request to improve UX: https://bugs.launchpad.net/juju/+bug/2073962

lucasgameiroborges commented 1 week ago

Hi @cbartz !

This issue received a relevant patch in this PR, already released on edge channel: https://github.com/canonical/postgresql-k8s-operator/pull/613

Now, the charm should warn the user in case of wrong arch version deployment. Feel free to give it a try and reopen this in case of problems.

Thank you for raising!

lucasgameiroborges commented 1 week ago

Actually, there might be a problem in the latest release of this feature, we are investigating the issue now, reopening for clarity!