This exercise serves two purposes:
- Documentation of the current charm behavior.
- A reference point for future discussions about dependencies, code ordering and charming patterns.
Inputs
Charm code gets its inputs from metadata.yaml (oci images, storages, relation data), config.yaml, actions.yaml, files read from charm container.
Input | Responsible ingestor | Side effects / deps / stakeholders |
---|---|---|
Action: show-config | Dedicated handler | |
Action: check-config | Dedicated handler | Relies on amtool and amtool config file in workload container |
Config: config_file | Common exit hook | Overwrite main config file (taking templates_file into account) - mutually exclusive with remote-configuration, reload config via POST |
Config: templates_file | Common exit hook | Overwrite main config file, reload config via POST |
Config: cpu | Resource limits charm lib | Update statefulset, cycle pod; k8s may fail to schedule pod if out of resources. |
Config: memory | Resource limits charm lib | Update statefulset, cycle pod; k8s may fail to schedule pod if out of resources. |
Resource: oci-image | Hardcoded paths in charm code (pebble command, etc.) may change across an upgrade. | |
Baked-in alert rules and dashboards | Prometheus, loki and grafana charm libs | Alert rules and dashboards are manipulated and pushed to relation data; should be updated across an upgrade. |
Requires: ingress | Ingress charm lib | Update all clients with a new url (karma, …) |
Requires: remote-configuration | Common exit hook | Overwrite main config file (taking templates_file into account) - mutually exclusive with config_file |
Requires: certificates | Common exit hook | Update web config file, write certs to workload container, update service command, write ca cert to charm container |
Peer relation: replicas | Common exit hook | Restart service |
Outputs
Charm code produces the following outputs: relation data, requests sent to workload HTTP API, files written to workload and/or charm container, pebble layer.
Output | Content | Related inputs |
---|---|---|
Reload config via POST | Config: config_file | |
Main config file in workload container | YAML | Config: config_file, Requires: remote-configuration |
Templates config file | Alert templates | Config: templates_file |
Web config file in workload container | Cert paths | Requires: certificates |
Amtool config file in workload container | YAML | |
Server cert (workload container) | Requires: certificates | |
Private key file (workload container) | Requires: certificates | |
CA cert (workload container) | Requires: certificates | |
CA cert (charm container) | Requires: certificates | |
Statefulset spec | Cpu, memory requests and limits | Config: cpu, config: memory |
Provides: alerting | Alertmanager server URL | Requires: certificates (TLS on/off impacts advertised scheme) |
Provides: karma-dashboard | Alertmanager server URL | Requires: certificates (TLS on/off impacts advertised scheme), Requires: ingress (impacts advertised url). |
Provides: self-metrics-endpoint | Alertmanager server URL as part of a scrape job spec | Requires: certificates (TLS on/off impacts advertised scheme) |
Provides: grafana-dashboard | Manipulated json files taken from charm container | Baked in dashboards (charm container) |
Provides: grafana-source | Alertmanager server URL | Requires: certificates (TLS on/off impacts advertised scheme) |
Requires: ingress | Alertmanager server URL | Requires: certificates (TLS on/off impacts advertised scheme) |
Requires: catalogue | Alertmanager server URL | Requires: certificates (TLS on/off impacts advertised scheme) |
Requires: certificates | CSR with Alertmanager server URL (fqdn) | |
Peer relation: replicas | Alertmanager server URL | |
Pebble service | Envvars, command | Requires: certificates, Requires: ingress, Peer relation: replicas, JUJU_CHARM_*_PROXY envvars |
Dependency graph
The above can be summarized in a dependency graph: