microk8s icon indicating copy to clipboard operation
microk8s copied to clipboard

Support using alternative StorageClasses with ```microk8s enable registry```

Open mitchdenny opened this issue 3 years ago • 3 comments
trafficstars

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.

mitchdenny avatar Feb 18 '22 07:02 mitchdenny

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

ktsakalozos avatar Feb 21 '22 08:02 ktsakalozos

Are there some examples with other addons where you have already done this?

mitchdenny avatar Feb 21 '22 23:02 mitchdenny

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

ktsakalozos avatar Feb 22 '22 08:02 ktsakalozos

This has been resolved with https://github.com/canonical/microk8s-core-addons/pull/52

neoaggelos avatar Nov 05 '22 11:11 neoaggelos