My team is automating our deployments of microk8s and we’re looking for the “right” way to do this with Snapcraft. Beyond the off-the-shelf microk8s snap, all of our deployments need a specific set of options enabled and one or two lines of custom configuration. In Docker, the toolchain we’re more familiar with, this would be straightforward. We’d simply build a custom container image that uses microk8s as the base and adds our customizations on top, resulting in an image we can deploy everywhere that has everything we need. Does the same approach work in Snapcraft? Could we create a custom snap that uses microk8s as the base and adds our custom configuration at build or stage time? Is there a better way to do this using Snapcraft?
One (hackish) way to do this would be to effectively publish a fork of the snap, and use
stage-snaps to include the upstream microk8s snap in your snap. The primary disadvantage of this is that you would need to update your snap with updates to microk8s and you would need to get permission to publish since, currently, microk8s is a classic snap.
A different way to do this would probably be to look into how you setup microk8s to do the things you want and build another snap that talks to the microk8s snap that performs these things, possibly via HTTP or config files or something. There may be work that the microk8s folks need to do to make this easier for you, but your use case sounds like a common microk8s use-case. @kjackal maybe you can comment on this?