-
Notifications
You must be signed in to change notification settings - Fork 4
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
How to add functions that need charm libraries to chisme? #94
Comments
Thank you for reporting us your feedback! The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-5580.
|
My quick experience on this, I had played around with possible solution 3 (point 1 described in that spec section). AFAIR, this was working properly (example function) and the function was acting like it lived inside the charm's code. Also, I had tried adding the libs to |
What I tried to do is fetch-lib in root directory, like this: $ charmcraft fetch-lib charms.prometheus_k8s.v0.prometheus_scrape
Library charms.prometheus_k8s.v0.prometheus_scrape version 0.47 downloaded.
$ ll lib/charms
total 4.0K
drwxrwxr-x 3 rgildein rgildein 4.0K May 22 16:10 prometheus_k8s then I changed the [options]
...
include_package_data = True
[options.package_data]
* = charms/*.py With these changes, we can use libs directly in chisme, like this: from lib.charms.prometheus_k8s.v0.prometheus_scrape import MetricsEndpointProvider With this approach it should be possible to have different version of lib in charm and different version in chisme, so if chisme using lib smartly and charm will never import from |
Context
We've had times where we'd like to move a function that depends on a charm library to chisme (for example, in canonical/envoy-operator#87 and canonical/kfp-operators#436, which both have the same
K8sServiceInfoComponent
).Because these depend on a charm library, chisme would then need that charm library.
An option could do a simple vendoring of the charm libraries in chisme, but then chisme would:
charmcraft fetch-lib
within the charm to update libraries)This likely is not manageable, at least not without some advanced stuff.
Some possible solutions:
pip install chisme[k8s-service-lib]
). I think then in the chisme repo we'd still install the charm lib (somehow manually?) and use it for testing (maybe installing several versions in a matrix of tests) but the charm lib wouldn't ship thoseTo me, (1) is probably the easiest
What needs to get done
Definition of Done
The text was updated successfully, but these errors were encountered: