canonical / admission-webhook-operator

Admission Webhook Operator
Apache License 2.0
1 stars 4 forks source link

Add logging relation to admission-webhook #139

Closed rgildein closed 3 months ago

rgildein commented 3 months ago

Use LogForwarder from loki_push_api library to forwards all logs from workload container to Loki. This requires to use ops 2.9 or newer, so it was needed to be updated.

fixes: #133

How I tested it:

# deployed the cos following https://charmhub.io/topics/canonical-observability-stack/tutorials/install-microk8s
$ tox -e integration -- --keep-models
$ juju switch test-charm-59q5
u1-k8s:admin/testing -> u1-k8s:admin/test-charm-59q5
$ juju consume u1-k8s:cos.loki-logging 
Added u1-k8s:admin/cos.loki-logging as loki-logging
$ juju integrate loki-logging grafana-agent-k8s

# we need to wrap the charm and redeploy it because it was removed by one of the tests
$ charmcraft pack 
Created 'admission-webhook_ubuntu-20.04-amd64.charm'.

Charms packed:

    admission-webhook_ubuntu-20.04-amd64.charm
$ juju deploy ./admission-webhook_ubuntu-20.04-amd64.charm --resource oci-image=docker.io/kubeflownotebookswg/poddefaults-webhook:v1.9.0-rc.0
Located local charm "admission-webhook", revision 0
Deploying "admission-webhook" from local charm "admission-webhook", revision 0 on ubuntu@20.04/stable
$ juju integrate grafana-agent-k8s admission-webhook:logging

And after checking the Grafana, I was able to see all logs. Screenshot from 2024-07-03 10-09-26