microk8s
microk8s copied to clipboard
Support using alternative StorageClasses with ```microk8s enable registry```
I've been playing around with microk8s quite a bit lately and I really like how simple you've made it to get a multi-node cluster up and running. I'm running it on a 5-node RPi4 cluster and it works great. I'm using this cluster as a bit of a test bed for different ideas, one of which is reliability when nodes fail.
I'm using Longhorn to provide a distributed storage solution for volumes. I'd really like to be able to use to built-in registry with microk8s but make use of the longhorn storage provider. I was thinking it would be great to be able to have an option like this:
$ microk8s enable registry:storageclass=longhorn
When the storageclass option is specified it would override the storage class.
Hi @mitchdenny. This is a nice suggestion, thank you.
The current registry addon [1] will get its storage from the default storage class. To make sure a default storage class exists it first enables the hostpath-storage addon. We would like to rewrite (probably in python with click) the enable/disable scripts of the registry addon to add -- prefixed arguments.
[1] https://github.com/canonical/microk8s-addons/blob/main/addons/registry
Are there some examples with other addons where you have already done this?
Have a look at the kata enable addon [1]. It should be fairly straight forward on how to pass arguments in the enable script.
As soon as you have the storage class argument you will need to read the registry.yaml and parse it as a yaml file with multiple documents. Here is an example on how we do that [3]. You will need to craft a PVC based on the storage class you got as input.
[1] https://github.com/canonical/microk8s-addons/blob/main/addons/kata/enable#L86 [2] https://github.com/canonical/microk8s-addons/blob/main/addons/registry/registry.yaml#L7 [3] https://github.com/ubuntu/microk8s/blob/master/scripts/calico/upgrade.py#L42
This has been resolved with https://github.com/canonical/microk8s-core-addons/pull/52