canonical / grafana-agent-operator

This charmed operator automates the operational procedures of running Grafana Agent, an open-soruce telemetry collector.
https://charmhub.io/grafana-agent
Apache License 2.0
4 stars 8 forks source link

feat: pin snap revision, add metadata to control snaps #120

Closed ca-scribner closed 1 week ago

ca-scribner commented 1 month ago

Issue

(see #131 for a different approach to this problem)

The current charm does not pin the snap installed, instead installing it from latest/stable. This means that the snap version may float, potentially to a backwards incompatible version, without any intervention from the user.

The goals here are to:

Solution

This PR pins the snap to a specific revision by adding:

The snap manifest file is intended to make future maintenance easier, enabling CI to create PRs for future version bumps.

The snap management tools are modified from this

Testing Instructions

CI coverage should handle testing. If testing manually, you can juju ssh into the grafana-agent unit and check snap info grafana-agent, which should pin to revisionn 16 and say the snap has a "hold".

Upgrade Notes

Todo:

ca-scribner commented 1 month ago

I followed the solution from kubernetes since it did very similar things to what we wanted, but part of its complexity is because it handles different architectures, local vs store installs, etc. It ended up feeling a bit like overkill if implemented specifically for this charm, but it does work and if we put it in a package to share with other machine charms it could be really useful and worth the complexity

ca-scribner commented 1 week ago

Closed in favor of #131