longhorn: set storageclass as default consistently with what sylva-units computes

I observed in my CAPO development environment, where I had enabled longhorn controllers to play with it, that the longhorn storage class is being set by longhorn chart as default (storageclass.kubernetes.io/is-default-class: "true" annotation) although the storage class computed as the default one by sylva-units is cinder-csi.

This MR ensures that the longhorn Helm chart will set the (storageclass.kubernetes.io/is-default-class: "true" annotation) on the Longhorn storage class only if the computation in sylva-units picked longhorn as the default storage class.

This will ensure that we can avoid cases where the Longhorn class would be set as default additionally to another one.

Before:

$ k get storageclasses
NAME                        PROVISIONER                            RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
cinder-csi (default)        cinder.csi.openstack.org               Delete          Immediate              true                   35d
local-path                  cluster.local/local-path-provisioner   Delete          WaitForFirstConsumer   true                   35d
longhorn (default)          driver.longhorn.io                     Delete          Immediate              true                   21h
         ^^^^^^^^^ 🙁
longhorn-static             driver.longhorn.io                     Delete          Immediate              true                   7d20h
two-replicas-storageclass   driver.longhorn.io                     Delete          Immediate              true                   7d19h

After:

$ k get storageclasses
NAME                        PROVISIONER                            RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
cinder-csi (default)        cinder.csi.openstack.org               Delete          Immediate              true                   35d
local-path                  cluster.local/local-path-provisioner   Delete          WaitForFirstConsumer   true                   35d
longhorn                    driver.longhorn.io                     Delete          Immediate              true                   12s
            ^^^ ok ✅
longhorn-static             driver.longhorn.io                     Delete          Immediate              true                   7d20h
two-replicas-storageclass   driver.longhorn.io                     Delete          Immediate              true                   7d20h
Edited by Thomas Morin

Merge request reports

Loading