From 49b28ff946aaf1f9a5d12898d65a3442f1260fda Mon Sep 17 00:00:00 2001 From: Piotr Resztak Date: Sun, 2 Oct 2022 22:44:49 +0200 Subject: [PATCH] Fix setting default StorageClass --- pkg/addons/addons_storage_classes.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/addons/addons_storage_classes.go b/pkg/addons/addons_storage_classes.go index cc3aac77f71c..949c28228df4 100644 --- a/pkg/addons/addons_storage_classes.go +++ b/pkg/addons/addons_storage_classes.go @@ -64,6 +64,10 @@ func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val st } if enable { + // Enable addon before marking it as default + if err = EnableOrDisableAddon(cc, name, val); err != nil { + return err + } // Only StorageClass for 'name' should be marked as default err = storageclass.SetDefaultStorageClass(storagev1, class) if err != nil { @@ -75,7 +79,10 @@ func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val st if err != nil { return errors.Wrapf(err, "Error disabling %s as the default storage class", class) } + if err = EnableOrDisableAddon(cc, name, val); err != nil { + return err + } } - return EnableOrDisableAddon(cc, name, val) + return nil }