Repository navigation
docs: add a how-to set up production integrations guide #2835
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
Changes from 5 commits
3760a85
7918078
1606c58
74be8b9
13c1911
abe9246
37ac5d6
9c1bf2c
5222dc8
1533301
d5f6d76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,106 @@ | ||||||
| --- | ||||||
| myst: | ||||||
| html_meta: | ||||||
| description: Guidance for integrating your charm with common services, including ingress, observability, databases, TLS, object storage, and identity. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
| --- | ||||||
|
|
||||||
| (set-up-production-integrations)= | ||||||
| # How to set up production integrations | ||||||
|
|
||||||
| See first: {ref}`charm-maturity`. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| A production-ready charm should fit into the Juju ecosystem, integrating with other applications. Therefore, it needs to be compatible with other charms. This guide summarises the integrations that production charms most often support. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| These integrations are not mandatory for your charm to work. You need to decide which ones to use based on your charm's workload. | ||||||
|
|
||||||
| ```{tip} | ||||||
| If your charm uses a Charmcraft 12-factor app extension, many integrations are set up for you. Check {external+charmcraft:ref}`Charmcraft | Manage relations for a 12-factor app charm <integrate-12-factor-charms>` for more information. To add custom integrations to a 12-factor app charm, follow [Add a custom integration to a 12-factor app charm](https://canonical.com/juju/docs/12-factor/latest/how-to/add-custom-relation/) instead of this page. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
| ``` | ||||||
|
|
||||||
| (set-up-production-integrations-best-practices)= | ||||||
| ## Best practices | ||||||
|
|
||||||
| Juju integrates endpoints that use the same interface name. You should use existing interface names for any integration that your charm supports. To browse the available interface names and their supporting libraries, see {external+charmlibs:ref}`Charmlibs | Interface libraries <charm-libs-interface>` and the {external+charmlibs:ref}`interface specifications <reference-interfaces>`. | ||||||
|
tromai marked this conversation as resolved.
Resolved
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| Writing integration tests is the best way to validate that your charm can integrate well with others. See {ref}`How to manage relations | Write integration tests <manage-relations-integration-tests>`. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| If no existing interface fits your workload, you can design a new one. See {ref}`manage-interfaces`. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| (set-up-production-integrations-ingress)= | ||||||
| ## Ingress | ||||||
|
|
||||||
| Integrate your charm with an ingress provider when your workload serves HTTP or HTTPS, and users or applications outside the model need to reach it. Your charm declares a `requires` endpoint that uses the `ingress` interface, and consumes the ingress data from the provider. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| Some providers: | ||||||
|
|
||||||
| * [Traefik](https://charmhub.io/traefik-k8s), [NGINX Ingress Integrator](https://charmhub.io/nginx-ingress-integrator), and [Istio Ingress](https://charmhub.io/istio-ingress-k8s) on Kubernetes. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
| * [Ingress Configurator](https://charmhub.io/ingress-configurator) on machines. It translates `ingress` to the `haproxy-route` interface of the [HAProxy](https://charmhub.io/haproxy) charm. | ||||||
|
|
||||||
| In most cases, your charm can use the [ingress library](https://github.com/canonical/traefik-k8s-operator/blob/main/lib/charms/traefik_k8s/v2/ingress.py). You can use alternative libraries, as long as they fulfil the {external+charmlibs:ref}`ingress v2 interface specification <interfaces-ingress-v2>`. | ||||||
|
tromai marked this conversation as resolved.
Resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is this speculative or is there evidence that people do (or want to) do this? If there's no clear evidence, I'd say drop it in favour of pushing people towards typical solutions:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sentence was introduced at the beginning because I wanted to introduce about interface specification, so a charm can stay production-ready even if they use an alternative library. In other sections, I also mention interface specification in the same manner. I previously had an example of istio-ingress-route, but this interface library relies on a different interface, and we decided to drop it. I agree with you, I think we should suggest the typical solution. Advanced users could explore the specification from the charmlibs documentation. I will remove this sentence. EDIT: may be I can keep it, and change it to |
||||||
|
|
||||||
| See more: [Jenkins](https://github.com/canonical/jenkins-k8s-operator/blob/main/src/charm.py). | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| (set-up-production-integrations-observability)= | ||||||
| ## Observability | ||||||
|
|
||||||
| Integrate your charm with the [Canonical Observability Stack (COS)](https://documentation.ubuntu.com/observability/) to provide metrics, logs, alerts, and dashboards for your workload in production. Most charms with a workload need it. A charm that doesn't run a workload, such as an integrator charm, might not. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| To integrate your charm with COS: | ||||||
|
|
||||||
| * On Kubernetes, your charm integrates with each COS component over its own interface. Declare a `provides` endpoint for each of `prometheus_scrape` (Prometheus) and `grafana_dashboard` (Grafana), and a `requires` endpoint for `loki_push_api` (Loki). See {ref}`Observe your charm with COS Lite tutorial <observe-your-charm-with-cos-lite>`. To trace your charm code and send the trace data to COS, see {ref}`trace-your-charm`. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
| * On machines, your charm declares a single `provides` endpoint that uses the `cos_agent` interface. Use the [`cos_agent` charm library](https://charmhub.io/grafana-agent/libraries/cos_agent) to implement it. The [OpenTelemetry Collector](https://charmhub.io/opentelemetry-collector) subordinate charm forwards everything to COS. See more: [COS | Instrument machine charms](https://documentation.ubuntu.com/observability/latest/how-to/integrate/instrument-machine-charms/). | ||||||
|
|
||||||
| See more: [Hydra](https://github.com/canonical/hydra-operator/blob/main/src/charm.py), [Valkey](https://github.com/canonical/valkey-operator/blob/9/edge/src/events/observability.py). | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| (set-up-production-integrations-databases)= | ||||||
| ## Databases | ||||||
|
|
||||||
| Charms often need to connect to a database. Your charm declares a `requires` endpoint that uses the interface for your database. Each database technology has its own interface: | ||||||
|
|
||||||
| | Database | Interface | Provider charms | | ||||||
| |:--|:--|:--| | ||||||
| | PostgreSQL | `postgresql_client` | [`postgresql`](https://charmhub.io/postgresql), [`postgresql-k8s`](https://charmhub.io/postgresql-k8s) | | ||||||
| | MySQL | `mysql_client` | [`mysql`](https://charmhub.io/mysql), [`mysql-k8s`](https://charmhub.io/mysql-k8s) | | ||||||
| | MongoDB | `mongodb_client` | [`mongodb`](https://charmhub.io/mongodb), [`mongodb-k8s`](https://charmhub.io/mongodb-k8s) | | ||||||
|
|
||||||
| The [`dpcharmlibs-interfaces`](https://github.com/canonical/data-platform-charmlibs/blob/main/interfaces/README.md) library covers all of these interfaces. New charms should use this library. Some existing charms still use the older `data_platform_libs.v0.data_interfaces` charm library. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| See more: [MediaWiki](https://github.com/canonical/mediawiki-k8s-operator/blob/main/src/relations/valkey.py) uses `dpcharmlibs-interfaces` for its Valkey relation (interface `valkey_client`). [Discourse](https://github.com/canonical/discourse-k8s-operator/blob/main/src/database.py) requires `postgresql_client` and [MediaWiki](https://github.com/canonical/mediawiki-k8s-operator/blob/main/src/relations/database.py) requires `mysql_client`, but both still use the older v0 library for these. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| (set-up-production-integrations-tls)= | ||||||
| ## TLS certificates | ||||||
|
|
||||||
| Integrate your charm with a certificate provider when your workload needs TLS certificates, for example to serve or query from HTTPS endpoints. Your charm declares a `requires` endpoint that uses the `tls-certificates` interface and receives certificates from the provider. | ||||||
|
|
||||||
| Some providers: | ||||||
|
|
||||||
| * [Self Signed Certificates](https://charmhub.io/self-signed-certificates) | ||||||
| * [Lego](https://charmhub.io/lego) | ||||||
| * [Manual TLS Certificates](https://charmhub.io/manual-tls-certificates) | ||||||
| * [Vault](https://charmhub.io/vault-k8s) | ||||||
|
|
||||||
| New charms should use the {external+charmlibs:ref}`charmlibs-interfaces-tls-certificates <charmlibs-interfaces-tls-certificates>` library. See also the {external+charmlibs:ref}`tls-certificates v1 interface specification <interfaces-tls-certificates-v1>`. Some existing charms still use the older `charms.tls_certificates_interface` charm library. | ||||||
|
tromai marked this conversation as resolved.
Resolved
tromai marked this conversation as resolved.
Resolved
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| See more: [NGINX Ingress Integrator](https://github.com/canonical/nginx-ingress-integrator-operator/blob/main/src/charm.py), [Landscape](https://github.com/canonical/landscape-charm/blob/main/src/charm.py). | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| (set-up-production-integrations-object-storage)= | ||||||
| ## Object storage | ||||||
|
|
||||||
| Integrate your charm with an object storage provider when your workload needs S3-compatible storage. Your charm declares a `requires` endpoint that uses the `s3` interface, and receives the endpoint, bucket, and credentials from the provider. | ||||||
|
|
||||||
| The main provider is [S3 Integrator](https://github.com/canonical/object-storage-integrator/blob/main/s3/README.md), which you configure with the details of an S3-compatible service. Its documentation explains how to set it up and which charm library to use. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other sections name the library, and the README and charmlibs listing both recommend object-storage-charmlib, so maybe this should too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank for pointing it out. I agree. I updated the provider Charmhub link, consistent with other sections and showed the |
||||||
|
|
||||||
| See more: [MLflow](https://github.com/canonical/mlflow-operator/blob/main/src/charm.py), [Valkey](https://github.com/canonical/valkey-operator/blob/9/edge/src/events/backup.py). | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| (set-up-production-integrations-identity)= | ||||||
| ## Identity | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tonyandrewmeyer I might need some help with this section. This is a new topic for me, and I tried my best to match their documentation with the structure of this page. Is
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think Canonical Identity is the right place to send people. As far as I can tell it covers two stacks: the Identity Platform (Hydra, Kratos, GLAuth) and Authentik. The providers you have are right (I checked the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the response and help!
I agree, I have added I also contacted the Identity team (Alessandro), and am now waiting for their response. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (from Identity team): Overall lgtm, except that IMO it is a little misleading listing the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nsklikas Thank you for the review. I included I agree that it can be confusing listing together with other charms that provide functionality. I will add a small sentence to clarify. |
||||||
|
|
||||||
| Use the [Canonical Identity Stack](https://canonical-identity.readthedocs-hosted.com/) for identity and access management of your charm. To compare the available solutions, see [Choosing an identity solution](https://canonical-identity.readthedocs-hosted.com/choosing-an-identity-solution/). Your charm declares a `requires` endpoint that uses the interface for the protocol that your workload supports: | ||||||
|
|
||||||
| | Protocol | Interface | Provider charms | Library | | ||||||
| |:--|:--|:--|:--| | ||||||
| | OAuth 2.0 and OpenID Connect (OIDC) | `oauth` | [`hydra`](https://canonical-identity.readthedocs-hosted.com/identity-platform/how-to/onboard-an-application-with-charmed-hydra/), [`authentik-server`](https://canonical-identity.readthedocs-hosted.com/authentik/how-to/protect-oidc-applications/) | {external+charmlibs:ref}`charmlibs-interfaces-oauth <charmlibs-interfaces-oauth>` | | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
| | LDAP | `ldap` | [`glauth-k8s`](https://canonical-identity.readthedocs-hosted.com/identity-platform/tutorial/charms/glauth/), [`authentik-ldap-outpost`](https://canonical-identity.readthedocs-hosted.com/authentik/how-to/protect-ldap-applications/) | {external+charmlibs:ref}`charmlibs-interfaces-ldap <charmlibs-interfaces-ldap>` | | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
| | SAML | `saml` | [`saml-integrator`](https://charmhub.io/saml-integrator) | [`saml` charm library](https://charmhub.io/saml-integrator/libraries/saml) | | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
|
|
||||||
| See more: [SSSD](https://github.com/canonical/sssd-operator/blob/main/src/integrations/ldap.py) uses the LDAP library, and [Discourse](https://github.com/canonical/discourse-k8s-operator/blob/main/src/charm.py) uses the SAML library. | ||||||
|
tromai marked this conversation as resolved.
Resolved
|
||||||
Uh oh!
There was an error while loading. Please reload this page.