Shared and reusable code for OpenSearch Dashboards charms
Project description
OpenSearch Dashboards single-kernel library
Shared Python code for building Juju charms that operate OpenSearch Dashboards.
This repository is the single kernel used by OpenSearch Dashboards charms. It contains the common charm classes, state models, event handlers, managers, and workload abstractions needed to run the same charm logic on machine and Kubernetes substrates.
The single_kernel_opensearch_dashboards/charmcraft.yaml file is a placeholder
charm definition used to fetch and refresh charm libraries. It is not intended
to be deployed as the product charm by itself.
Features
- Base charm classes for VM and Kubernetes charms.
- Shared managers for cluster lifecycle, configuration, health checks, TLS, upgrades, COS integration, and rolling restarts.
- Event handlers for OpenSearch, TLS certificates, OAuth, JWT configuration, OpenSearch Dashboards lifecycle events, and upgrades.
- Workload abstractions for snap-based VM deployments and Kubernetes workloads.
- Structured state and configuration models for charm code.
- Unit, integration, and spread test suites for validating the shared kernel against a test charm.
Repository layout
single_kernel_opensearch_dashboards/
charms/ Base charm classes for VM and Kubernetes charms.
common/ Shared constants and exceptions.
core/ State, config, status, and cluster models.
events/ Juju event handlers.
managers/ Operational managers for charm responsibilities.
workload/ Substrate-specific workload adapters.
lib/ Vendored charm libraries.
tests/
unit/ Unit tests for the shared kernel.
integration/ Integration tests.
spread/ Spread task definitions.
charms/vm/ Test VM charm that consumes the library.
terraform/ Terraform module for deploying OpenSearch Dashboards.
scripts/ Development and charm build helpers.
Requirements
- Python 3.10 or later.
- Poetry 2.0 or later.
- Tox, for local test workflows.
- Charmcraft, for packing charms.
- Juju, for integration and spread tests.
Getting started
Install the project dependencies:
poetry install --with charm-libs,lint,unit
Run the standard local checks:
tox -e lint
tox -e unit
Format the code:
tox -e format
Run integration tests:
tox -e integration
Using the library in a charm
A consuming charm should import one of the substrate-specific base charm classes
and pass it to ops.main.main.
For a machine charm:
#!/usr/bin/env python3
from ops.main import main
from single_kernel_opensearch_dashboards.charms.vm import OpenSearchDashboardsVMCharm
if __name__ == "__main__":
main(OpenSearchDashboardsVMCharm)
For a Kubernetes charm, use:
from single_kernel_opensearch_dashboards.charms.k8s import OpenSearchDashboardsK8sCharm
The consuming charm metadata must provide the relation names expected by the kernel:
- Peer relations:
dashboard_peers,restart,upgrade, andstatus-peers. - Required relation:
opensearch-client. - Optional relations:
certificates,oauth, andjwt-configuration. - Provided relation:
cos-agent.
The test charm under tests/charms/vm is a concrete example of the metadata,
configuration, actions, and entrypoint needed by a VM charm.
Configuration and actions
The shared config model currently exposes:
| Option | Values | Default | Description |
|---|---|---|---|
log_level |
ERROR, WARNING, INFO |
INFO |
Controls OpenSearch Dashboards logging verbosity. |
The test charm exposes these actions:
| Action | Description |
|---|---|
pre-upgrade-check |
Runs pre-upgrade checks before a charm upgrade. |
set-tls-private-key |
Sets or generates the private key used for TLS certificate signing requests. |
status-detail |
Returns detailed charm statuses, optionally recomputing them first. |
Building the test charm
The build helper copies this library into a test charm and packs it:
./scripts/build.sh
To build a specific test charm directory:
./scripts/build.sh tests/charms/vm
When CI_CACHE=true is set, the script uses charmcraftcache; otherwise it
uses charmcraft pack.
Terraform
The terraform/ directory contains a Juju Terraform module for deploying the
OpenSearch Dashboards charm and relating it to OpenSearch. See
terraform/README.md for module inputs, outputs, and
usage examples.
Contributing
Before opening a change, run:
tox -e lint
tox -e unit
For changes that affect charm behavior, also run the relevant integration or spread tests.
Community and support
- Homepage: https://github.com/canonical/opensearch-dashboards-single-kernel-library
- Issues: https://github.com/canonical/opensearch-dashboards-single-kernel-library/issues
- Matrix: https://matrix.to/#/#charmhub-data-platform:ubuntu.com
License
This project is licensed under the Apache License 2.0. See
LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opensearch_dashboards_charms_single_kernel-0.0.6.tar.gz.
File metadata
- Download URL: opensearch_dashboards_charms_single_kernel-0.0.6.tar.gz
- Upload date:
- Size: 136.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07c10d41486d23e747ab7d296154d547bb09c6d95da28f261d44894fd93d1c14
|
|
| MD5 |
dfb5902cef8d333c737d554576109ebd
|
|
| BLAKE2b-256 |
4b7abaa7525df260d93ef0068ad5176afc1fa577c8bd1ea427f72511ca5be011
|
Provenance
The following attestation bundles were made for opensearch_dashboards_charms_single_kernel-0.0.6.tar.gz:
Publisher:
release.yaml on canonical/opensearch-dashboards-single-kernel-library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opensearch_dashboards_charms_single_kernel-0.0.6.tar.gz -
Subject digest:
07c10d41486d23e747ab7d296154d547bb09c6d95da28f261d44894fd93d1c14 - Sigstore transparency entry: 1449221040
- Sigstore integration time:
-
Permalink:
canonical/opensearch-dashboards-single-kernel-library@7ae9566e39d202c912d1d835dafd98085c7bc85a -
Branch / Tag:
refs/heads/2/edge - Owner: https://github.com/canonical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@7ae9566e39d202c912d1d835dafd98085c7bc85a -
Trigger Event:
push
-
Statement type:
File details
Details for the file opensearch_dashboards_charms_single_kernel-0.0.6-py3-none-any.whl.
File metadata
- Download URL: opensearch_dashboards_charms_single_kernel-0.0.6-py3-none-any.whl
- Upload date:
- Size: 159.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efa10c0646ef04dcc6f8f5c6c7f6da961b791fdb62df5da0e282ce518c30055e
|
|
| MD5 |
5f61224972cdb39cb9b162a94ff107a1
|
|
| BLAKE2b-256 |
ff04518e583e59f8dc631f5586baf59cffe0b20304ca1f96e2d2576f548d9ec6
|
Provenance
The following attestation bundles were made for opensearch_dashboards_charms_single_kernel-0.0.6-py3-none-any.whl:
Publisher:
release.yaml on canonical/opensearch-dashboards-single-kernel-library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opensearch_dashboards_charms_single_kernel-0.0.6-py3-none-any.whl -
Subject digest:
efa10c0646ef04dcc6f8f5c6c7f6da961b791fdb62df5da0e282ce518c30055e - Sigstore transparency entry: 1449221054
- Sigstore integration time:
-
Permalink:
canonical/opensearch-dashboards-single-kernel-library@7ae9566e39d202c912d1d835dafd98085c7bc85a -
Branch / Tag:
refs/heads/2/edge - Owner: https://github.com/canonical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@7ae9566e39d202c912d1d835dafd98085c7bc85a -
Trigger Event:
push
-
Statement type: