Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add howto guides for switching from the charm plugin #1967

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

lengau
Copy link
Collaborator

@lengau lengau commented Oct 17, 2024

This adds howto guides to switch from the charm plugin to the python and poetry plugins.

@lengau lengau requested review from medubelko and a team October 17, 2024 20:25
@lengau lengau linked an issue Oct 17, 2024 that may be closed by this pull request
This adds howto guides to switch from the charm plugin to the python
and poetry plugins.
@lengau lengau force-pushed the work/1913/CRAFT-3425/howto branch from 95567bd to 1347d86 Compare October 17, 2024 22:22
Copy link
Contributor

@mattculler mattculler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clear!

@jnsgruk
Copy link
Member

jnsgruk commented Oct 18, 2024

Gave this a go here: jnsgruk/zinc-k8s-operator#288

Might be worth including a section about using override-pull as a place where people can generate requirements'txt if they need to.

I guess they could also use override-build and just place their generation code before craftctl default.

Edit: lots of failed integration tests when I changed to this; will investigate.

@jnsgruk
Copy link
Member

jnsgruk commented Oct 18, 2024

Heh. The python plugin doesn't seem to have included any dispatch file...

ubuntu@ubuntu-noble-2e39:~/zinc_charm_unzipped$ ls -la
total 39480
drwxrwxr-x 5 ubuntu ubuntu     4096 Oct 18 10:30 .
drwxr-xr-x 9 ubuntu ubuntu     4096 Oct 18 10:30 ..
drwxrwxr-x 2 ubuntu ubuntu     4096 Oct 18 10:30 bin
drwxrwxr-x 3 ubuntu ubuntu     4096 Oct 18 10:30 lib
drwxrwxr-x 3 ubuntu ubuntu     4096 Oct 18 10:30 lib64
-rw-r--r-- 1 ubuntu ubuntu      255 Oct 18 10:21 manifest.yaml
-rw-r--r-- 1 ubuntu ubuntu     1402 Oct 18 10:21 metadata.yaml
-rw-r--r-- 1 ubuntu ubuntu      169 Oct 18 10:21 pyvenv.cfg

Edit: switched to the latest/edge channel and things seem better:

ubuntu@ubuntu-noble-2e39:~/data/code/charms/zinc-k8s-operator$ unzip -l ./zinc-k8s_amd64.charm | grep -v python3
Archive:  ./zinc-k8s_amd64.charm
  Length      Date    Time    Name
---------  ---------- -----   ----
      272  2024-10-18 10:38   manifest.yaml
     1402  2024-10-18 10:38   metadata.yaml
      673  2024-10-18 10:38   dispatch
      188  2024-10-18 10:34   venv/pyvenv.cfg
     2680  2024-10-03 08:44   src/zinc.py
     3922  2024-10-03 08:44   src/charm.py
        0  2022-05-31 14:57   src/prometheus_alert_rules/.gitkeep
      294  2022-07-30 20:33   src/prometheus_alert_rules/zinc_missing.rule
        0  2022-05-31 14:57   src/loki_alert_rules/.gitkeep
    20957  2023-08-23 13:19   src/grafana_dashboards/zinc.json.tmpl
    99854  2024-08-19 14:12   lib/charms/loki_k8s/v0/loki_push_api.py
    30560  2024-08-28 16:53   lib/charms/traefik_k8s/v2/ingress.py
    96662  2024-08-19 14:12   lib/charms/prometheus_k8s/v0/prometheus_scrape.py
    34280  2024-10-02 08:52   lib/charms/parca/v0/parca_scrape.py
    80536  2024-08-19 14:12   lib/charms/grafana_k8s/v0/grafana_dashboard.py
     9975  2024-10-02 08:52   lib/charms/observability_libs/v0/juju_topology.py
---------                     -------
 41499875                     2412 files

Alas, no dice on deploying, though...

ubuntu@ubuntu-noble-2e39:~/zinc_charm/venv$ juju debug-log
unit-zinc-k8s-0: 10:39:59 WARNING unit.zinc-k8s/0.install ln: failed to create symbolic link '/var/lib/juju/agents/unit-zinc-k8s-0/charm/venv/bin/python': No such file or directory
unit-zinc-k8s-0: 10:39:59 WARNING unit.zinc-k8s/0.install /var/lib/juju/agents/unit-zinc-k8s-0/charm/dispatch: 16: exec: /var/lib/juju/agents/unit-zinc-k8s-0/charm/venv/bin/python: not found
unit-zinc-k8s-0: 10:39:59 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 127

@lengau
Copy link
Collaborator Author

lengau commented Oct 18, 2024

Thanks @jnsgruk! Looks like I forgot to test with python-keep-bins: false (the default). I've made a fix PR, but as a temporary workaround you should also be able to set python-keep-bins: true in the part definition.

@lengau
Copy link
Collaborator Author

lengau commented Oct 18, 2024

@jnsgruk re: the override-pull - while people could do that, I'd prefer not to document it here as I'd like to encourage people to check in some sort of lock file. For the uv case, @bepri is heading up our addition of uv plugins for 25.04

Copy link
Contributor

@medubelko medubelko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting these together!

docs/howto/charm-to-python.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-python.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-python.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-python.rst Show resolved Hide resolved
lengau and others added 2 commits November 1, 2024 10:50
@lengau lengau requested a review from medubelko November 1, 2024 10:12
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-poetry.rst Outdated Show resolved Hide resolved
docs/howto/charm-to-python.rst Outdated Show resolved Hide resolved
Co-authored-by: Michael DuBelko <[email protected]>
@lengau lengau requested a review from medubelko November 12, 2024 14:59
@lengau lengau merged commit ff00a89 into main Nov 13, 2024
16 of 19 checks passed
@lengau lengau deleted the work/1913/CRAFT-3425/howto branch November 13, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document the python and poetry plugins
4 participants