Source code to operators and examples?

Where can I find the source code to operators on charmhub? I was going to try writing an operator, but could really use an example to cargo-cult off of. I’m not sure, for example, how to specify the Docker image that my operator operates, etc.

I’m also curious how to get Juju to write fragments of k8s yaml that I already have for a deployment.

Much thanks,

Unfortunately you can’t find them on charmhub yet in the same way that you could on the charm store - see for details and progress on fixing that.

However, in many of the charms we’ve written we’ve added a “Contributing/Hacking” section that includes this information. For some examples see:

The code for the the k8s PostgreSQL charm can be found here (we haven’t yet created discourse-based docs for that one, as we’re trying to confirm how to do that for charms that support multiple series).

Generally speaking you can find the source code for charms that don’t have discourse-based docs yet by taking the “deploy” command at the top of the page, and translating that to a charmstore URL. So for example Prometheus has juju deploy cs:~charmcraft/prometheus and shows a project home page of