Deployment
juju deploy cos-configuration-k8s \
--config git_repo=https://path.to/repo \
--config git_branch=main \
--config git_depth=1 \
--config prometheus_alert_rules_path=rules/prod/prometheus/
juju relate cos-configuration-k8s prometheus-k8s
Paths to rules files etc. can also be set after deployment:
juju config cos-configuration-k8s loki_alert_rules_path=rules/prod/loki/
juju relate cos-configuration-k8s loki-k8s
juju config cos-configuration-k8s grafana_dashboards_path=dashboards/prod/grafana/
juju relate cos-configuration-k8s grafana-k8s
Verification
After setting the git_repo
(and optionally git_branch
), the contents should be present in the workload container,
$ juju ssh --container git-sync cos-configuration-k8s/0 ls -l /git
total 4
drwxr-xr-x 6 root root 4096 Oct 24 08:59 7f0b1eac9317850aee320b4f47a7f1527aaff625
lrwxrwxrwx 1 root root 40 Oct 24 08:59 repo -> 7f0b1eac9317850aee320b4f47a7f1527aaff625
and accessible from the charm container
$ juju ssh cos-configuration-k8s/0 ls -l /var/lib/juju/storage/content-from-git/0
total 4
drwxr-xr-x 6 root root 4096 Oct 24 08:59 7f0b1eac9317850aee320b4f47a7f1527aaff625
lrwxrwxrwx 1 root root 40 Oct 24 08:59 repo -> 7f0b1eac9317850aee320b4f47a7f1527aaff625
After relating to e.g. prometheus, rules from the synced repo should appear in app data,
juju show-unit prometheus-k8s/0 --format json | jq '."prometheus-k8s/0"."relation-info"'
as well as in prometheus itself
juju ssh prometheus-k8s/0 curl localhost:9090/api/v1/rules